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 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2546 const AstRawString* single_name = | 2546 const AstRawString* single_name = |
2547 pattern->IsVariableProxy() ? pattern->AsVariableProxy()->raw_name() | 2547 pattern->IsVariableProxy() ? pattern->AsVariableProxy()->raw_name() |
2548 : nullptr; | 2548 : nullptr; |
2549 if (single_name != nullptr) { | 2549 if (single_name != nullptr) { |
2550 if (fni_ != NULL) fni_->PushVariableName(single_name); | 2550 if (fni_ != NULL) fni_->PushVariableName(single_name); |
2551 } | 2551 } |
2552 | 2552 |
2553 is_for_iteration_variable = | 2553 is_for_iteration_variable = |
2554 var_context == kForStatement && | 2554 var_context == kForStatement && |
2555 (peek() == Token::IN || PeekContextualKeyword(CStrVector("of"))); | 2555 (peek() == Token::IN || PeekContextualKeyword(CStrVector("of"))); |
2556 if (is_for_iteration_variable && parsing_result->descriptor.mode == CONST) { | 2556 if (is_for_iteration_variable && |
| 2557 (parsing_result->descriptor.mode == CONST || |
| 2558 parsing_result->descriptor.mode == CONST_LEGACY)) { |
2557 parsing_result->descriptor.needs_init = false; | 2559 parsing_result->descriptor.needs_init = false; |
2558 } | 2560 } |
2559 | 2561 |
2560 Expression* value = NULL; | 2562 Expression* value = NULL; |
2561 // Harmony consts have non-optional initializers. | 2563 // Harmony consts have non-optional initializers. |
2562 int initializer_position = RelocInfo::kNoPosition; | 2564 int initializer_position = RelocInfo::kNoPosition; |
2563 if (peek() == Token::ASSIGN || (parsing_result->descriptor.mode == CONST && | 2565 if (peek() == Token::ASSIGN || (parsing_result->descriptor.mode == CONST && |
2564 !is_for_iteration_variable)) { | 2566 !is_for_iteration_variable)) { |
2565 Expect(Token::ASSIGN, ok); | 2567 Expect(Token::ASSIGN, ok); |
2566 if (!*ok) return; | 2568 if (!*ok) return; |
(...skipping 3752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6319 | 6321 |
6320 Expression* Parser::SpreadCallNew(Expression* function, | 6322 Expression* Parser::SpreadCallNew(Expression* function, |
6321 ZoneList<v8::internal::Expression*>* args, | 6323 ZoneList<v8::internal::Expression*>* args, |
6322 int pos) { | 6324 int pos) { |
6323 args->InsertAt(0, function, zone()); | 6325 args->InsertAt(0, function, zone()); |
6324 | 6326 |
6325 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); | 6327 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); |
6326 } | 6328 } |
6327 } // namespace internal | 6329 } // namespace internal |
6328 } // namespace v8 | 6330 } // namespace v8 |
OLD | NEW |