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

Side by Side Diff: src/parser.cc

Issue 1102903002: [strong] Simplify the classes-referring-to-classes check. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: oops 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/scopes.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 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after
2192 is_strict_reserved, pos, CHECK_OK); 2192 is_strict_reserved, pos, CHECK_OK);
2193 2193
2194 VariableMode mode = is_strong(language_mode()) ? CONST : LET; 2194 VariableMode mode = is_strong(language_mode()) ? CONST : LET;
2195 VariableProxy* proxy = NewUnresolved(name, mode); 2195 VariableProxy* proxy = NewUnresolved(name, mode);
2196 const bool is_class_declaration = true; 2196 const bool is_class_declaration = true;
2197 Declaration* declaration = factory()->NewVariableDeclaration( 2197 Declaration* declaration = factory()->NewVariableDeclaration(
2198 proxy, mode, scope_, pos, is_class_declaration, 2198 proxy, mode, scope_, pos, is_class_declaration,
2199 scope_->class_declaration_group_start()); 2199 scope_->class_declaration_group_start());
2200 Variable* outer_class_variable = Declare(declaration, true, CHECK_OK); 2200 Variable* outer_class_variable = Declare(declaration, true, CHECK_OK);
2201 proxy->var()->set_initializer_position(position()); 2201 proxy->var()->set_initializer_position(position());
2202 // This is needed because a class ("class Name { }") creates two bindings (one
2203 // in the outer scope, and one in the class scope). The method is a function
2204 // scope inside the inner scope (class scope). The consecutive class
2205 // declarations are in the outer scope.
2202 if (value->class_variable_proxy() && value->class_variable_proxy()->var() && 2206 if (value->class_variable_proxy() && value->class_variable_proxy()->var() &&
2203 outer_class_variable->is_class()) { 2207 outer_class_variable->is_class()) {
2204 // In some cases, the outer variable is not detected as a class variable; 2208 // In some cases, the outer variable is not detected as a class variable;
2205 // this happens e.g., for lazy methods. They are excluded from strong mode 2209 // this happens e.g., for lazy methods. They are excluded from strong mode
2206 // checks for now. TODO(marja, rossberg): re-create variables with the 2210 // checks for now. TODO(marja, rossberg): re-create variables with the
2207 // correct Kind and remove this hack. 2211 // correct Kind and remove this hack.
2208 value->class_variable_proxy() 2212 value->class_variable_proxy()
2209 ->var() 2213 ->var()
2210 ->AsClassVariable() 2214 ->AsClassVariable()
2211 ->set_corresponding_outer_class_variable( 2215 ->set_declaration_group_start(
2212 outer_class_variable->AsClassVariable()); 2216 outer_class_variable->AsClassVariable()->declaration_group_start());
2213 } 2217 }
2214 2218
2215 Token::Value init_op = 2219 Token::Value init_op =
2216 is_strong(language_mode()) ? Token::INIT_CONST : Token::INIT_LET; 2220 is_strong(language_mode()) ? Token::INIT_CONST : Token::INIT_LET;
2217 Assignment* assignment = factory()->NewAssignment(init_op, proxy, value, pos); 2221 Assignment* assignment = factory()->NewAssignment(init_op, proxy, value, pos);
2218 Statement* assignment_statement = 2222 Statement* assignment_statement =
2219 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition); 2223 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition);
2220 if (names) names->Add(name, zone()); 2224 if (names) names->Add(name, zone());
2221 return assignment_statement; 2225 return assignment_statement;
2222 } 2226 }
(...skipping 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after
5832 5836
5833 Expression* Parser::SpreadCallNew(Expression* function, 5837 Expression* Parser::SpreadCallNew(Expression* function,
5834 ZoneList<v8::internal::Expression*>* args, 5838 ZoneList<v8::internal::Expression*>* args,
5835 int pos) { 5839 int pos) {
5836 args->InsertAt(0, function, zone()); 5840 args->InsertAt(0, function, zone());
5837 5841
5838 return factory()->NewCallRuntime( 5842 return factory()->NewCallRuntime(
5839 ast_value_factory()->reflect_construct_string(), NULL, args, pos); 5843 ast_value_factory()->reflect_construct_string(), NULL, args, pos);
5840 } 5844 }
5841 } } // namespace v8::internal 5845 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698