Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: src/preparser.cc

Issue 1308123007: [es6] conditionally ignore TDZ semantics for formals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 FunctionLiteral::ArityRestriction arity_restriction, 96 FunctionLiteral::ArityRestriction arity_restriction,
97 LanguageMode language_mode, bool* ok) { 97 LanguageMode language_mode, bool* ok) {
98 return pre_parser_->ParseFunctionLiteral( 98 return pre_parser_->ParseFunctionLiteral(
99 name, function_name_location, function_name_validity, kind, 99 name, function_name_location, function_name_validity, kind,
100 function_token_position, type, arity_restriction, language_mode, ok); 100 function_token_position, type, arity_restriction, language_mode, ok);
101 } 101 }
102 102
103 103
104 PreParser::PreParseResult PreParser::PreParseLazyFunction( 104 PreParser::PreParseResult PreParser::PreParseLazyFunction(
105 LanguageMode language_mode, FunctionKind kind, bool has_simple_parameters, 105 LanguageMode language_mode, FunctionKind kind, bool has_simple_parameters,
106 ParserRecorder* log, Scanner::BookmarkScope* bookmark) { 106 bool has_parameter_expressions, ParserRecorder* log,
107 Scanner::BookmarkScope* bookmark) {
107 log_ = log; 108 log_ = log;
108 // Lazy functions always have trivial outer scopes (no with/catch scopes). 109 // Lazy functions always have trivial outer scopes (no with/catch scopes).
109 Scope* top_scope = NewScope(scope_, SCRIPT_SCOPE); 110 Scope* top_scope = NewScope(scope_, SCRIPT_SCOPE);
110 PreParserFactory top_factory(NULL); 111 PreParserFactory top_factory(NULL);
111 FunctionState top_state(&function_state_, &scope_, top_scope, kNormalFunction, 112 FunctionState top_state(&function_state_, &scope_, top_scope, kNormalFunction,
112 &top_factory); 113 &top_factory);
113 scope_->SetLanguageMode(language_mode); 114 scope_->SetLanguageMode(language_mode);
114 Scope* function_scope = NewScope( 115 Scope* function_scope = NewScope(
115 scope_, IsArrowFunction(kind) ? ARROW_SCOPE : FUNCTION_SCOPE, kind); 116 scope_, IsArrowFunction(kind) ? ARROW_SCOPE : FUNCTION_SCOPE, kind);
116 if (!has_simple_parameters) function_scope->SetHasNonSimpleParameters(); 117 if (!has_simple_parameters) function_scope->SetHasNonSimpleParameters();
118 if (has_parameter_expressions) function_scope->SetHasParameterExpressions();
117 PreParserFactory function_factory(NULL); 119 PreParserFactory function_factory(NULL);
118 FunctionState function_state(&function_state_, &scope_, function_scope, kind, 120 FunctionState function_state(&function_state_, &scope_, function_scope, kind,
119 &function_factory); 121 &function_factory);
120 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); 122 DCHECK_EQ(Token::LBRACE, scanner()->current_token());
121 bool ok = true; 123 bool ok = true;
122 int start_position = peek_position(); 124 int start_position = peek_position();
123 ParseLazyFunctionLiteralBody(&ok, bookmark); 125 ParseLazyFunctionLiteralBody(&ok, bookmark);
124 if (bookmark && bookmark->HasBeenReset()) { 126 if (bookmark && bookmark->HasBeenReset()) {
125 ; // Do nothing, as we've just aborted scanning this function. 127 ; // Do nothing, as we've just aborted scanning this function.
126 } else if (stack_overflow()) { 128 } else if (stack_overflow()) {
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1233
1232 DCHECK(!spread_pos.IsValid()); 1234 DCHECK(!spread_pos.IsValid());
1233 1235
1234 return Expression::Default(); 1236 return Expression::Default();
1235 } 1237 }
1236 1238
1237 #undef CHECK_OK 1239 #undef CHECK_OK
1238 1240
1239 1241
1240 } } // v8::internal 1242 } } // v8::internal
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/scopes.h » ('j') | test/mjsunit/harmony/destructuring.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698