| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 DCHECK_NULL(target_stack_); | 784 DCHECK_NULL(target_stack_); |
| 785 | 785 |
| 786 Mode parsing_mode = allow_lazy() ? PARSE_LAZILY : PARSE_EAGERLY; | 786 Mode parsing_mode = allow_lazy() ? PARSE_LAZILY : PARSE_EAGERLY; |
| 787 | 787 |
| 788 FunctionLiteral* result = NULL; | 788 FunctionLiteral* result = NULL; |
| 789 { | 789 { |
| 790 Scope* outer = original_scope_; | 790 Scope* outer = original_scope_; |
| 791 DCHECK_NOT_NULL(outer); | 791 DCHECK_NOT_NULL(outer); |
| 792 parsing_module_ = info->is_module(); | 792 parsing_module_ = info->is_module(); |
| 793 if (info->is_eval()) { | 793 if (info->is_eval()) { |
| 794 if (!outer->is_script_scope() || is_strict(info->language_mode())) { | |
| 795 parsing_mode = PARSE_EAGERLY; | |
| 796 } | |
| 797 outer = NewEvalScope(outer); | 794 outer = NewEvalScope(outer); |
| 798 } else if (parsing_module_) { | 795 } else if (parsing_module_) { |
| 799 DCHECK_EQ(outer, info->script_scope()); | 796 DCHECK_EQ(outer, info->script_scope()); |
| 800 outer = NewModuleScope(info->script_scope()); | 797 outer = NewModuleScope(info->script_scope()); |
| 801 // Never do lazy parsing in modules. If we want to support this in the | 798 // Never do lazy parsing in modules. If we want to support this in the |
| 802 // future, we must force context-allocation for all variables that are | 799 // future, we must force context-allocation for all variables that are |
| 803 // declared at the module level but not MODULE-allocated. | 800 // declared at the module level but not MODULE-allocated. |
| 804 parsing_mode = PARSE_EAGERLY; | 801 parsing_mode = PARSE_EAGERLY; |
| 805 } | 802 } |
| 806 | 803 |
| (...skipping 4648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5455 | 5452 |
| 5456 return final_loop; | 5453 return final_loop; |
| 5457 } | 5454 } |
| 5458 | 5455 |
| 5459 #undef CHECK_OK | 5456 #undef CHECK_OK |
| 5460 #undef CHECK_OK_VOID | 5457 #undef CHECK_OK_VOID |
| 5461 #undef CHECK_FAILED | 5458 #undef CHECK_FAILED |
| 5462 | 5459 |
| 5463 } // namespace internal | 5460 } // namespace internal |
| 5464 } // namespace v8 | 5461 } // namespace v8 |
| OLD | NEW |