@@ -3062,6 +3062,8 @@ parser_parse_program (const char *source_p, /**< source code buffer */
3062
3062
size_t source_size, /* *< source code size in bytes */
3063
3063
bool in_function, /* *< flag indicating if we are parsing body of a function */
3064
3064
bool in_eval, /* *< flag indicating if we are parsing body of eval code */
3065
+ bool is_strict, /* *< flag, indicating whether current code
3066
+ * inherited strict mode from code of an outer scope */
3065
3067
const opcode_t **out_opcodes_p) /* *< out: generated byte-code array
3066
3068
* (in case there were no syntax errors) */
3067
3069
{
@@ -3088,6 +3090,7 @@ parser_parse_program (const char *source_p, /**< source code buffer */
3088
3090
STACK_INIT (scopes);
3089
3091
STACK_PUSH (scopes, scopes_tree_init (NULL ));
3090
3092
serializer_set_scope (STACK_TOP (scopes));
3093
+ scopes_tree_set_strict_mode (STACK_TOP (scopes), is_strict);
3091
3094
lexer_set_strict_mode (scopes_tree_strict_mode (STACK_TOP (scopes)));
3092
3095
3093
3096
jmp_buf *syntax_error_label_p = syntax_get_syntax_error_longjmp_label ();
@@ -3165,7 +3168,7 @@ parser_parse_script (const char *source, /**< source script */
3165
3168
const opcode_t **opcodes_p) /* *< out: generated byte-code array
3166
3169
* (in case there were no syntax errors) */
3167
3170
{
3168
- return parser_parse_program (source, source_size, false , false , opcodes_p);
3171
+ return parser_parse_program (source, source_size, false , false , false , opcodes_p);
3169
3172
} /* parser_parse_script */
3170
3173
3171
3174
/* *
@@ -3177,10 +3180,12 @@ parser_parse_script (const char *source, /**< source script */
3177
3180
bool
3178
3181
parser_parse_eval (const char *source, /* *< string passed to eval() */
3179
3182
size_t source_size, /* *< string size in bytes */
3183
+ bool is_strict, /* *< flag, indicating whether eval is called
3184
+ * from strict code in direct mode */
3180
3185
const opcode_t **opcodes_p) /* *< out: generated byte-code array
3181
3186
* (in case there were no syntax errors) */
3182
3187
{
3183
- return parser_parse_program (source, source_size, false , true , opcodes_p);
3188
+ return parser_parse_program (source, source_size, false , true , is_strict, opcodes_p);
3184
3189
} /* parser_parse_eval */
3185
3190
3186
3191
/* *
@@ -3206,7 +3211,12 @@ parser_parse_new_function (const char **params, /**< array of arguments of new F
3206
3211
FIXME (" check parameter's name for syntax errors" );
3207
3212
lit_find_or_create_literal_from_charset ((ecma_char_t *) params[i], (ecma_length_t ) strlen (params[i]));
3208
3213
}
3209
- return parser_parse_program (params[params_count - 1 ], strlen (params[params_count - 1 ]), true , false , out_opcodes_p);
3214
+ return parser_parse_program (params[params_count - 1 ],
3215
+ strlen (params[params_count - 1 ]),
3216
+ true ,
3217
+ false ,
3218
+ false ,
3219
+ out_opcodes_p);
3210
3220
} /* parser_parse_new_function */
3211
3221
3212
3222
/* *
0 commit comments