@@ -49,7 +49,7 @@ export class Evaluator {
49
49
if ( err instanceof JspyEvalError ) {
50
50
throw err ;
51
51
} else {
52
- const loc = node . loc ? node . loc : [ 0 , 0 ]
52
+ const loc = node . loc ? node . loc : [ 0 , 0 ] ;
53
53
throw new JspyEvalError ( ast . name , loc [ 0 ] , loc [ 1 ] , err . message || err )
54
54
}
55
55
}
@@ -131,9 +131,9 @@ export class Evaluator {
131
131
if ( node . type === 'if' ) {
132
132
const ifNode = node as IfNode ;
133
133
if ( this . evalNode ( ifNode . conditionNode , blockContext ) ) {
134
- this . evalBlock ( { type : 'if' , body : ifNode . ifBody } as AstBlock , blockContext ) ;
134
+ this . evalBlock ( { name : blockContext . moduleName , type : 'if' , body : ifNode . ifBody } as AstBlock , blockContext ) ;
135
135
} else if ( ifNode . elseBody ) {
136
- this . evalBlock ( { type : 'if' , body : ifNode . elseBody } as AstBlock , blockContext ) ;
136
+ this . evalBlock ( { name : blockContext . moduleName , type : 'if' , body : ifNode . elseBody } as AstBlock , blockContext ) ;
137
137
}
138
138
139
139
return ;
@@ -166,7 +166,7 @@ export class Evaluator {
166
166
167
167
for ( let item of array ) {
168
168
blockContext . blockScope . set ( forNode . itemVarName , item ) ;
169
- this . evalBlock ( { type : 'for' , body : forNode . body } as AstBlock , blockContext ) ;
169
+ this . evalBlock ( { name : blockContext . moduleName , type : 'for' , body : forNode . body } as AstBlock , blockContext ) ;
170
170
if ( blockContext . continueCalled ) { blockContext . continueCalled = false ; }
171
171
if ( blockContext . breakCalled ) { break ; }
172
172
}
@@ -178,7 +178,7 @@ export class Evaluator {
178
178
const whileNode = node as WhileNode ;
179
179
180
180
while ( this . evalNode ( whileNode . condition , blockContext ) ) {
181
- this . evalBlock ( { type : 'while' , body : whileNode . body } as AstBlock , blockContext ) ;
181
+ this . evalBlock ( { name : blockContext . moduleName , type : 'while' , body : whileNode . body } as AstBlock , blockContext ) ;
182
182
183
183
if ( blockContext . continueCalled ) { blockContext . continueCalled = false ; }
184
184
if ( blockContext . breakCalled ) { break ; }
0 commit comments