summaryrefslogtreecommitdiff
path: root/deps/v8/src/parser.cc
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2013-03-06 12:57:49 -0800
committerisaacs <i@izs.me>2013-03-06 12:59:58 -0800
commit81c278d58d8154980d49b9c2713ec37f5017c2d3 (patch)
tree53ae9552fc3ef8ba6b7c9f92f136ec6c87aff44e /deps/v8/src/parser.cc
parentd258fb0212530329b9941be18bc6e90d7afec5b5 (diff)
downloadnode-new-81c278d58d8154980d49b9c2713ec37f5017c2d3.tar.gz
V8: Upgrade to 3.14.5.8
Diffstat (limited to 'deps/v8/src/parser.cc')
-rw-r--r--deps/v8/src/parser.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/deps/v8/src/parser.cc b/deps/v8/src/parser.cc
index 129bd95466..03e4b039cc 100644
--- a/deps/v8/src/parser.cc
+++ b/deps/v8/src/parser.cc
@@ -614,11 +614,6 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
ASSERT(target_stack_ == NULL);
if (pre_data_ != NULL) pre_data_->Initialize();
- // Compute the parsing mode.
- Mode mode = (FLAG_lazy && allow_lazy_) ? PARSE_LAZILY : PARSE_EAGERLY;
- if (allow_natives_syntax_ || extension_ != NULL) mode = PARSE_EAGERLY;
- ParsingModeScope parsing_mode(this, mode);
-
Handle<String> no_name = isolate()->factory()->empty_symbol();
FunctionLiteral* result = NULL;
@@ -637,6 +632,13 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
scope->set_start_position(0);
scope->set_end_position(source->length());
+ // Compute the parsing mode.
+ Mode mode = (FLAG_lazy && allow_lazy_) ? PARSE_LAZILY : PARSE_EAGERLY;
+ if (allow_natives_syntax_ || extension_ != NULL || scope->is_eval_scope()) {
+ mode = PARSE_EAGERLY;
+ }
+ ParsingModeScope parsing_mode(this, mode);
+
FunctionState function_state(this, scope, isolate()); // Enters 'scope'.
top_scope_->SetLanguageMode(info->language_mode());
ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone());
@@ -1059,12 +1061,14 @@ void* Parser::ParseSourceElements(ZoneList<Statement*>* processor,
// as specified in ES5 10.4.2(3). The correct fix would be to always
// add this scope in DoParseProgram(), but that requires adaptations
// all over the code base, so we go with a quick-fix for now.
+ // In the same manner, we have to patch the parsing mode.
if (is_eval && !top_scope_->is_eval_scope()) {
ASSERT(top_scope_->is_global_scope());
Scope* scope = NewScope(top_scope_, EVAL_SCOPE);
scope->set_start_position(top_scope_->start_position());
scope->set_end_position(top_scope_->end_position());
top_scope_ = scope;
+ mode_ = PARSE_EAGERLY;
}
// TODO(ES6): Fix entering extended mode, once it is specified.
top_scope_->SetLanguageMode(FLAG_harmony_scoping