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

Side by Side Diff: src/parser.cc

Issue 1189743003: [destructuring] Implement parameter pattern matching. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix magic number issue Created 5 years, 6 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
« no previous file with comments | « src/parser.h ('k') | src/pattern-rewriter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 ? FunctionLiteral::ANONYMOUS_EXPRESSION 1175 ? FunctionLiteral::ANONYMOUS_EXPRESSION
1176 : FunctionLiteral::NAMED_EXPRESSION) 1176 : FunctionLiteral::NAMED_EXPRESSION)
1177 : FunctionLiteral::DECLARATION; 1177 : FunctionLiteral::DECLARATION;
1178 bool ok = true; 1178 bool ok = true;
1179 1179
1180 if (shared_info->is_arrow()) { 1180 if (shared_info->is_arrow()) {
1181 Scope* scope = 1181 Scope* scope =
1182 NewScope(scope_, ARROW_SCOPE, FunctionKind::kArrowFunction); 1182 NewScope(scope_, ARROW_SCOPE, FunctionKind::kArrowFunction);
1183 scope->set_start_position(shared_info->start_position()); 1183 scope->set_start_position(shared_info->start_position());
1184 ExpressionClassifier formals_classifier; 1184 ExpressionClassifier formals_classifier;
1185 bool has_rest = false; 1185 ParserFormalParameterParsingState parsing_state(scope);
1186 { 1186 {
1187 // Parsing patterns as variable reference expression creates 1187 // Parsing patterns as variable reference expression creates
1188 // NewUnresolved references in current scope. Entrer arrow function 1188 // NewUnresolved references in current scope. Entrer arrow function
1189 // scope for formal parameter parsing. 1189 // scope for formal parameter parsing.
1190 BlockState block_state(&scope_, scope); 1190 BlockState block_state(&scope_, scope);
1191 if (Check(Token::LPAREN)) { 1191 if (Check(Token::LPAREN)) {
1192 // '(' StrictFormalParameters ')' 1192 // '(' StrictFormalParameters ')'
1193 ParseFormalParameterList(scope, &has_rest, &formals_classifier, &ok); 1193 ParseFormalParameterList(&parsing_state, &formals_classifier, &ok);
1194 if (ok) ok = Check(Token::RPAREN); 1194 if (ok) ok = Check(Token::RPAREN);
1195 } else { 1195 } else {
1196 // BindingIdentifier 1196 // BindingIdentifier
1197 ParseFormalParameter(scope, has_rest, &formals_classifier, &ok); 1197 const bool is_rest = false;
1198 ParseFormalParameter(is_rest, &parsing_state, &formals_classifier,
1199 &ok);
1198 } 1200 }
1199 } 1201 }
1200 1202
1201 if (ok) { 1203 if (ok) {
1202 Expression* expression = 1204 Expression* expression =
1203 ParseArrowFunctionLiteral(scope, has_rest, formals_classifier, &ok); 1205 ParseArrowFunctionLiteral(parsing_state, formals_classifier, &ok);
1204 if (ok) { 1206 if (ok) {
1205 // Scanning must end at the same position that was recorded 1207 // Scanning must end at the same position that was recorded
1206 // previously. If not, parsing has been interrupted due to a stack 1208 // previously. If not, parsing has been interrupted due to a stack
1207 // overflow, at which point the partially parsed arrow function 1209 // overflow, at which point the partially parsed arrow function
1208 // concise body happens to be a valid expression. This is a problem 1210 // concise body happens to be a valid expression. This is a problem
1209 // only for arrow functions with single expression bodies, since there 1211 // only for arrow functions with single expression bodies, since there
1210 // is no end token such as "}" for normal functions. 1212 // is no end token such as "}" for normal functions.
1211 if (scanner()->location().end_pos == shared_info->end_position()) { 1213 if (scanner()->location().end_pos == shared_info->end_position()) {
1212 // The pre-parser saw an arrow function here, so the full parser 1214 // The pre-parser saw an arrow function here, so the full parser
1213 // must produce a FunctionLiteral. 1215 // must produce a FunctionLiteral.
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 ReportMessage(MessageTemplate::kStrictEvalArguments); 1542 ReportMessage(MessageTemplate::kStrictEvalArguments);
1541 return NULL; 1543 return NULL;
1542 } else if (is_strong(language_mode()) && IsUndefined(local_name)) { 1544 } else if (is_strong(language_mode()) && IsUndefined(local_name)) {
1543 *ok = false; 1545 *ok = false;
1544 ReportMessage(MessageTemplate::kStrongUndefined); 1546 ReportMessage(MessageTemplate::kStrongUndefined);
1545 return NULL; 1547 return NULL;
1546 } 1548 }
1547 VariableProxy* proxy = NewUnresolved(local_name, IMPORT); 1549 VariableProxy* proxy = NewUnresolved(local_name, IMPORT);
1548 ImportDeclaration* declaration = 1550 ImportDeclaration* declaration =
1549 factory()->NewImportDeclaration(proxy, import_name, NULL, scope_, pos); 1551 factory()->NewImportDeclaration(proxy, import_name, NULL, scope_, pos);
1550 Declare(declaration, true, CHECK_OK); 1552 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
1551 result->Add(declaration, zone()); 1553 result->Add(declaration, zone());
1552 if (peek() == Token::RBRACE) break; 1554 if (peek() == Token::RBRACE) break;
1553 Expect(Token::COMMA, CHECK_OK); 1555 Expect(Token::COMMA, CHECK_OK);
1554 } 1556 }
1555 1557
1556 Expect(Token::RBRACE, CHECK_OK); 1558 Expect(Token::RBRACE, CHECK_OK);
1557 1559
1558 return result; 1560 return result;
1559 } 1561 }
1560 1562
(...skipping 27 matching lines...) Expand all
1588 } 1590 }
1589 1591
1590 // Parse ImportedDefaultBinding if present. 1592 // Parse ImportedDefaultBinding if present.
1591 ImportDeclaration* import_default_declaration = NULL; 1593 ImportDeclaration* import_default_declaration = NULL;
1592 if (tok != Token::MUL && tok != Token::LBRACE) { 1594 if (tok != Token::MUL && tok != Token::LBRACE) {
1593 const AstRawString* local_name = 1595 const AstRawString* local_name =
1594 ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK); 1596 ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK);
1595 VariableProxy* proxy = NewUnresolved(local_name, IMPORT); 1597 VariableProxy* proxy = NewUnresolved(local_name, IMPORT);
1596 import_default_declaration = factory()->NewImportDeclaration( 1598 import_default_declaration = factory()->NewImportDeclaration(
1597 proxy, ast_value_factory()->default_string(), NULL, scope_, pos); 1599 proxy, ast_value_factory()->default_string(), NULL, scope_, pos);
1598 Declare(import_default_declaration, true, CHECK_OK); 1600 Declare(import_default_declaration, DeclarationDescriptor::NORMAL, true,
1601 CHECK_OK);
1599 } 1602 }
1600 1603
1601 const AstRawString* module_instance_binding = NULL; 1604 const AstRawString* module_instance_binding = NULL;
1602 ZoneList<ImportDeclaration*>* named_declarations = NULL; 1605 ZoneList<ImportDeclaration*>* named_declarations = NULL;
1603 if (import_default_declaration == NULL || Check(Token::COMMA)) { 1606 if (import_default_declaration == NULL || Check(Token::COMMA)) {
1604 switch (peek()) { 1607 switch (peek()) {
1605 case Token::MUL: { 1608 case Token::MUL: {
1606 Consume(Token::MUL); 1609 Consume(Token::MUL);
1607 ExpectContextualKeyword(CStrVector("as"), CHECK_OK); 1610 ExpectContextualKeyword(CStrVector("as"), CHECK_OK);
1608 module_instance_binding = 1611 module_instance_binding =
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 // truly local variable, and the scope of the variable is always the function 1978 // truly local variable, and the scope of the variable is always the function
1976 // scope. 1979 // scope.
1977 // Let/const variables in harmony mode are always added to the immediately 1980 // Let/const variables in harmony mode are always added to the immediately
1978 // enclosing scope. 1981 // enclosing scope.
1979 return DeclarationScope(mode)->NewUnresolved( 1982 return DeclarationScope(mode)->NewUnresolved(
1980 factory(), name, Variable::NORMAL, scanner()->location().beg_pos, 1983 factory(), name, Variable::NORMAL, scanner()->location().beg_pos,
1981 scanner()->location().end_pos); 1984 scanner()->location().end_pos);
1982 } 1985 }
1983 1986
1984 1987
1985 Variable* Parser::Declare(Declaration* declaration, bool resolve, bool* ok) { 1988 Variable* Parser::Declare(Declaration* declaration,
1989 DeclarationDescriptor::Kind declaration_kind,
1990 bool resolve, bool* ok) {
1986 VariableProxy* proxy = declaration->proxy(); 1991 VariableProxy* proxy = declaration->proxy();
1987 DCHECK(proxy->raw_name() != NULL); 1992 DCHECK(proxy->raw_name() != NULL);
1988 const AstRawString* name = proxy->raw_name(); 1993 const AstRawString* name = proxy->raw_name();
1989 VariableMode mode = declaration->mode(); 1994 VariableMode mode = declaration->mode();
1990 Scope* declaration_scope = DeclarationScope(mode); 1995 Scope* declaration_scope = DeclarationScope(mode);
1991 Variable* var = NULL; 1996 Variable* var = NULL;
1992 1997
1993 // If a suitable scope exists, then we can statically declare this 1998 // If a suitable scope exists, then we can statically declare this
1994 // variable and also set its mode. In any case, a Declaration node 1999 // variable and also set its mode. In any case, a Declaration node
1995 // will be added to the scope so that the declaration can be added 2000 // will be added to the scope so that the declaration can be added
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 // the special case 2039 // the special case
2035 // 2040 //
2036 // function () { let x; { var x; } } 2041 // function () { let x; { var x; } }
2037 // 2042 //
2038 // because the var declaration is hoisted to the function scope where 'x' 2043 // because the var declaration is hoisted to the function scope where 'x'
2039 // is already bound. 2044 // is already bound.
2040 DCHECK(IsDeclaredVariableMode(var->mode())); 2045 DCHECK(IsDeclaredVariableMode(var->mode()));
2041 if (is_strict(language_mode())) { 2046 if (is_strict(language_mode())) {
2042 // In harmony we treat re-declarations as early errors. See 2047 // In harmony we treat re-declarations as early errors. See
2043 // ES5 16 for a definition of early errors. 2048 // ES5 16 for a definition of early errors.
2044 ParserTraits::ReportMessage(MessageTemplate::kVarRedeclaration, name); 2049 if (declaration_kind == DeclarationDescriptor::NORMAL) {
2050 ParserTraits::ReportMessage(MessageTemplate::kVarRedeclaration, name);
2051 } else {
2052 ParserTraits::ReportMessage(MessageTemplate::kStrictParamDupe);
2053 }
2045 *ok = false; 2054 *ok = false;
2046 return nullptr; 2055 return nullptr;
2047 } 2056 }
2048 Expression* expression = NewThrowTypeError( 2057 Expression* expression = NewThrowSyntaxError(
2049 MessageTemplate::kVarRedeclaration, name, declaration->position()); 2058 MessageTemplate::kVarRedeclaration, name, declaration->position());
2050 declaration_scope->SetIllegalRedeclaration(expression); 2059 declaration_scope->SetIllegalRedeclaration(expression);
2051 } else if (mode == VAR) { 2060 } else if (mode == VAR) {
2052 var->set_maybe_assigned(); 2061 var->set_maybe_assigned();
2053 } 2062 }
2054 } 2063 }
2055 2064
2056 // We add a declaration node for every declaration. The compiler 2065 // We add a declaration node for every declaration. The compiler
2057 // will only generate code if necessary. In particular, declarations 2066 // will only generate code if necessary. In particular, declarations
2058 // for inner local variables that do not represent functions won't 2067 // for inner local variables that do not represent functions won't
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 // accessible while parsing the first time not when reparsing 2157 // accessible while parsing the first time not when reparsing
2149 // because of lazy compilation. 2158 // because of lazy compilation.
2150 DeclarationScope(VAR)->ForceEagerCompilation(); 2159 DeclarationScope(VAR)->ForceEagerCompilation();
2151 2160
2152 // TODO(1240846): It's weird that native function declarations are 2161 // TODO(1240846): It's weird that native function declarations are
2153 // introduced dynamically when we meet their declarations, whereas 2162 // introduced dynamically when we meet their declarations, whereas
2154 // other functions are set up when entering the surrounding scope. 2163 // other functions are set up when entering the surrounding scope.
2155 VariableProxy* proxy = NewUnresolved(name, VAR); 2164 VariableProxy* proxy = NewUnresolved(name, VAR);
2156 Declaration* declaration = 2165 Declaration* declaration =
2157 factory()->NewVariableDeclaration(proxy, VAR, scope_, pos); 2166 factory()->NewVariableDeclaration(proxy, VAR, scope_, pos);
2158 Declare(declaration, true, CHECK_OK); 2167 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
2159 NativeFunctionLiteral* lit = factory()->NewNativeFunctionLiteral( 2168 NativeFunctionLiteral* lit = factory()->NewNativeFunctionLiteral(
2160 name, extension_, RelocInfo::kNoPosition); 2169 name, extension_, RelocInfo::kNoPosition);
2161 return factory()->NewExpressionStatement( 2170 return factory()->NewExpressionStatement(
2162 factory()->NewAssignment( 2171 factory()->NewAssignment(
2163 Token::INIT_VAR, proxy, lit, RelocInfo::kNoPosition), 2172 Token::INIT_VAR, proxy, lit, RelocInfo::kNoPosition),
2164 pos); 2173 pos);
2165 } 2174 }
2166 2175
2167 2176
2168 Statement* Parser::ParseFunctionDeclaration( 2177 Statement* Parser::ParseFunctionDeclaration(
(...skipping 24 matching lines...) Expand all
2193 is_strong(language_mode()) 2202 is_strong(language_mode())
2194 ? CONST 2203 ? CONST
2195 : is_strict(language_mode()) && 2204 : is_strict(language_mode()) &&
2196 !(scope_->is_script_scope() || scope_->is_eval_scope() || 2205 !(scope_->is_script_scope() || scope_->is_eval_scope() ||
2197 scope_->is_function_scope()) 2206 scope_->is_function_scope())
2198 ? LET 2207 ? LET
2199 : VAR; 2208 : VAR;
2200 VariableProxy* proxy = NewUnresolved(name, mode); 2209 VariableProxy* proxy = NewUnresolved(name, mode);
2201 Declaration* declaration = 2210 Declaration* declaration =
2202 factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos); 2211 factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos);
2203 Declare(declaration, true, CHECK_OK); 2212 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
2204 if (names) names->Add(name, zone()); 2213 if (names) names->Add(name, zone());
2205 return factory()->NewEmptyStatement(RelocInfo::kNoPosition); 2214 return factory()->NewEmptyStatement(RelocInfo::kNoPosition);
2206 } 2215 }
2207 2216
2208 2217
2209 Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names, 2218 Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names,
2210 bool* ok) { 2219 bool* ok) {
2211 // ClassDeclaration :: 2220 // ClassDeclaration ::
2212 // 'class' Identifier ('extends' LeftHandExpression)? '{' ClassBody '}' 2221 // 'class' Identifier ('extends' LeftHandExpression)? '{' ClassBody '}'
2213 // 2222 //
(...skipping 20 matching lines...) Expand all
2234 ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK); 2243 ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK);
2235 ClassLiteral* value = ParseClassLiteral(name, scanner()->location(), 2244 ClassLiteral* value = ParseClassLiteral(name, scanner()->location(),
2236 is_strict_reserved, pos, CHECK_OK); 2245 is_strict_reserved, pos, CHECK_OK);
2237 2246
2238 VariableMode mode = is_strong(language_mode()) ? CONST : LET; 2247 VariableMode mode = is_strong(language_mode()) ? CONST : LET;
2239 VariableProxy* proxy = NewUnresolved(name, mode); 2248 VariableProxy* proxy = NewUnresolved(name, mode);
2240 const bool is_class_declaration = true; 2249 const bool is_class_declaration = true;
2241 Declaration* declaration = factory()->NewVariableDeclaration( 2250 Declaration* declaration = factory()->NewVariableDeclaration(
2242 proxy, mode, scope_, pos, is_class_declaration, 2251 proxy, mode, scope_, pos, is_class_declaration,
2243 scope_->class_declaration_group_start()); 2252 scope_->class_declaration_group_start());
2244 Variable* outer_class_variable = Declare(declaration, true, CHECK_OK); 2253 Variable* outer_class_variable =
2254 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
2245 proxy->var()->set_initializer_position(position()); 2255 proxy->var()->set_initializer_position(position());
2246 // This is needed because a class ("class Name { }") creates two bindings (one 2256 // This is needed because a class ("class Name { }") creates two bindings (one
2247 // in the outer scope, and one in the class scope). The method is a function 2257 // in the outer scope, and one in the class scope). The method is a function
2248 // scope inside the inner scope (class scope). The consecutive class 2258 // scope inside the inner scope (class scope). The consecutive class
2249 // declarations are in the outer scope. 2259 // declarations are in the outer scope.
2250 if (value->class_variable_proxy() && value->class_variable_proxy()->var() && 2260 if (value->class_variable_proxy() && value->class_variable_proxy()->var() &&
2251 outer_class_variable->is_class()) { 2261 outer_class_variable->is_class()) {
2252 // In some cases, the outer variable is not detected as a class variable; 2262 // In some cases, the outer variable is not detected as a class variable;
2253 // this happens e.g., for lazy methods. They are excluded from strong mode 2263 // this happens e.g., for lazy methods. They are excluded from strong mode
2254 // checks for now. TODO(marja, rossberg): re-create variables with the 2264 // checks for now. TODO(marja, rossberg): re-create variables with the
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 // ConstDeclaration :: 2400 // ConstDeclaration ::
2391 // const ConstBinding (',' ConstBinding)* ';' 2401 // const ConstBinding (',' ConstBinding)* ';'
2392 // ConstBinding :: 2402 // ConstBinding ::
2393 // Identifier '=' AssignmentExpression 2403 // Identifier '=' AssignmentExpression
2394 // 2404 //
2395 // TODO(ES6): 2405 // TODO(ES6):
2396 // ConstBinding :: 2406 // ConstBinding ::
2397 // BindingPattern '=' AssignmentExpression 2407 // BindingPattern '=' AssignmentExpression
2398 2408
2399 parsing_result->descriptor.parser = this; 2409 parsing_result->descriptor.parser = this;
2410 parsing_result->descriptor.declaration_kind = DeclarationDescriptor::NORMAL;
2400 parsing_result->descriptor.declaration_pos = peek_position(); 2411 parsing_result->descriptor.declaration_pos = peek_position();
2401 parsing_result->descriptor.initialization_pos = peek_position(); 2412 parsing_result->descriptor.initialization_pos = peek_position();
2402 parsing_result->descriptor.mode = VAR; 2413 parsing_result->descriptor.mode = VAR;
2403 // True if the binding needs initialization. 'let' and 'const' declared 2414 // True if the binding needs initialization. 'let' and 'const' declared
2404 // bindings are created uninitialized by their declaration nodes and 2415 // bindings are created uninitialized by their declaration nodes and
2405 // need initialization. 'var' declared bindings are always initialized 2416 // need initialization. 'var' declared bindings are always initialized
2406 // immediately by their declaration nodes. 2417 // immediately by their declaration nodes.
2407 parsing_result->descriptor.needs_init = false; 2418 parsing_result->descriptor.needs_init = false;
2408 parsing_result->descriptor.is_const = false; 2419 parsing_result->descriptor.is_const = false;
2409 parsing_result->descriptor.init_op = Token::INIT_VAR; 2420 parsing_result->descriptor.init_op = Token::INIT_VAR;
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
3321 Block* ignore_completion_block = factory()->NewBlock( 3332 Block* ignore_completion_block = factory()->NewBlock(
3322 NULL, names->length() + 2, true, RelocInfo::kNoPosition); 3333 NULL, names->length() + 2, true, RelocInfo::kNoPosition);
3323 ZoneList<Variable*> inner_vars(names->length(), zone()); 3334 ZoneList<Variable*> inner_vars(names->length(), zone());
3324 // For each let variable x: 3335 // For each let variable x:
3325 // make statement: let/const x = temp_x. 3336 // make statement: let/const x = temp_x.
3326 VariableMode mode = is_const ? CONST : LET; 3337 VariableMode mode = is_const ? CONST : LET;
3327 for (int i = 0; i < names->length(); i++) { 3338 for (int i = 0; i < names->length(); i++) {
3328 VariableProxy* proxy = NewUnresolved(names->at(i), mode); 3339 VariableProxy* proxy = NewUnresolved(names->at(i), mode);
3329 Declaration* declaration = factory()->NewVariableDeclaration( 3340 Declaration* declaration = factory()->NewVariableDeclaration(
3330 proxy, mode, scope_, RelocInfo::kNoPosition); 3341 proxy, mode, scope_, RelocInfo::kNoPosition);
3331 Declare(declaration, true, CHECK_OK); 3342 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
3332 inner_vars.Add(declaration->proxy()->var(), zone()); 3343 inner_vars.Add(declaration->proxy()->var(), zone());
3333 VariableProxy* temp_proxy = factory()->NewVariableProxy(temps.at(i)); 3344 VariableProxy* temp_proxy = factory()->NewVariableProxy(temps.at(i));
3334 Assignment* assignment = 3345 Assignment* assignment =
3335 factory()->NewAssignment(is_const ? Token::INIT_CONST : Token::INIT_LET, 3346 factory()->NewAssignment(is_const ? Token::INIT_CONST : Token::INIT_LET,
3336 proxy, temp_proxy, RelocInfo::kNoPosition); 3347 proxy, temp_proxy, RelocInfo::kNoPosition);
3337 Statement* assignment_statement = 3348 Statement* assignment_statement =
3338 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition); 3349 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition);
3339 DCHECK(init->position() != RelocInfo::kNoPosition); 3350 DCHECK(init->position() != RelocInfo::kNoPosition);
3340 proxy->var()->set_initializer_position(init->position()); 3351 proxy->var()->set_initializer_position(init->position());
3341 ignore_completion_block->AddStatement(assignment_statement, zone()); 3352 ignore_completion_block->AddStatement(assignment_statement, zone());
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
3777 return static_cast<LiteralType>(literal_type->value()); 3788 return static_cast<LiteralType>(literal_type->value());
3778 } 3789 }
3779 3790
3780 3791
3781 Handle<FixedArray> CompileTimeValue::GetElements(Handle<FixedArray> value) { 3792 Handle<FixedArray> CompileTimeValue::GetElements(Handle<FixedArray> value) {
3782 return Handle<FixedArray>(FixedArray::cast(value->get(kElementsSlot))); 3793 return Handle<FixedArray>(FixedArray::cast(value->get(kElementsSlot)));
3783 } 3794 }
3784 3795
3785 3796
3786 void ParserTraits::ParseArrowFunctionFormalParameters( 3797 void ParserTraits::ParseArrowFunctionFormalParameters(
3787 Scope* scope, Expression* expr, const Scanner::Location& params_loc, 3798 ParserFormalParameterParsingState* parsing_state, Expression* expr,
3788 bool* has_rest, Scanner::Location* duplicate_loc, bool* ok) { 3799 const Scanner::Location& params_loc, Scanner::Location* duplicate_loc,
3789 if (scope->num_parameters() >= Code::kMaxArguments) { 3800 bool* ok) {
3801 if (parsing_state->scope->num_parameters() >= Code::kMaxArguments) {
3790 ReportMessageAt(params_loc, MessageTemplate::kMalformedArrowFunParamList); 3802 ReportMessageAt(params_loc, MessageTemplate::kMalformedArrowFunParamList);
3791 *ok = false; 3803 *ok = false;
3792 return; 3804 return;
3793 } 3805 }
3794 3806
3795 // ArrowFunctionFormals :: 3807 // ArrowFunctionFormals ::
3796 // Binary(Token::COMMA, NonTailArrowFunctionFormals, Tail) 3808 // Binary(Token::COMMA, NonTailArrowFunctionFormals, Tail)
3797 // Tail 3809 // Tail
3798 // NonTailArrowFunctionFormals :: 3810 // NonTailArrowFunctionFormals ::
3799 // Binary(Token::COMMA, NonTailArrowFunctionFormals, VariableProxy) 3811 // Binary(Token::COMMA, NonTailArrowFunctionFormals, VariableProxy)
3800 // VariableProxy 3812 // VariableProxy
3801 // Tail :: 3813 // Tail ::
3802 // VariableProxy 3814 // VariableProxy
3803 // Spread(VariableProxy) 3815 // Spread(VariableProxy)
3804 // 3816 //
3805 // As we need to visit the parameters in left-to-right order, we recurse on 3817 // As we need to visit the parameters in left-to-right order, we recurse on
3806 // the left-hand side of comma expressions. 3818 // the left-hand side of comma expressions.
3807 // 3819 //
3808 if (expr->IsBinaryOperation()) { 3820 if (expr->IsBinaryOperation()) {
3809 BinaryOperation* binop = expr->AsBinaryOperation(); 3821 BinaryOperation* binop = expr->AsBinaryOperation();
3810 // The classifier has already run, so we know that the expression is a valid 3822 // The classifier has already run, so we know that the expression is a valid
3811 // arrow function formals production. 3823 // arrow function formals production.
3812 DCHECK_EQ(binop->op(), Token::COMMA); 3824 DCHECK_EQ(binop->op(), Token::COMMA);
3813 Expression* left = binop->left(); 3825 Expression* left = binop->left();
3814 Expression* right = binop->right(); 3826 Expression* right = binop->right();
3815 ParseArrowFunctionFormalParameters(scope, left, params_loc, has_rest, 3827 ParseArrowFunctionFormalParameters(parsing_state, left, params_loc,
3816 duplicate_loc, ok); 3828 duplicate_loc, ok);
3817 if (!*ok) return; 3829 if (!*ok) return;
3818 // LHS of comma expression should be unparenthesized. 3830 // LHS of comma expression should be unparenthesized.
3819 expr = right; 3831 expr = right;
3820 } 3832 }
3821 3833
3822 // Only the right-most expression may be a rest parameter. 3834 // Only the right-most expression may be a rest parameter.
3823 DCHECK(!*has_rest); 3835 DCHECK(!parsing_state->has_rest);
3824 3836
3837 bool is_rest = false;
3825 if (expr->IsSpread()) { 3838 if (expr->IsSpread()) {
3826 *has_rest = true; 3839 is_rest = true;
3827 expr = expr->AsSpread()->expression(); 3840 expr = expr->AsSpread()->expression();
3828 } 3841 }
3829 3842
3830 if (!expr->IsVariableProxy()) { 3843 if (expr->IsVariableProxy()) {
3831 // TODO(dslomov): support pattern desugaring 3844 // When the formal parameter was originally seen, it was parsed as a
3832 return; 3845 // VariableProxy and recorded as unresolved in the scope. Here we undo that
3846 // parse-time side-effect for parameters that are single-names (not
3847 // patterns; for patterns that happens uniformly in
3848 // PatternRewriter::VisitVariableProxy).
3849 parser_->scope_->RemoveUnresolved(expr->AsVariableProxy());
3833 } 3850 }
3834 DCHECK(!expr->AsVariableProxy()->is_this());
3835
3836 const AstRawString* raw_name = expr->AsVariableProxy()->raw_name();
3837 Scanner::Location param_location(expr->position(),
3838 expr->position() + raw_name->length());
3839
3840 // When the formal parameter was originally seen, it was parsed as a
3841 // VariableProxy and recorded as unresolved in the scope. Here we undo that
3842 // parse-time side-effect.
3843 parser_->scope_->RemoveUnresolved(expr->AsVariableProxy());
3844 3851
3845 ExpressionClassifier classifier; 3852 ExpressionClassifier classifier;
3846 DeclareFormalParameter(scope, expr, &classifier, *has_rest); 3853 DeclareFormalParameter(parsing_state, expr, &classifier, is_rest);
3847 if (!duplicate_loc->IsValid()) { 3854 if (!duplicate_loc->IsValid()) {
3848 *duplicate_loc = classifier.duplicate_formal_parameter_error().location; 3855 *duplicate_loc = classifier.duplicate_formal_parameter_error().location;
3849 } 3856 }
3850 } 3857 }
3851 3858
3852 3859
3853 FunctionLiteral* Parser::ParseFunctionLiteral( 3860 FunctionLiteral* Parser::ParseFunctionLiteral(
3854 const AstRawString* function_name, Scanner::Location function_name_location, 3861 const AstRawString* function_name, Scanner::Location function_name_location,
3855 bool name_is_strict_reserved, FunctionKind kind, int function_token_pos, 3862 bool name_is_strict_reserved, FunctionKind kind, int function_token_pos,
3856 FunctionLiteral::FunctionType function_type, 3863 FunctionLiteral::FunctionType function_type,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3911 Scope* original_declaration_scope = original_scope_->DeclarationScope(); 3918 Scope* original_declaration_scope = original_scope_->DeclarationScope();
3912 Scope* scope = function_type == FunctionLiteral::DECLARATION && 3919 Scope* scope = function_type == FunctionLiteral::DECLARATION &&
3913 is_sloppy(language_mode()) && 3920 is_sloppy(language_mode()) &&
3914 (original_scope_ == original_declaration_scope || 3921 (original_scope_ == original_declaration_scope ||
3915 declaration_scope != original_declaration_scope) 3922 declaration_scope != original_declaration_scope)
3916 ? NewScope(declaration_scope, FUNCTION_SCOPE, kind) 3923 ? NewScope(declaration_scope, FUNCTION_SCOPE, kind)
3917 : NewScope(scope_, FUNCTION_SCOPE, kind); 3924 : NewScope(scope_, FUNCTION_SCOPE, kind);
3918 ZoneList<Statement*>* body = NULL; 3925 ZoneList<Statement*>* body = NULL;
3919 int materialized_literal_count = -1; 3926 int materialized_literal_count = -1;
3920 int expected_property_count = -1; 3927 int expected_property_count = -1;
3921 ExpressionClassifier formals_classifier; 3928 DuplicateFinder duplicate_finder(scanner()->unicode_cache());
3929 ExpressionClassifier formals_classifier(&duplicate_finder);
3922 FunctionLiteral::EagerCompileHint eager_compile_hint = 3930 FunctionLiteral::EagerCompileHint eager_compile_hint =
3923 parenthesized_function_ ? FunctionLiteral::kShouldEagerCompile 3931 parenthesized_function_ ? FunctionLiteral::kShouldEagerCompile
3924 : FunctionLiteral::kShouldLazyCompile; 3932 : FunctionLiteral::kShouldLazyCompile;
3925 bool should_be_used_once_hint = false; 3933 bool should_be_used_once_hint = false;
3926 // Parse function body. 3934 // Parse function body.
3927 { 3935 {
3928 AstNodeFactory function_factory(ast_value_factory()); 3936 AstNodeFactory function_factory(ast_value_factory());
3929 FunctionState function_state(&function_state_, &scope_, scope, kind, 3937 FunctionState function_state(&function_state_, &scope_, scope, kind,
3930 &function_factory); 3938 &function_factory);
3931 scope_->SetScopeName(function_name); 3939 scope_->SetScopeName(function_name);
3932 3940
3933 if (is_generator) { 3941 if (is_generator) {
3934 // For generators, allocating variables in contexts is currently a win 3942 // For generators, allocating variables in contexts is currently a win
3935 // because it minimizes the work needed to suspend and resume an 3943 // because it minimizes the work needed to suspend and resume an
3936 // activation. 3944 // activation.
3937 scope_->ForceContextAllocation(); 3945 scope_->ForceContextAllocation();
3938 3946
3939 // Calling a generator returns a generator object. That object is stored 3947 // Calling a generator returns a generator object. That object is stored
3940 // in a temporary variable, a definition that is used by "yield" 3948 // in a temporary variable, a definition that is used by "yield"
3941 // expressions. This also marks the FunctionState as a generator. 3949 // expressions. This also marks the FunctionState as a generator.
3942 Variable* temp = scope_->DeclarationScope()->NewTemporary( 3950 Variable* temp = scope_->DeclarationScope()->NewTemporary(
3943 ast_value_factory()->dot_generator_object_string()); 3951 ast_value_factory()->dot_generator_object_string());
3944 function_state.set_generator_object_variable(temp); 3952 function_state.set_generator_object_variable(temp);
3945 } 3953 }
3946 3954
3947 bool has_rest = false;
3948 Expect(Token::LPAREN, CHECK_OK); 3955 Expect(Token::LPAREN, CHECK_OK);
3949 int start_position = scanner()->location().beg_pos; 3956 int start_position = scanner()->location().beg_pos;
3950 scope_->set_start_position(start_position); 3957 scope_->set_start_position(start_position);
3951 num_parameters = ParseFormalParameterList(scope, &has_rest, 3958 ParserFormalParameterParsingState parsing_state(scope);
3952 &formals_classifier, CHECK_OK); 3959 num_parameters =
3960 ParseFormalParameterList(&parsing_state, &formals_classifier, CHECK_OK);
3953 Expect(Token::RPAREN, CHECK_OK); 3961 Expect(Token::RPAREN, CHECK_OK);
3954 int formals_end_position = scanner()->location().end_pos; 3962 int formals_end_position = scanner()->location().end_pos;
3955 3963
3956 CheckArityRestrictions(num_parameters, arity_restriction, has_rest, 3964 CheckArityRestrictions(num_parameters, arity_restriction,
3957 start_position, formals_end_position, CHECK_OK); 3965 parsing_state.has_rest, start_position,
3958 3966 formals_end_position, CHECK_OK);
3959 Expect(Token::LBRACE, CHECK_OK); 3967 Expect(Token::LBRACE, CHECK_OK);
3960 3968
3961 // If we have a named function expression, we add a local variable 3969 // If we have a named function expression, we add a local variable
3962 // declaration to the body of the function with the name of the 3970 // declaration to the body of the function with the name of the
3963 // function and let it refer to the function itself (closure). 3971 // function and let it refer to the function itself (closure).
3964 // NOTE: We create a proxy and resolve it here so that in the 3972 // NOTE: We create a proxy and resolve it here so that in the
3965 // future we can change the AST to only refer to VariableProxies 3973 // future we can change the AST to only refer to VariableProxies
3966 // instead of Variables and Proxis as is the case now. 3974 // instead of Variables and Proxis as is the case now.
3967 Variable* fvar = NULL; 3975 Variable* fvar = NULL;
3968 Token::Value fvar_init_op = Token::INIT_CONST_LEGACY; 3976 Token::Value fvar_init_op = Token::INIT_CONST_LEGACY;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
4043 is_lazily_parsed = false; 4051 is_lazily_parsed = false;
4044 4052
4045 // This is probably an initialization function. Inform the compiler it 4053 // This is probably an initialization function. Inform the compiler it
4046 // should also eager-compile this function, and that we expect it to be 4054 // should also eager-compile this function, and that we expect it to be
4047 // used once. 4055 // used once.
4048 eager_compile_hint = FunctionLiteral::kShouldEagerCompile; 4056 eager_compile_hint = FunctionLiteral::kShouldEagerCompile;
4049 should_be_used_once_hint = true; 4057 should_be_used_once_hint = true;
4050 } 4058 }
4051 } 4059 }
4052 if (!is_lazily_parsed) { 4060 if (!is_lazily_parsed) {
4053 body = ParseEagerFunctionBody(function_name, pos, fvar, fvar_init_op, 4061 body = ParseEagerFunctionBody(function_name, pos, parsing_state, fvar,
4054 kind, CHECK_OK); 4062 fvar_init_op, kind, CHECK_OK);
4055 materialized_literal_count = function_state.materialized_literal_count(); 4063 materialized_literal_count = function_state.materialized_literal_count();
4056 expected_property_count = function_state.expected_property_count(); 4064 expected_property_count = function_state.expected_property_count();
4057 4065
4058 if (is_strong(language_mode()) && IsSubclassConstructor(kind)) { 4066 if (is_strong(language_mode()) && IsSubclassConstructor(kind)) {
4059 if (!function_state.super_location().IsValid()) { 4067 if (!function_state.super_location().IsValid()) {
4060 ReportMessageAt(function_name_location, 4068 ReportMessageAt(function_name_location,
4061 MessageTemplate::kStrongSuperCallMissing, 4069 MessageTemplate::kStrongSuperCallMissing,
4062 kReferenceError); 4070 kReferenceError);
4063 *ok = false; 4071 *ok = false;
4064 return nullptr; 4072 return nullptr;
4065 } 4073 }
4066 } 4074 }
4067 } 4075 }
4068 4076
4069 // Validate name and parameter names. We can do this only after parsing the 4077 // Validate name and parameter names. We can do this only after parsing the
4070 // function, since the function can declare itself strict. 4078 // function, since the function can declare itself strict.
4071 CheckFunctionName(language_mode(), kind, function_name, 4079 CheckFunctionName(language_mode(), kind, function_name,
4072 name_is_strict_reserved, function_name_location, 4080 name_is_strict_reserved, function_name_location,
4073 CHECK_OK); 4081 CHECK_OK);
4074 const bool use_strict_params = has_rest || IsConciseMethod(kind); 4082 const bool use_strict_params =
4083 !parsing_state.is_simple_parameter_list || IsConciseMethod(kind);
4075 const bool allow_duplicate_parameters = 4084 const bool allow_duplicate_parameters =
4076 is_sloppy(language_mode()) && !use_strict_params; 4085 is_sloppy(language_mode()) && !use_strict_params;
4077 ValidateFormalParameters(&formals_classifier, language_mode(), 4086 ValidateFormalParameters(&formals_classifier, language_mode(),
4078 allow_duplicate_parameters, CHECK_OK); 4087 allow_duplicate_parameters, CHECK_OK);
4079 4088
4080 if (is_strict(language_mode())) { 4089 if (is_strict(language_mode())) {
4081 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(), 4090 CheckStrictOctalLiteral(scope->start_position(), scope->end_position(),
4082 CHECK_OK); 4091 CHECK_OK);
4083 CheckConflictingVarDeclarations(scope, CHECK_OK); 4092 CheckConflictingVarDeclarations(scope, CHECK_OK);
4084 } 4093 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
4226 RelocInfo::kNoPosition); 4235 RelocInfo::kNoPosition);
4227 IfStatement* if_statement = factory()->NewIfStatement( 4236 IfStatement* if_statement = factory()->NewIfStatement(
4228 condition, factory()->NewExpressionStatement(throw_type_error, 4237 condition, factory()->NewExpressionStatement(throw_type_error,
4229 RelocInfo::kNoPosition), 4238 RelocInfo::kNoPosition),
4230 factory()->NewEmptyStatement(RelocInfo::kNoPosition), 4239 factory()->NewEmptyStatement(RelocInfo::kNoPosition),
4231 RelocInfo::kNoPosition); 4240 RelocInfo::kNoPosition);
4232 return if_statement; 4241 return if_statement;
4233 } 4242 }
4234 4243
4235 4244
4245 Block* Parser::BuildParameterInitializationBlock(
4246 const ParserFormalParameterParsingState& formal_parameters, bool* ok) {
4247 DCHECK(scope_->is_function_scope());
4248 Block* init_block = nullptr;
4249 for (auto parameter : formal_parameters.params) {
4250 if (parameter.pattern == nullptr) continue;
4251 if (init_block == nullptr) {
4252 init_block = factory()->NewBlock(NULL, 1, true, RelocInfo::kNoPosition);
4253 }
4254
4255 DeclarationDescriptor descriptor;
4256 descriptor.declaration_kind = DeclarationDescriptor::PARAMETER;
4257 descriptor.parser = this;
4258 descriptor.declaration_scope = scope_;
4259 descriptor.scope = scope_;
4260 descriptor.mode = LET;
4261 descriptor.is_const = false;
4262 descriptor.needs_init = true;
4263 descriptor.declaration_pos = parameter.pattern->position();
4264 descriptor.initialization_pos = parameter.pattern->position();
4265 descriptor.init_op = Token::INIT_LET;
4266 DeclarationParsingResult::Declaration decl(
4267 parameter.pattern, parameter.pattern->position(),
4268 factory()->NewVariableProxy(parameter.var));
4269 PatternRewriter::DeclareAndInitializeVariables(init_block, &descriptor,
4270 &decl, nullptr, CHECK_OK);
4271 }
4272 return init_block;
4273 }
4274
4275
4236 ZoneList<Statement*>* Parser::ParseEagerFunctionBody( 4276 ZoneList<Statement*>* Parser::ParseEagerFunctionBody(
4237 const AstRawString* function_name, int pos, Variable* fvar, 4277 const AstRawString* function_name, int pos,
4278 const ParserFormalParameterParsingState& formal_parameters, Variable* fvar,
4238 Token::Value fvar_init_op, FunctionKind kind, bool* ok) { 4279 Token::Value fvar_init_op, FunctionKind kind, bool* ok) {
4239 // Everything inside an eagerly parsed function will be parsed eagerly 4280 // Everything inside an eagerly parsed function will be parsed eagerly
4240 // (see comment above). 4281 // (see comment above).
4241 ParsingModeScope parsing_mode(this, PARSE_EAGERLY); 4282 ParsingModeScope parsing_mode(this, PARSE_EAGERLY);
4242 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(8, zone()); 4283 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(8, zone());
4243 if (fvar != NULL) { 4284 if (fvar != NULL) {
4244 VariableProxy* fproxy = scope_->NewUnresolved(factory(), function_name); 4285 VariableProxy* fproxy = scope_->NewUnresolved(factory(), function_name);
4245 fproxy->BindTo(fvar); 4286 fproxy->BindTo(fvar);
4246 body->Add(factory()->NewExpressionStatement( 4287 body->Add(factory()->NewExpressionStatement(
4247 factory()->NewAssignment(fvar_init_op, 4288 factory()->NewAssignment(fvar_init_op,
4248 fproxy, 4289 fproxy,
4249 factory()->NewThisFunction(pos), 4290 factory()->NewThisFunction(pos),
4250 RelocInfo::kNoPosition), 4291 RelocInfo::kNoPosition),
4251 RelocInfo::kNoPosition), zone()); 4292 RelocInfo::kNoPosition), zone());
4252 } 4293 }
4253 4294
4254 4295
4255 // For concise constructors, check that they are constructed, 4296 // For concise constructors, check that they are constructed,
4256 // not called. 4297 // not called.
4257 if (i::IsConstructor(kind)) { 4298 if (i::IsConstructor(kind)) {
4258 AddAssertIsConstruct(body, pos); 4299 AddAssertIsConstruct(body, pos);
4259 } 4300 }
4260 4301
4302 auto init_block =
4303 BuildParameterInitializationBlock(formal_parameters, CHECK_OK);
4304 if (init_block != nullptr) {
4305 body->Add(init_block, zone());
4306 }
4307
4261 // For generators, allocate and yield an iterator on function entry. 4308 // For generators, allocate and yield an iterator on function entry.
4262 if (IsGeneratorFunction(kind)) { 4309 if (IsGeneratorFunction(kind)) {
4263 ZoneList<Expression*>* arguments = 4310 ZoneList<Expression*>* arguments =
4264 new(zone()) ZoneList<Expression*>(0, zone()); 4311 new(zone()) ZoneList<Expression*>(0, zone());
4265 CallRuntime* allocation = factory()->NewCallRuntime( 4312 CallRuntime* allocation = factory()->NewCallRuntime(
4266 ast_value_factory()->empty_string(), 4313 ast_value_factory()->empty_string(),
4267 Runtime::FunctionForId(Runtime::kCreateJSGeneratorObject), arguments, 4314 Runtime::FunctionForId(Runtime::kCreateJSGeneratorObject), arguments,
4268 pos); 4315 pos);
4269 VariableProxy* init_proxy = factory()->NewVariableProxy( 4316 VariableProxy* init_proxy = factory()->NewVariableProxy(
4270 function_state_->generator_object_variable()); 4317 function_state_->generator_object_variable());
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
4377 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); 4424 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT));
4378 scope_->SetScopeName(name); 4425 scope_->SetScopeName(name);
4379 4426
4380 VariableProxy* proxy = NULL; 4427 VariableProxy* proxy = NULL;
4381 if (name != NULL) { 4428 if (name != NULL) {
4382 proxy = NewUnresolved(name, CONST); 4429 proxy = NewUnresolved(name, CONST);
4383 const bool is_class_declaration = true; 4430 const bool is_class_declaration = true;
4384 Declaration* declaration = factory()->NewVariableDeclaration( 4431 Declaration* declaration = factory()->NewVariableDeclaration(
4385 proxy, CONST, block_scope, pos, is_class_declaration, 4432 proxy, CONST, block_scope, pos, is_class_declaration,
4386 scope_->class_declaration_group_start()); 4433 scope_->class_declaration_group_start());
4387 Declare(declaration, true, CHECK_OK); 4434 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
4388 } 4435 }
4389 4436
4390 Expression* extends = NULL; 4437 Expression* extends = NULL;
4391 if (Check(Token::EXTENDS)) { 4438 if (Check(Token::EXTENDS)) {
4392 block_scope->set_start_position(scanner()->location().end_pos); 4439 block_scope->set_start_position(scanner()->location().end_pos);
4393 ExpressionClassifier classifier; 4440 ExpressionClassifier classifier;
4394 extends = ParseLeftHandSideExpression(&classifier, CHECK_OK); 4441 extends = ParseLeftHandSideExpression(&classifier, CHECK_OK);
4395 ValidateExpression(&classifier, CHECK_OK); 4442 ValidateExpression(&classifier, CHECK_OK);
4396 } else { 4443 } else {
4397 block_scope->set_start_position(scanner()->location().end_pos); 4444 block_scope->set_start_position(scanner()->location().end_pos);
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after
5851 Expression* Parser::SpreadCallNew(Expression* function, 5898 Expression* Parser::SpreadCallNew(Expression* function,
5852 ZoneList<v8::internal::Expression*>* args, 5899 ZoneList<v8::internal::Expression*>* args,
5853 int pos) { 5900 int pos) {
5854 args->InsertAt(0, function, zone()); 5901 args->InsertAt(0, function, zone());
5855 5902
5856 return factory()->NewCallRuntime( 5903 return factory()->NewCallRuntime(
5857 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5904 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5858 } 5905 }
5859 } // namespace internal 5906 } // namespace internal
5860 } // namespace v8 5907 } // namespace v8
OLDNEW
« no previous file with comments | « src/parser.h ('k') | src/pattern-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698