File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -274,15 +274,23 @@ export class BaseVariableResolver {
274
274
275
275
const reversedVariables = [ ...scopeVariables , ...parentsScopeVariables ] . reverse ( ) ;
276
276
277
+ const seenNames = new Set ( ) ;
278
+
277
279
return reversedVariables . filter ( variable => {
278
280
279
281
// if external variable, keep
280
282
if ( variable . provider . find ( extractor => extractor !== this . _baseExtractor ) ) {
281
283
return true ;
282
284
}
283
285
284
- // if not external, keep only if first of its name
285
- return reversedVariables . find ( v => v . name === variable . name ) === variable ;
286
+ // if not external, keep only the first occurrence of each name
287
+ if ( ! seenNames . has ( variable . name ) ) {
288
+ seenNames . add ( variable . name ) ;
289
+
290
+ return true ;
291
+ }
292
+
293
+ return false ;
286
294
} ) ;
287
295
}
288
296
}
You can’t perform that action at this time.
0 commit comments