| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/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/ast-literal-reindexer.h" | 9 #include "src/ast-literal-reindexer.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 ReportMessage(MessageTemplate::kStrictEvalArguments); | 1547 ReportMessage(MessageTemplate::kStrictEvalArguments); |
| 1548 return NULL; | 1548 return NULL; |
| 1549 } else if (is_strong(language_mode()) && IsUndefined(local_name)) { | 1549 } else if (is_strong(language_mode()) && IsUndefined(local_name)) { |
| 1550 *ok = false; | 1550 *ok = false; |
| 1551 ReportMessage(MessageTemplate::kStrongUndefined); | 1551 ReportMessage(MessageTemplate::kStrongUndefined); |
| 1552 return NULL; | 1552 return NULL; |
| 1553 } | 1553 } |
| 1554 VariableProxy* proxy = NewUnresolved(local_name, IMPORT); | 1554 VariableProxy* proxy = NewUnresolved(local_name, IMPORT); |
| 1555 ImportDeclaration* declaration = | 1555 ImportDeclaration* declaration = |
| 1556 factory()->NewImportDeclaration(proxy, import_name, NULL, scope_, pos); | 1556 factory()->NewImportDeclaration(proxy, import_name, NULL, scope_, pos); |
| 1557 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); | 1557 Declare(declaration, DeclarationDescriptor::NORMAL, true, true, CHECK_OK); |
| 1558 result->Add(declaration, zone()); | 1558 result->Add(declaration, zone()); |
| 1559 if (peek() == Token::RBRACE) break; | 1559 if (peek() == Token::RBRACE) break; |
| 1560 Expect(Token::COMMA, CHECK_OK); | 1560 Expect(Token::COMMA, CHECK_OK); |
| 1561 } | 1561 } |
| 1562 | 1562 |
| 1563 Expect(Token::RBRACE, CHECK_OK); | 1563 Expect(Token::RBRACE, CHECK_OK); |
| 1564 | 1564 |
| 1565 return result; | 1565 return result; |
| 1566 } | 1566 } |
| 1567 | 1567 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1596 | 1596 |
| 1597 // Parse ImportedDefaultBinding if present. | 1597 // Parse ImportedDefaultBinding if present. |
| 1598 ImportDeclaration* import_default_declaration = NULL; | 1598 ImportDeclaration* import_default_declaration = NULL; |
| 1599 if (tok != Token::MUL && tok != Token::LBRACE) { | 1599 if (tok != Token::MUL && tok != Token::LBRACE) { |
| 1600 const AstRawString* local_name = | 1600 const AstRawString* local_name = |
| 1601 ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK); | 1601 ParseIdentifier(kDontAllowRestrictedIdentifiers, CHECK_OK); |
| 1602 VariableProxy* proxy = NewUnresolved(local_name, IMPORT); | 1602 VariableProxy* proxy = NewUnresolved(local_name, IMPORT); |
| 1603 import_default_declaration = factory()->NewImportDeclaration( | 1603 import_default_declaration = factory()->NewImportDeclaration( |
| 1604 proxy, ast_value_factory()->default_string(), NULL, scope_, pos); | 1604 proxy, ast_value_factory()->default_string(), NULL, scope_, pos); |
| 1605 Declare(import_default_declaration, DeclarationDescriptor::NORMAL, true, | 1605 Declare(import_default_declaration, DeclarationDescriptor::NORMAL, true, |
| 1606 CHECK_OK); | 1606 true, CHECK_OK); |
| 1607 } | 1607 } |
| 1608 | 1608 |
| 1609 const AstRawString* module_instance_binding = NULL; | 1609 const AstRawString* module_instance_binding = NULL; |
| 1610 ZoneList<ImportDeclaration*>* named_declarations = NULL; | 1610 ZoneList<ImportDeclaration*>* named_declarations = NULL; |
| 1611 if (import_default_declaration == NULL || Check(Token::COMMA)) { | 1611 if (import_default_declaration == NULL || Check(Token::COMMA)) { |
| 1612 switch (peek()) { | 1612 switch (peek()) { |
| 1613 case Token::MUL: { | 1613 case Token::MUL: { |
| 1614 Consume(Token::MUL); | 1614 Consume(Token::MUL); |
| 1615 ExpectContextualKeyword(CStrVector("as"), CHECK_OK); | 1615 ExpectContextualKeyword(CStrVector("as"), CHECK_OK); |
| 1616 module_instance_binding = | 1616 module_instance_binding = |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1985 // Let/const variables in harmony mode are always added to the immediately | 1985 // Let/const variables in harmony mode are always added to the immediately |
| 1986 // enclosing scope. | 1986 // enclosing scope. |
| 1987 return DeclarationScope(mode)->NewUnresolved( | 1987 return DeclarationScope(mode)->NewUnresolved( |
| 1988 factory(), name, Variable::NORMAL, scanner()->location().beg_pos, | 1988 factory(), name, Variable::NORMAL, scanner()->location().beg_pos, |
| 1989 scanner()->location().end_pos); | 1989 scanner()->location().end_pos); |
| 1990 } | 1990 } |
| 1991 | 1991 |
| 1992 | 1992 |
| 1993 Variable* Parser::Declare(Declaration* declaration, | 1993 Variable* Parser::Declare(Declaration* declaration, |
| 1994 DeclarationDescriptor::Kind declaration_kind, | 1994 DeclarationDescriptor::Kind declaration_kind, |
| 1995 bool resolve, bool* ok) { | 1995 bool resolve, bool report_error, bool* ok) { |
| 1996 VariableProxy* proxy = declaration->proxy(); | 1996 VariableProxy* proxy = declaration->proxy(); |
| 1997 DCHECK(proxy->raw_name() != NULL); | 1997 DCHECK(proxy->raw_name() != NULL); |
| 1998 const AstRawString* name = proxy->raw_name(); | 1998 const AstRawString* name = proxy->raw_name(); |
| 1999 VariableMode mode = declaration->mode(); | 1999 VariableMode mode = declaration->mode(); |
| 2000 Scope* declaration_scope = DeclarationScope(mode); | 2000 Scope* declaration_scope = DeclarationScope(mode); |
| 2001 Variable* var = NULL; | 2001 Variable* var = NULL; |
| 2002 | 2002 |
| 2003 // If a suitable scope exists, then we can statically declare this | 2003 // If a suitable scope exists, then we can statically declare this |
| 2004 // variable and also set its mode. In any case, a Declaration node | 2004 // variable and also set its mode. In any case, a Declaration node |
| 2005 // will be added to the scope so that the declaration can be added | 2005 // 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 Loading... |
| 2044 // the special case | 2044 // the special case |
| 2045 // | 2045 // |
| 2046 // function () { let x; { var x; } } | 2046 // function () { let x; { var x; } } |
| 2047 // | 2047 // |
| 2048 // because the var declaration is hoisted to the function scope where 'x' | 2048 // because the var declaration is hoisted to the function scope where 'x' |
| 2049 // is already bound. | 2049 // is already bound. |
| 2050 DCHECK(IsDeclaredVariableMode(var->mode())); | 2050 DCHECK(IsDeclaredVariableMode(var->mode())); |
| 2051 if (is_strict(language_mode()) || allow_harmony_sloppy()) { | 2051 if (is_strict(language_mode()) || allow_harmony_sloppy()) { |
| 2052 // In harmony we treat re-declarations as early errors. See | 2052 // In harmony we treat re-declarations as early errors. See |
| 2053 // ES5 16 for a definition of early errors. | 2053 // ES5 16 for a definition of early errors. |
| 2054 if (declaration_kind == DeclarationDescriptor::NORMAL) { | 2054 if (report_error) { |
| 2055 ParserTraits::ReportMessage(MessageTemplate::kVarRedeclaration, name); | 2055 if (declaration_kind == DeclarationDescriptor::NORMAL) { |
| 2056 } else { | 2056 ParserTraits::ReportMessage(MessageTemplate::kVarRedeclaration, |
| 2057 ParserTraits::ReportMessage(MessageTemplate::kStrictParamDupe); | 2057 name); |
| 2058 } else { |
| 2059 ParserTraits::ReportMessage(MessageTemplate::kStrictParamDupe); |
| 2060 } |
| 2058 } | 2061 } |
| 2059 *ok = false; | 2062 *ok = false; |
| 2060 return nullptr; | 2063 return nullptr; |
| 2061 } | 2064 } |
| 2062 Expression* expression = NewThrowSyntaxError( | 2065 Expression* expression = NewThrowSyntaxError( |
| 2063 MessageTemplate::kVarRedeclaration, name, declaration->position()); | 2066 MessageTemplate::kVarRedeclaration, name, declaration->position()); |
| 2064 declaration_scope->SetIllegalRedeclaration(expression); | 2067 declaration_scope->SetIllegalRedeclaration(expression); |
| 2065 } else if (mode == VAR) { | 2068 } else if (mode == VAR) { |
| 2066 var->set_maybe_assigned(); | 2069 var->set_maybe_assigned(); |
| 2067 } | 2070 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 // accessible while parsing the first time not when reparsing | 2165 // accessible while parsing the first time not when reparsing |
| 2163 // because of lazy compilation. | 2166 // because of lazy compilation. |
| 2164 DeclarationScope(VAR)->ForceEagerCompilation(); | 2167 DeclarationScope(VAR)->ForceEagerCompilation(); |
| 2165 | 2168 |
| 2166 // TODO(1240846): It's weird that native function declarations are | 2169 // TODO(1240846): It's weird that native function declarations are |
| 2167 // introduced dynamically when we meet their declarations, whereas | 2170 // introduced dynamically when we meet their declarations, whereas |
| 2168 // other functions are set up when entering the surrounding scope. | 2171 // other functions are set up when entering the surrounding scope. |
| 2169 VariableProxy* proxy = NewUnresolved(name, VAR); | 2172 VariableProxy* proxy = NewUnresolved(name, VAR); |
| 2170 Declaration* declaration = | 2173 Declaration* declaration = |
| 2171 factory()->NewVariableDeclaration(proxy, VAR, scope_, pos); | 2174 factory()->NewVariableDeclaration(proxy, VAR, scope_, pos); |
| 2172 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); | 2175 Declare(declaration, DeclarationDescriptor::NORMAL, true, true, CHECK_OK); |
| 2173 NativeFunctionLiteral* lit = factory()->NewNativeFunctionLiteral( | 2176 NativeFunctionLiteral* lit = factory()->NewNativeFunctionLiteral( |
| 2174 name, extension_, RelocInfo::kNoPosition); | 2177 name, extension_, RelocInfo::kNoPosition); |
| 2175 return factory()->NewExpressionStatement( | 2178 return factory()->NewExpressionStatement( |
| 2176 factory()->NewAssignment( | 2179 factory()->NewAssignment( |
| 2177 Token::INIT_VAR, proxy, lit, RelocInfo::kNoPosition), | 2180 Token::INIT_VAR, proxy, lit, RelocInfo::kNoPosition), |
| 2178 pos); | 2181 pos); |
| 2179 } | 2182 } |
| 2180 | 2183 |
| 2181 | 2184 |
| 2182 Statement* Parser::ParseFunctionDeclaration( | 2185 Statement* Parser::ParseFunctionDeclaration( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2209 is_strong(language_mode()) | 2212 is_strong(language_mode()) |
| 2210 ? CONST | 2213 ? CONST |
| 2211 : (is_strict(language_mode()) || allow_harmony_sloppy()) && | 2214 : (is_strict(language_mode()) || allow_harmony_sloppy()) && |
| 2212 !(scope_->is_script_scope() || scope_->is_eval_scope() || | 2215 !(scope_->is_script_scope() || scope_->is_eval_scope() || |
| 2213 scope_->is_function_scope()) | 2216 scope_->is_function_scope()) |
| 2214 ? LET | 2217 ? LET |
| 2215 : VAR; | 2218 : VAR; |
| 2216 VariableProxy* proxy = NewUnresolved(name, mode); | 2219 VariableProxy* proxy = NewUnresolved(name, mode); |
| 2217 Declaration* declaration = | 2220 Declaration* declaration = |
| 2218 factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos); | 2221 factory()->NewFunctionDeclaration(proxy, mode, fun, scope_, pos); |
| 2219 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); | 2222 Declare(declaration, DeclarationDescriptor::NORMAL, true, true, CHECK_OK); |
| 2220 if (names) names->Add(name, zone()); | 2223 if (names) names->Add(name, zone()); |
| 2224 |
| 2225 // For sloppy function in block we also add a var binding that gets assigned |
| 2226 // to at the location of the FunctionDeclaration -- but only if introducing |
| 2227 // this var binding does not lead to an early error. |
| 2228 if (is_sloppy(language_mode()) && scope_->is_block_scope() && |
| 2229 allow_harmony_sloppy()) { |
| 2230 VariableProxy* var_proxy = NewUnresolved(name, VAR); |
| 2231 Declaration* declaration = |
| 2232 factory()->NewVariableDeclaration(var_proxy, VAR, scope_, pos); |
| 2233 bool var_ok = true; |
| 2234 const bool resolve = true; |
| 2235 const bool report_error = false; |
| 2236 Declare(declaration, DeclarationDescriptor::NORMAL, resolve, report_error, |
| 2237 &var_ok); |
| 2238 if (!var_ok) { |
| 2239 scope_->RemoveUnresolved(var_proxy); |
| 2240 } else { |
| 2241 // At the location of the FunctionDeclaration we assign to the var |
| 2242 // binding. |
| 2243 Assignment* assignment = factory()->NewAssignment( |
| 2244 Token::ASSIGN, var_proxy, NewUnresolved(name, mode), pos); |
| 2245 return factory()->NewExpressionStatement(assignment, |
| 2246 RelocInfo::kNoPosition); |
| 2247 } |
| 2248 } |
| 2221 return factory()->NewEmptyStatement(RelocInfo::kNoPosition); | 2249 return factory()->NewEmptyStatement(RelocInfo::kNoPosition); |
| 2222 } | 2250 } |
| 2223 | 2251 |
| 2224 | 2252 |
| 2225 Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names, | 2253 Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names, |
| 2226 bool* ok) { | 2254 bool* ok) { |
| 2227 // ClassDeclaration :: | 2255 // ClassDeclaration :: |
| 2228 // 'class' Identifier ('extends' LeftHandExpression)? '{' ClassBody '}' | 2256 // 'class' Identifier ('extends' LeftHandExpression)? '{' ClassBody '}' |
| 2229 // | 2257 // |
| 2230 // A ClassDeclaration | 2258 // A ClassDeclaration |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2251 ClassLiteral* value = ParseClassLiteral(name, scanner()->location(), | 2279 ClassLiteral* value = ParseClassLiteral(name, scanner()->location(), |
| 2252 is_strict_reserved, pos, CHECK_OK); | 2280 is_strict_reserved, pos, CHECK_OK); |
| 2253 | 2281 |
| 2254 VariableMode mode = is_strong(language_mode()) ? CONST : LET; | 2282 VariableMode mode = is_strong(language_mode()) ? CONST : LET; |
| 2255 VariableProxy* proxy = NewUnresolved(name, mode); | 2283 VariableProxy* proxy = NewUnresolved(name, mode); |
| 2256 const bool is_class_declaration = true; | 2284 const bool is_class_declaration = true; |
| 2257 Declaration* declaration = factory()->NewVariableDeclaration( | 2285 Declaration* declaration = factory()->NewVariableDeclaration( |
| 2258 proxy, mode, scope_, pos, is_class_declaration, | 2286 proxy, mode, scope_, pos, is_class_declaration, |
| 2259 scope_->class_declaration_group_start()); | 2287 scope_->class_declaration_group_start()); |
| 2260 Variable* outer_class_variable = | 2288 Variable* outer_class_variable = |
| 2261 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); | 2289 Declare(declaration, DeclarationDescriptor::NORMAL, true, true, CHECK_OK); |
| 2262 proxy->var()->set_initializer_position(position()); | 2290 proxy->var()->set_initializer_position(position()); |
| 2263 // This is needed because a class ("class Name { }") creates two bindings (one | 2291 // This is needed because a class ("class Name { }") creates two bindings (one |
| 2264 // in the outer scope, and one in the class scope). The method is a function | 2292 // in the outer scope, and one in the class scope). The method is a function |
| 2265 // scope inside the inner scope (class scope). The consecutive class | 2293 // scope inside the inner scope (class scope). The consecutive class |
| 2266 // declarations are in the outer scope. | 2294 // declarations are in the outer scope. |
| 2267 if (value->class_variable_proxy() && value->class_variable_proxy()->var() && | 2295 if (value->class_variable_proxy() && value->class_variable_proxy()->var() && |
| 2268 outer_class_variable->is_class()) { | 2296 outer_class_variable->is_class()) { |
| 2269 // In some cases, the outer variable is not detected as a class variable; | 2297 // In some cases, the outer variable is not detected as a class variable; |
| 2270 // this happens e.g., for lazy methods. They are excluded from strong mode | 2298 // this happens e.g., for lazy methods. They are excluded from strong mode |
| 2271 // checks for now. TODO(marja, rossberg): re-create variables with the | 2299 // checks for now. TODO(marja, rossberg): re-create variables with the |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3340 Block* ignore_completion_block = factory()->NewBlock( | 3368 Block* ignore_completion_block = factory()->NewBlock( |
| 3341 NULL, names->length() + 2, true, RelocInfo::kNoPosition); | 3369 NULL, names->length() + 2, true, RelocInfo::kNoPosition); |
| 3342 ZoneList<Variable*> inner_vars(names->length(), zone()); | 3370 ZoneList<Variable*> inner_vars(names->length(), zone()); |
| 3343 // For each let variable x: | 3371 // For each let variable x: |
| 3344 // make statement: let/const x = temp_x. | 3372 // make statement: let/const x = temp_x. |
| 3345 VariableMode mode = is_const ? CONST : LET; | 3373 VariableMode mode = is_const ? CONST : LET; |
| 3346 for (int i = 0; i < names->length(); i++) { | 3374 for (int i = 0; i < names->length(); i++) { |
| 3347 VariableProxy* proxy = NewUnresolved(names->at(i), mode); | 3375 VariableProxy* proxy = NewUnresolved(names->at(i), mode); |
| 3348 Declaration* declaration = factory()->NewVariableDeclaration( | 3376 Declaration* declaration = factory()->NewVariableDeclaration( |
| 3349 proxy, mode, scope_, RelocInfo::kNoPosition); | 3377 proxy, mode, scope_, RelocInfo::kNoPosition); |
| 3350 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); | 3378 Declare(declaration, DeclarationDescriptor::NORMAL, true, true, CHECK_OK); |
| 3351 inner_vars.Add(declaration->proxy()->var(), zone()); | 3379 inner_vars.Add(declaration->proxy()->var(), zone()); |
| 3352 VariableProxy* temp_proxy = factory()->NewVariableProxy(temps.at(i)); | 3380 VariableProxy* temp_proxy = factory()->NewVariableProxy(temps.at(i)); |
| 3353 Assignment* assignment = | 3381 Assignment* assignment = |
| 3354 factory()->NewAssignment(is_const ? Token::INIT_CONST : Token::INIT_LET, | 3382 factory()->NewAssignment(is_const ? Token::INIT_CONST : Token::INIT_LET, |
| 3355 proxy, temp_proxy, RelocInfo::kNoPosition); | 3383 proxy, temp_proxy, RelocInfo::kNoPosition); |
| 3356 Statement* assignment_statement = | 3384 Statement* assignment_statement = |
| 3357 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition); | 3385 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition); |
| 3358 DCHECK(init->position() != RelocInfo::kNoPosition); | 3386 DCHECK(init->position() != RelocInfo::kNoPosition); |
| 3359 proxy->var()->set_initializer_position(init->position()); | 3387 proxy->var()->set_initializer_position(init->position()); |
| 3360 ignore_completion_block->AddStatement(assignment_statement, zone()); | 3388 ignore_completion_block->AddStatement(assignment_statement, zone()); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3629 factory()->NewBlock(nullptr, 1, false, RelocInfo::kNoPosition); | 3657 factory()->NewBlock(nullptr, 1, false, RelocInfo::kNoPosition); |
| 3630 | 3658 |
| 3631 for (int i = 0; i < lexical_bindings.length(); ++i) { | 3659 for (int i = 0; i < lexical_bindings.length(); ++i) { |
| 3632 // TODO(adamk): This needs to be some sort of special | 3660 // TODO(adamk): This needs to be some sort of special |
| 3633 // INTERNAL variable that's invisible to the debugger | 3661 // INTERNAL variable that's invisible to the debugger |
| 3634 // but visible to everything else. | 3662 // but visible to everything else. |
| 3635 VariableProxy* tdz_proxy = NewUnresolved(lexical_bindings[i], LET); | 3663 VariableProxy* tdz_proxy = NewUnresolved(lexical_bindings[i], LET); |
| 3636 Declaration* tdz_decl = factory()->NewVariableDeclaration( | 3664 Declaration* tdz_decl = factory()->NewVariableDeclaration( |
| 3637 tdz_proxy, LET, scope_, RelocInfo::kNoPosition); | 3665 tdz_proxy, LET, scope_, RelocInfo::kNoPosition); |
| 3638 Variable* tdz_var = Declare(tdz_decl, DeclarationDescriptor::NORMAL, | 3666 Variable* tdz_var = Declare(tdz_decl, DeclarationDescriptor::NORMAL, |
| 3639 true, CHECK_OK); | 3667 true, true, CHECK_OK); |
| 3640 tdz_var->set_initializer_position(position()); | 3668 tdz_var->set_initializer_position(position()); |
| 3641 } | 3669 } |
| 3642 } | 3670 } |
| 3643 | 3671 |
| 3644 scope_ = saved_scope; | 3672 scope_ = saved_scope; |
| 3645 for_scope->set_end_position(scanner()->location().end_pos); | 3673 for_scope->set_end_position(scanner()->location().end_pos); |
| 3646 for_scope = for_scope->FinalizeBlockScope(); | 3674 for_scope = for_scope->FinalizeBlockScope(); |
| 3647 // Parsed for-in loop w/ variable declarations. | 3675 // Parsed for-in loop w/ variable declarations. |
| 3648 if (init_block != nullptr) { | 3676 if (init_block != nullptr) { |
| 3649 init_block->AddStatement(loop, zone()); | 3677 init_block->AddStatement(loop, zone()); |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4470 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); | 4498 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); |
| 4471 scope_->SetScopeName(name); | 4499 scope_->SetScopeName(name); |
| 4472 | 4500 |
| 4473 VariableProxy* proxy = NULL; | 4501 VariableProxy* proxy = NULL; |
| 4474 if (name != NULL) { | 4502 if (name != NULL) { |
| 4475 proxy = NewUnresolved(name, CONST); | 4503 proxy = NewUnresolved(name, CONST); |
| 4476 const bool is_class_declaration = true; | 4504 const bool is_class_declaration = true; |
| 4477 Declaration* declaration = factory()->NewVariableDeclaration( | 4505 Declaration* declaration = factory()->NewVariableDeclaration( |
| 4478 proxy, CONST, block_scope, pos, is_class_declaration, | 4506 proxy, CONST, block_scope, pos, is_class_declaration, |
| 4479 scope_->class_declaration_group_start()); | 4507 scope_->class_declaration_group_start()); |
| 4480 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); | 4508 Declare(declaration, DeclarationDescriptor::NORMAL, true, true, CHECK_OK); |
| 4481 } | 4509 } |
| 4482 | 4510 |
| 4483 Expression* extends = NULL; | 4511 Expression* extends = NULL; |
| 4484 if (Check(Token::EXTENDS)) { | 4512 if (Check(Token::EXTENDS)) { |
| 4485 block_scope->set_start_position(scanner()->location().end_pos); | 4513 block_scope->set_start_position(scanner()->location().end_pos); |
| 4486 ExpressionClassifier classifier; | 4514 ExpressionClassifier classifier; |
| 4487 extends = ParseLeftHandSideExpression(&classifier, CHECK_OK); | 4515 extends = ParseLeftHandSideExpression(&classifier, CHECK_OK); |
| 4488 ValidateExpression(&classifier, CHECK_OK); | 4516 ValidateExpression(&classifier, CHECK_OK); |
| 4489 } else { | 4517 } else { |
| 4490 block_scope->set_start_position(scanner()->location().end_pos); | 4518 block_scope->set_start_position(scanner()->location().end_pos); |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5944 Expression* Parser::SpreadCallNew(Expression* function, | 5972 Expression* Parser::SpreadCallNew(Expression* function, |
| 5945 ZoneList<v8::internal::Expression*>* args, | 5973 ZoneList<v8::internal::Expression*>* args, |
| 5946 int pos) { | 5974 int pos) { |
| 5947 args->InsertAt(0, function, zone()); | 5975 args->InsertAt(0, function, zone()); |
| 5948 | 5976 |
| 5949 return factory()->NewCallRuntime( | 5977 return factory()->NewCallRuntime( |
| 5950 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5978 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
| 5951 } | 5979 } |
| 5952 } // namespace internal | 5980 } // namespace internal |
| 5953 } // namespace v8 | 5981 } // namespace v8 |
| OLD | NEW |