ref: dcb3f03e9071adaf611bba64b65760095a38ced5
parent: 2c0c6c94ca2ab0132bee57e369070eed6a73c9a6
author: Tor Andersson <tor.andersson@artifex.com>
date: Mon Sep 3 12:07:17 EDT 2018
Inherit strictness from invoking function in eval.
--- a/jscompile.c
+++ b/jscompile.c
@@ -1359,7 +1359,7 @@
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);
}
--- a/jscompile.h
+++ b/jscompile.h
@@ -148,7 +148,7 @@
};
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);
--- a/jsstate.c
+++ b/jsstate.c
@@ -105,7 +105,7 @@
}
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);