@@ -49,7 +49,7 @@ export class Evaluator {
4949 if ( err instanceof JspyEvalError ) {
5050 throw err ;
5151 } else {
52- const loc = node . loc ? node . loc : [ 0 , 0 ]
52+ const loc = node . loc ? node . loc : [ 0 , 0 ] ;
5353 throw new JspyEvalError ( ast . name , loc [ 0 ] , loc [ 1 ] , err . message || err )
5454 }
5555 }
@@ -131,9 +131,9 @@ export class Evaluator {
131131 if ( node . type === 'if' ) {
132132 const ifNode = node as IfNode ;
133133 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 ) ;
135135 } 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 ) ;
137137 }
138138
139139 return ;
@@ -166,7 +166,7 @@ export class Evaluator {
166166
167167 for ( let item of array ) {
168168 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 ) ;
170170 if ( blockContext . continueCalled ) { blockContext . continueCalled = false ; }
171171 if ( blockContext . breakCalled ) { break ; }
172172 }
@@ -178,7 +178,7 @@ export class Evaluator {
178178 const whileNode = node as WhileNode ;
179179
180180 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 ) ;
182182
183183 if ( blockContext . continueCalled ) { blockContext . continueCalled = false ; }
184184 if ( blockContext . breakCalled ) { break ; }
0 commit comments