@@ -25,7 +25,7 @@ import TemplateScope from './nodes/shared/TemplateScope';
25
25
import fuzzymatch from '../utils/fuzzymatch' ;
26
26
import get_object from './utils/get_object' ;
27
27
import Slot from './nodes/Slot' ;
28
- import { Node , ImportDeclaration , ExportNamedDeclaration , Identifier , ExpressionStatement , AssignmentExpression , Literal , Property , RestElement , ExportDefaultDeclaration , ExportAllDeclaration , FunctionDeclaration , FunctionExpression } from 'estree' ;
28
+ import { Node , ImportDeclaration , ExportNamedDeclaration , Identifier , ExpressionStatement , AssignmentExpression , Literal , Property , RestElement , ExportDefaultDeclaration , ExportAllDeclaration , FunctionDeclaration , FunctionExpression , VariableDeclarator } from 'estree' ;
29
29
import add_to_set from './utils/add_to_set' ;
30
30
import check_graph_for_cycles from './utils/check_graph_for_cycles' ;
31
31
import { print , b } from 'code-red' ;
@@ -1309,12 +1309,12 @@ export default class Component {
1309
1309
walk ( node . body , {
1310
1310
enter ( node : Node , parent ) {
1311
1311
if ( node . type === 'VariableDeclaration' && node . kind === 'var' ) {
1312
- const names = extract_names ( node . declarations [ 0 ] . id ) ;
1313
- const is_var_in_outset = names . every ( ( i : string ) => {
1314
- if ( outset_scope_decalarations . has ( i ) ) {
1315
- const varNode = outset_scope_decalarations . get ( i ) ;
1316
- return varNode === node ;
1317
- }
1312
+ const is_var_in_outset = node . declarations . some ( ( declaration : VariableDeclarator ) => {
1313
+ const names : string [ ] = extract_names ( declaration . id ) ;
1314
+ return ! ! names . find ( ( name : string ) => {
1315
+ const var_node = outset_scope_decalarations . get ( name ) ;
1316
+ return var_node === node ;
1317
+ } ) ;
1318
1318
} ) ;
1319
1319
if ( is_var_in_outset ) {
1320
1320
return component . error ( node as any , compiler_errors . invalid_var_declaration ) ;
0 commit comments