| 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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
| (...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 NativeFunctionLiteral* lit = | 1638 NativeFunctionLiteral* lit = |
| 1639 factory()->NewNativeFunctionLiteral(name, extension_, kNoSourcePosition); | 1639 factory()->NewNativeFunctionLiteral(name, extension_, kNoSourcePosition); |
| 1640 return factory()->NewExpressionStatement( | 1640 return factory()->NewExpressionStatement( |
| 1641 factory()->NewAssignment(Token::INIT, decl->proxy(), lit, | 1641 factory()->NewAssignment(Token::INIT, decl->proxy(), lit, |
| 1642 kNoSourcePosition), | 1642 kNoSourcePosition), |
| 1643 pos); | 1643 pos); |
| 1644 } | 1644 } |
| 1645 | 1645 |
| 1646 ZoneList<const AstRawString*>* Parser::DeclareLabel( | 1646 ZoneList<const AstRawString*>* Parser::DeclareLabel( |
| 1647 ZoneList<const AstRawString*>* labels, VariableProxy* var, bool* ok) { | 1647 ZoneList<const AstRawString*>* labels, VariableProxy* var, bool* ok) { |
| 1648 DCHECK(IsIdentifier(var)); |
| 1648 const AstRawString* label = var->raw_name(); | 1649 const AstRawString* label = var->raw_name(); |
| 1649 // TODO(1240780): We don't check for redeclaration of labels | 1650 // TODO(1240780): We don't check for redeclaration of labels |
| 1650 // during preparsing since keeping track of the set of active | 1651 // during preparsing since keeping track of the set of active |
| 1651 // labels requires nontrivial changes to the way scopes are | 1652 // labels requires nontrivial changes to the way scopes are |
| 1652 // structured. However, these are probably changes we want to | 1653 // structured. However, these are probably changes we want to |
| 1653 // make later anyway so we should go back and fix this then. | 1654 // make later anyway so we should go back and fix this then. |
| 1654 if (ContainsLabel(labels, label) || TargetStackContainsLabel(label)) { | 1655 if (ContainsLabel(labels, label) || TargetStackContainsLabel(label)) { |
| 1655 ReportMessage(MessageTemplate::kLabelRedeclaration, label); | 1656 ReportMessage(MessageTemplate::kLabelRedeclaration, label); |
| 1656 *ok = false; | 1657 *ok = false; |
| 1657 return nullptr; | 1658 return nullptr; |
| (...skipping 3842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5500 | 5501 |
| 5501 return final_loop; | 5502 return final_loop; |
| 5502 } | 5503 } |
| 5503 | 5504 |
| 5504 #undef CHECK_OK | 5505 #undef CHECK_OK |
| 5505 #undef CHECK_OK_VOID | 5506 #undef CHECK_OK_VOID |
| 5506 #undef CHECK_FAILED | 5507 #undef CHECK_FAILED |
| 5507 | 5508 |
| 5508 } // namespace internal | 5509 } // namespace internal |
| 5509 } // namespace v8 | 5510 } // namespace v8 |
| OLD | NEW |