@@ -3062,6 +3062,8 @@ parser_parse_program (const char *source_p, /**< source code buffer */
30623062                      size_t  source_size, /* *< source code size in bytes */ 
30633063                      bool  in_function, /* *< flag indicating if we are parsing body of a function */ 
30643064                      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 */  
30653067                      const  opcode_t  **out_opcodes_p) /* *< out: generated byte-code array
30663068                                                       *  (in case there were no syntax errors) */  
30673069{
@@ -3088,6 +3090,7 @@ parser_parse_program (const char *source_p, /**< source code buffer */
30883090  STACK_INIT  (scopes);
30893091  STACK_PUSH  (scopes, scopes_tree_init  (NULL ));
30903092  serializer_set_scope  (STACK_TOP  (scopes));
3093+   scopes_tree_set_strict_mode  (STACK_TOP  (scopes), is_strict);
30913094  lexer_set_strict_mode  (scopes_tree_strict_mode  (STACK_TOP  (scopes)));
30923095
30933096  jmp_buf *syntax_error_label_p = syntax_get_syntax_error_longjmp_label  ();
@@ -3165,7 +3168,7 @@ parser_parse_script (const char *source, /**< source script */
31653168                     const  opcode_t  **opcodes_p) /* *< out: generated byte-code array
31663169                                                  *  (in case there were no syntax errors) */  
31673170{
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);
31693172} /*  parser_parse_script */ 
31703173
31713174/* *
@@ -3177,10 +3180,12 @@ parser_parse_script (const char *source, /**< source script */
31773180bool 
31783181parser_parse_eval  (const  char  *source, /* *< string passed to eval() */ 
31793182                   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 */  
31803185                   const  opcode_t  **opcodes_p) /* *< out: generated byte-code array
31813186                                                *  (in case there were no syntax errors) */  
31823187{
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);
31843189} /*  parser_parse_eval */ 
31853190
31863191/* *
@@ -3206,7 +3211,12 @@ parser_parse_new_function (const char **params, /**< array of arguments of new F
32063211    FIXME  (" check parameter's name for syntax errors"  );
32073212    lit_find_or_create_literal_from_charset  ((ecma_char_t  *) params[i], (ecma_length_t ) strlen  (params[i]));
32083213  }
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);
32103220} /*  parser_parse_new_function */ 
32113221
32123222/* *
0 commit comments