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

Side by Side Diff: src/parser.cc

Issue 1416583002: Revert of Always give class literals a block scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/full-codegen/full-codegen.cc ('k') | no next file » | 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/parser.h" 5 #include "src/parser.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 4877 matching lines...) Expand 10 before | Expand all | Expand 10 after
4888 } 4888 }
4889 4889
4890 Expect(Token::RBRACE, CHECK_OK); 4890 Expect(Token::RBRACE, CHECK_OK);
4891 int end_pos = scanner()->location().end_pos; 4891 int end_pos = scanner()->location().end_pos;
4892 4892
4893 if (constructor == NULL) { 4893 if (constructor == NULL) {
4894 constructor = DefaultConstructor(extends != NULL, block_scope, pos, end_pos, 4894 constructor = DefaultConstructor(extends != NULL, block_scope, pos, end_pos,
4895 block_scope->language_mode()); 4895 block_scope->language_mode());
4896 } 4896 }
4897 4897
4898 // Note that we do not finalize this block scope because strong
4899 // mode uses it as a sentinel value indicating an anonymous class.
4900 block_scope->set_end_position(end_pos); 4898 block_scope->set_end_position(end_pos);
4901 4899
4902 if (name != NULL) { 4900 if (name != NULL) {
4903 DCHECK_NOT_NULL(proxy); 4901 DCHECK_NOT_NULL(proxy);
4904 proxy->var()->set_initializer_position(end_pos); 4902 proxy->var()->set_initializer_position(end_pos);
4903 } else {
4904 // Unnamed classes should not have scopes (the scope will be empty).
4905 DCHECK_EQ(block_scope->num_var_or_const(), 0);
4906 block_scope = nullptr;
4905 } 4907 }
4906 4908
4907 return factory()->NewClassLiteral(name, block_scope, proxy, extends, 4909 return factory()->NewClassLiteral(name, block_scope, proxy, extends,
4908 constructor, properties, pos, end_pos); 4910 constructor, properties, pos, end_pos);
4909 } 4911 }
4910 4912
4911 4913
4912 Expression* Parser::ParseV8Intrinsic(bool* ok) { 4914 Expression* Parser::ParseV8Intrinsic(bool* ok) {
4913 // CallRuntime :: 4915 // CallRuntime ::
4914 // '%' Identifier Arguments 4916 // '%' Identifier Arguments
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after
6361 6363
6362 Expression* Parser::SpreadCallNew(Expression* function, 6364 Expression* Parser::SpreadCallNew(Expression* function,
6363 ZoneList<v8::internal::Expression*>* args, 6365 ZoneList<v8::internal::Expression*>* args,
6364 int pos) { 6366 int pos) {
6365 args->InsertAt(0, function, zone()); 6367 args->InsertAt(0, function, zone());
6366 6368
6367 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); 6369 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos);
6368 } 6370 }
6369 } // namespace internal 6371 } // namespace internal
6370 } // namespace v8 6372 } // namespace v8
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698