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/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 Loading... |
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. |
4898 block_scope->set_end_position(end_pos); | 4900 block_scope->set_end_position(end_pos); |
4899 | 4901 |
4900 if (name != NULL) { | 4902 if (name != NULL) { |
4901 DCHECK_NOT_NULL(proxy); | 4903 DCHECK_NOT_NULL(proxy); |
4902 proxy->var()->set_initializer_position(end_pos); | 4904 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; | |
4907 } | 4905 } |
4908 | 4906 |
4909 return factory()->NewClassLiteral(name, block_scope, proxy, extends, | 4907 return factory()->NewClassLiteral(name, block_scope, proxy, extends, |
4910 constructor, properties, pos, end_pos); | 4908 constructor, properties, pos, end_pos); |
4911 } | 4909 } |
4912 | 4910 |
4913 | 4911 |
4914 Expression* Parser::ParseV8Intrinsic(bool* ok) { | 4912 Expression* Parser::ParseV8Intrinsic(bool* ok) { |
4915 // CallRuntime :: | 4913 // CallRuntime :: |
4916 // '%' Identifier Arguments | 4914 // '%' Identifier Arguments |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6363 | 6361 |
6364 Expression* Parser::SpreadCallNew(Expression* function, | 6362 Expression* Parser::SpreadCallNew(Expression* function, |
6365 ZoneList<v8::internal::Expression*>* args, | 6363 ZoneList<v8::internal::Expression*>* args, |
6366 int pos) { | 6364 int pos) { |
6367 args->InsertAt(0, function, zone()); | 6365 args->InsertAt(0, function, zone()); |
6368 | 6366 |
6369 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); | 6367 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); |
6370 } | 6368 } |
6371 } // namespace internal | 6369 } // namespace internal |
6372 } // namespace v8 | 6370 } // namespace v8 |
OLD | NEW |