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/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/ast-literal-reindexer.h" | 9 #include "src/ast-literal-reindexer.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 4403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4414 ReportMessageAt(class_name_location, MessageTemplate::kStrictEvalArguments); | 4414 ReportMessageAt(class_name_location, MessageTemplate::kStrictEvalArguments); |
4415 *ok = false; | 4415 *ok = false; |
4416 return NULL; | 4416 return NULL; |
4417 } | 4417 } |
4418 if (is_strong(language_mode()) && IsUndefined(name)) { | 4418 if (is_strong(language_mode()) && IsUndefined(name)) { |
4419 ReportMessageAt(class_name_location, MessageTemplate::kStrongUndefined); | 4419 ReportMessageAt(class_name_location, MessageTemplate::kStrongUndefined); |
4420 *ok = false; | 4420 *ok = false; |
4421 return NULL; | 4421 return NULL; |
4422 } | 4422 } |
4423 | 4423 |
4424 // Create a block scope which is additionally tagged as class scope; this is | |
4425 // important for resolving variable references to the class name in the strong | |
4426 // mode. | |
4427 Scope* block_scope = NewScope(scope_, BLOCK_SCOPE); | 4424 Scope* block_scope = NewScope(scope_, BLOCK_SCOPE); |
4428 block_scope->tag_as_class_scope(); | |
4429 BlockState block_state(&scope_, block_scope); | 4425 BlockState block_state(&scope_, block_scope); |
4430 scope_->SetLanguageMode( | 4426 scope_->SetLanguageMode( |
4431 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); | 4427 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); |
4432 scope_->SetScopeName(name); | 4428 scope_->SetScopeName(name); |
4433 | 4429 |
4434 VariableProxy* proxy = NULL; | 4430 VariableProxy* proxy = NULL; |
4435 if (name != NULL) { | 4431 if (name != NULL) { |
4436 proxy = NewUnresolved(name, CONST); | 4432 proxy = NewUnresolved(name, CONST); |
4437 const bool is_class_declaration = true; | 4433 const bool is_class_declaration = true; |
4438 Declaration* declaration = factory()->NewVariableDeclaration( | 4434 Declaration* declaration = factory()->NewVariableDeclaration( |
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5905 Expression* Parser::SpreadCallNew(Expression* function, | 5901 Expression* Parser::SpreadCallNew(Expression* function, |
5906 ZoneList<v8::internal::Expression*>* args, | 5902 ZoneList<v8::internal::Expression*>* args, |
5907 int pos) { | 5903 int pos) { |
5908 args->InsertAt(0, function, zone()); | 5904 args->InsertAt(0, function, zone()); |
5909 | 5905 |
5910 return factory()->NewCallRuntime( | 5906 return factory()->NewCallRuntime( |
5911 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5907 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
5912 } | 5908 } |
5913 } // namespace internal | 5909 } // namespace internal |
5914 } // namespace v8 | 5910 } // namespace v8 |
OLD | NEW |