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

Unified Diff: src/parser.cc

Issue 1087543004: [strong] Allow mutually recursive classes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: . Created 5 years, 8 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/ast.h ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 2c33878b9c16c8f7676df5f9ac021b5681c6150c..3bc20bda6326402c1e1612158c6a15b8854f1c54 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -1929,11 +1929,15 @@ Variable* Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
var = declaration_scope->LookupLocal(name);
if (var == NULL) {
// Declare the name.
+ Variable::Kind kind = Variable::NORMAL;
+ if (declaration->IsFunctionDeclaration()) {
+ kind = Variable::FUNCTION;
+ } else if (declaration->IsVariableDeclaration() &&
+ declaration->AsVariableDeclaration()->is_class_declaration()) {
+ kind = Variable::CLASS;
+ }
var = declaration_scope->DeclareLocal(
- name, mode, declaration->initialization(),
- declaration->IsFunctionDeclaration() ? Variable::FUNCTION
- : Variable::NORMAL,
- kNotAssigned);
+ name, mode, declaration->initialization(), kind, kNotAssigned);
} else if (IsLexicalVariableMode(mode) ||
IsLexicalVariableMode(var->mode()) ||
((mode == CONST_LEGACY || var->mode() == CONST_LEGACY) &&
@@ -2151,8 +2155,9 @@ Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names,
VariableMode mode = is_strong(language_mode()) ? CONST : LET;
VariableProxy* proxy = NewUnresolved(name, mode);
- Declaration* declaration =
- factory()->NewVariableDeclaration(proxy, mode, scope_, pos);
+ const bool is_class_declaration = true;
+ Declaration* declaration = factory()->NewVariableDeclaration(
+ proxy, mode, scope_, pos, is_class_declaration);
Declare(declaration, true, CHECK_OK);
proxy->var()->set_initializer_position(position());
« no previous file with comments | « src/ast.h ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698