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

Unified Diff: src/parsing/parser.cc

Issue 1704223002: Remove strong mode support from Scope and Variable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove test-parsing test Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 1c50f5aef4a178132c3a9bba9a9e66d42c078e30..4c997a4ba56e7d800b5c9b04f67b2884416c8671 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -1267,20 +1267,10 @@ Statement* Parser::ParseStatementListItem(bool* ok) {
// Statement
// Declaration
- if (peek() != Token::CLASS) {
- // No more classes follow; reset the start position for the consecutive
- // class declaration group.
- scope_->set_class_declaration_group_start(-1);
- }
-
switch (peek()) {
case Token::FUNCTION:
return ParseFunctionDeclaration(NULL, ok);
case Token::CLASS:
- if (scope_->class_declaration_group_start() < 0) {
- scope_->set_class_declaration_group_start(
- scanner()->peek_location().beg_pos);
- }
Consume(Token::CLASS);
return ParseClassDeclaration(NULL, ok);
case Token::CONST:
@@ -1958,18 +1948,11 @@ Variable* Parser::Declare(Declaration* declaration,
if (var == NULL) {
// Declare the name.
Variable::Kind kind = Variable::NORMAL;
- int declaration_group_start = -1;
if (is_function_declaration) {
kind = Variable::FUNCTION;
- } else if (declaration->IsVariableDeclaration() &&
- declaration->AsVariableDeclaration()->is_class_declaration()) {
- kind = Variable::CLASS;
- declaration_group_start =
- declaration->AsVariableDeclaration()->declaration_group_start();
}
var = declaration_scope->DeclareLocal(
- name, mode, declaration->initialization(), kind, kNotAssigned,
- declaration_group_start);
+ name, mode, declaration->initialization(), kind, kNotAssigned);
} else if ((mode == CONST_LEGACY || var->mode() == CONST_LEGACY) &&
!declaration_scope->is_script_scope()) {
// Duplicate legacy const definitions throw at runtime.
@@ -2229,30 +2212,10 @@ Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names,
VariableMode mode = is_strong(language_mode()) ? CONST : LET;
VariableProxy* proxy = NewUnresolved(name, mode);
- const bool is_class_declaration = true;
- Declaration* declaration = factory()->NewVariableDeclaration(
- proxy, mode, scope_, pos, is_class_declaration,
- scope_->class_declaration_group_start());
- Variable* outer_class_variable =
- Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
+ Declaration* declaration =
+ factory()->NewVariableDeclaration(proxy, mode, scope_, pos);
+ Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
proxy->var()->set_initializer_position(position());
- // This is needed because a class ("class Name { }") creates two bindings (one
- // in the outer scope, and one in the class scope). The method is a function
- // scope inside the inner scope (class scope). The consecutive class
- // declarations are in the outer scope.
- if (value->class_variable_proxy() && value->class_variable_proxy()->var() &&
- outer_class_variable->is_class()) {
- // In some cases, the outer variable is not detected as a class variable;
- // this happens e.g., for lazy methods. They are excluded from strong mode
- // checks for now. TODO(marja, rossberg): re-create variables with the
- // correct Kind and remove this hack.
- value->class_variable_proxy()
- ->var()
- ->AsClassVariable()
- ->set_declaration_group_start(
- outer_class_variable->AsClassVariable()->declaration_group_start());
- }
-
Assignment* assignment =
factory()->NewAssignment(Token::INIT, proxy, value, pos);
Statement* assignment_statement =
@@ -4897,10 +4860,8 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
VariableProxy* proxy = NULL;
if (name != NULL) {
proxy = NewUnresolved(name, CONST);
- const bool is_class_declaration = true;
- Declaration* declaration = factory()->NewVariableDeclaration(
- proxy, CONST, block_scope, pos, is_class_declaration,
- scope_->class_declaration_group_start());
+ Declaration* declaration =
+ factory()->NewVariableDeclaration(proxy, CONST, block_scope, pos);
Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK);
}
« no previous file with comments | « src/objects.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698