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

Side by Side Diff: src/parser.cc

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