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