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 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 // | 2050 // |
2051 // because the var declaration is hoisted to the function scope where 'x' | 2051 // because the var declaration is hoisted to the function scope where 'x' |
2052 // is already bound. | 2052 // is already bound. |
2053 DCHECK(IsDeclaredVariableMode(var->mode())); | 2053 DCHECK(IsDeclaredVariableMode(var->mode())); |
2054 if (is_strict(language_mode()) || allow_harmony_sloppy()) { | 2054 if (is_strict(language_mode()) || allow_harmony_sloppy()) { |
2055 // In harmony we treat re-declarations as early errors. See | 2055 // In harmony we treat re-declarations as early errors. See |
2056 // ES5 16 for a definition of early errors. | 2056 // ES5 16 for a definition of early errors. |
2057 if (declaration_kind == DeclarationDescriptor::NORMAL) { | 2057 if (declaration_kind == DeclarationDescriptor::NORMAL) { |
2058 ParserTraits::ReportMessage(MessageTemplate::kVarRedeclaration, name); | 2058 ParserTraits::ReportMessage(MessageTemplate::kVarRedeclaration, name); |
2059 } else { | 2059 } else { |
2060 ParserTraits::ReportMessage(MessageTemplate::kStrictParamDupe); | 2060 ParserTraits::ReportMessage(MessageTemplate::kParamDupe); |
2061 } | 2061 } |
2062 *ok = false; | 2062 *ok = false; |
2063 return nullptr; | 2063 return nullptr; |
2064 } | 2064 } |
2065 Expression* expression = NewThrowSyntaxError( | 2065 Expression* expression = NewThrowSyntaxError( |
2066 MessageTemplate::kVarRedeclaration, name, declaration->position()); | 2066 MessageTemplate::kVarRedeclaration, name, declaration->position()); |
2067 declaration_scope->SetIllegalRedeclaration(expression); | 2067 declaration_scope->SetIllegalRedeclaration(expression); |
2068 } else if (mode == VAR) { | 2068 } else if (mode == VAR) { |
2069 var->set_maybe_assigned(); | 2069 var->set_maybe_assigned(); |
2070 } | 2070 } |
(...skipping 3878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5949 Expression* Parser::SpreadCallNew(Expression* function, | 5949 Expression* Parser::SpreadCallNew(Expression* function, |
5950 ZoneList<v8::internal::Expression*>* args, | 5950 ZoneList<v8::internal::Expression*>* args, |
5951 int pos) { | 5951 int pos) { |
5952 args->InsertAt(0, function, zone()); | 5952 args->InsertAt(0, function, zone()); |
5953 | 5953 |
5954 return factory()->NewCallRuntime( | 5954 return factory()->NewCallRuntime( |
5955 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5955 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
5956 } | 5956 } |
5957 } // namespace internal | 5957 } // namespace internal |
5958 } // namespace v8 | 5958 } // namespace v8 |
OLD | NEW |