Inherit strictness from invoking function in eval.

This commit is contained in:
Tor Andersson
2018-09-03 16:07:17 +02:00
parent 2c0c6c94ca
commit dcb3f03e90
3 changed files with 4 additions and 4 deletions

View File

@@ -1359,7 +1359,7 @@ js_Function *jsC_compilefunction(js_State *J, js_Ast *prog)
return newfun(J, prog->a, prog->b, prog->c, 0, J->default_strict);
}
js_Function *jsC_compile(js_State *J, js_Ast *prog)
js_Function *jsC_compilescript(js_State *J, js_Ast *prog, int default_strict)
{
return newfun(J, NULL, NULL, prog, 1, J->default_strict);
return newfun(J, NULL, NULL, prog, 1, default_strict);
}

View File

@@ -148,7 +148,7 @@ struct js_Function
};
js_Function *jsC_compilefunction(js_State *J, js_Ast *prog);
js_Function *jsC_compile(js_State *J, js_Ast *prog);
js_Function *jsC_compilescript(js_State *J, js_Ast *prog, int default_strict);
const char *jsC_opcodestring(enum js_OpCode opcode);
void jsC_dumpfunction(js_State *J, js_Function *fun);

View File

@@ -105,7 +105,7 @@ static void js_loadstringx(js_State *J, const char *filename, const char *source
}
P = jsP_parse(J, filename, source);
F = jsC_compile(J, P);
F = jsC_compilescript(J, P, iseval ? J->strict : J->default_strict);
jsP_freeparse(J);
js_newscript(J, F, iseval ? (J->strict ? J->E : NULL) : J->GE);