@@ -3063,6 +3063,8 @@ parser_parse_program (const char *source_p, /**< source code buffer */
30633063 size_t source_size, /* *< source code size in bytes */
30643064 bool in_function, /* *< flag indicating if we are parsing body of a function */
30653065 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 */
30663068 const opcode_t **out_opcodes_p) /* *< out: generated byte-code array
30673069 * (in case there were no syntax errors) */
30683070{
@@ -3089,6 +3091,7 @@ parser_parse_program (const char *source_p, /**< source code buffer */
30893091 STACK_INIT (scopes);
30903092 STACK_PUSH (scopes, scopes_tree_init (NULL ));
30913093 serializer_set_scope (STACK_TOP (scopes));
3094+ scopes_tree_set_strict_mode (STACK_TOP (scopes), is_strict);
30923095 lexer_set_strict_mode (scopes_tree_strict_mode (STACK_TOP (scopes)));
30933096
30943097 jmp_buf *syntax_error_label_p = syntax_get_syntax_error_longjmp_label ();
@@ -3166,7 +3169,7 @@ parser_parse_script (const char *source, /**< source script */
31663169 const opcode_t **opcodes_p) /* *< out: generated byte-code array
31673170 * (in case there were no syntax errors) */
31683171{
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);
31703173} /* parser_parse_script */
31713174
31723175/* *
@@ -3178,10 +3181,12 @@ parser_parse_script (const char *source, /**< source script */
31783181bool
31793182parser_parse_eval (const char *source, /* *< string passed to eval() */
31803183 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 */
31813186 const opcode_t **opcodes_p) /* *< out: generated byte-code array
31823187 * (in case there were no syntax errors) */
31833188{
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);
31853190} /* parser_parse_eval */
31863191
31873192/* *
@@ -3207,7 +3212,12 @@ parser_parse_new_function (const char **params, /**< array of arguments of new F
32073212 FIXME (" check parameter's name for syntax errors" );
32083213 lit_find_or_create_literal_from_charset ((ecma_char_t *) params[i], (ecma_length_t ) strlen (params[i]));
32093214 }
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);
32113221} /* parser_parse_new_function */
32123222
32133223/* *
0 commit comments