@@ -135,6 +135,21 @@ export interface ICustomParameterValuesForOperation {
135135 ignoredParameterNames : ReadonlyArray < string > ;
136136}
137137
138+ /**
139+ * Helper function to collect all parameter arguments for a phase
140+ */
141+ function collectPhaseParameterArguments ( phase : IPhase ) : Set < string > {
142+ const customParameterSet : Set < string > = new Set ( ) ;
143+ for ( const tsCommandLineParameter of phase . associatedParameters ) {
144+ const tempArgs : string [ ] = [ ] ;
145+ tsCommandLineParameter . appendToArgList ( tempArgs ) ;
146+ for ( const arg of tempArgs ) {
147+ customParameterSet . add ( arg ) ;
148+ }
149+ }
150+ return customParameterSet ;
151+ }
152+
138153/**
139154 * Memoizer for custom parameter values by phase
140155 * @returns A function that returns the custom parameter values for a given phase
@@ -145,12 +160,7 @@ export function getCustomParameterValuesByPhase(): (phase: IPhase) => ReadonlyAr
145160 function getCustomParameterValuesForPhase ( phase : IPhase ) : ReadonlyArray < string > {
146161 let customParameterSet : Set < string > | undefined = customParametersByPhase . get ( phase ) ;
147162 if ( ! customParameterSet ) {
148- const customParameterValues : string [ ] = [ ] ;
149- for ( const tsCommandLineParameter of phase . associatedParameters ) {
150- tsCommandLineParameter . appendToArgList ( customParameterValues ) ;
151- }
152-
153- customParameterSet = new Set ( customParameterValues ) ;
163+ customParameterSet = collectPhaseParameterArguments ( phase ) ;
154164 customParametersByPhase . set ( phase , customParameterSet ) ;
155165 }
156166
@@ -176,15 +186,7 @@ export function getCustomParameterValuesForOperation(): (
176186 // Get or compute the set of all custom parameters for this phase
177187 let customParameterSet : Set < string > | undefined = customParametersByPhase . get ( phase ) ;
178188 if ( ! customParameterSet ) {
179- customParameterSet = new Set ( ) ;
180- for ( const tsCommandLineParameter of phase . associatedParameters ) {
181- const tempArgs : string [ ] = [ ] ;
182- tsCommandLineParameter . appendToArgList ( tempArgs ) ;
183- for ( const arg of tempArgs ) {
184- customParameterSet . add ( arg ) ;
185- }
186- }
187-
189+ customParameterSet = collectPhaseParameterArguments ( phase ) ;
188190 customParametersByPhase . set ( phase , customParameterSet ) ;
189191 }
190192
0 commit comments