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 #ifndef V8_PARSING_PREPARSER_H | 5 #ifndef V8_PARSING_PREPARSER_H |
6 #define V8_PARSING_PREPARSER_H | 6 #define V8_PARSING_PREPARSER_H |
7 | 7 |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 PreParserIdentifier name, int start_position, int end_position, | 1638 PreParserIdentifier name, int start_position, int end_position, |
1639 Scope* scope, PreParserFactory* factory) { | 1639 Scope* scope, PreParserFactory* factory) { |
1640 return PreParserExpression::FromIdentifier(name); | 1640 return PreParserExpression::FromIdentifier(name); |
1641 } | 1641 } |
1642 | 1642 |
1643 PreParserExpression ExpressionFromString(int pos, | 1643 PreParserExpression ExpressionFromString(int pos, |
1644 Scanner* scanner, | 1644 Scanner* scanner, |
1645 PreParserFactory* factory = NULL); | 1645 PreParserFactory* factory = NULL); |
1646 | 1646 |
1647 PreParserExpression GetIterator(PreParserExpression iterable, | 1647 PreParserExpression GetIterator(PreParserExpression iterable, |
1648 PreParserFactory* factory) { | 1648 PreParserFactory* factory, int pos) { |
1649 return PreParserExpression::Default(); | 1649 return PreParserExpression::Default(); |
1650 } | 1650 } |
1651 | 1651 |
1652 static PreParserExpressionList NewExpressionList(int size, Zone* zone) { | 1652 static PreParserExpressionList NewExpressionList(int size, Zone* zone) { |
1653 return PreParserExpressionList(); | 1653 return PreParserExpressionList(); |
1654 } | 1654 } |
1655 | 1655 |
1656 static PreParserStatementList NewStatementList(int size, Zone* zone) { | 1656 static PreParserStatementList NewStatementList(int size, Zone* zone) { |
1657 return PreParserStatementList(); | 1657 return PreParserStatementList(); |
1658 } | 1658 } |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3113 break; | 3113 break; |
3114 DCHECK_EQ(Yield::kDelegating, kind); | 3114 DCHECK_EQ(Yield::kDelegating, kind); |
3115 // Delegating yields require an RHS; fall through. | 3115 // Delegating yields require an RHS; fall through. |
3116 default: | 3116 default: |
3117 expression = ParseAssignmentExpression(false, classifier, CHECK_OK); | 3117 expression = ParseAssignmentExpression(false, classifier, CHECK_OK); |
3118 break; | 3118 break; |
3119 } | 3119 } |
3120 } | 3120 } |
3121 if (kind == Yield::kDelegating) { | 3121 if (kind == Yield::kDelegating) { |
3122 // var iterator = subject[Symbol.iterator](); | 3122 // var iterator = subject[Symbol.iterator](); |
3123 expression = this->GetIterator(expression, factory()); | 3123 // Hackily disambiguate o from o.next and o [Symbol.iterator](). |
| 3124 // TODO(verwaest): Come up with a better solution. |
| 3125 expression = this->GetIterator(expression, factory(), pos + 1); |
3124 } | 3126 } |
| 3127 // Hackily disambiguate o from o.next and o [Symbol.iterator](). |
| 3128 // TODO(verwaest): Come up with a better solution. |
3125 typename Traits::Type::YieldExpression yield = | 3129 typename Traits::Type::YieldExpression yield = |
3126 factory()->NewYield(generator_object, expression, kind, pos); | 3130 factory()->NewYield(generator_object, expression, kind, pos); |
3127 return yield; | 3131 return yield; |
3128 } | 3132 } |
3129 | 3133 |
3130 | 3134 |
3131 // Precedence = 3 | 3135 // Precedence = 3 |
3132 template <class Traits> | 3136 template <class Traits> |
3133 typename ParserBase<Traits>::ExpressionT | 3137 typename ParserBase<Traits>::ExpressionT |
3134 ParserBase<Traits>::ParseConditionalExpression(bool accept_IN, | 3138 ParserBase<Traits>::ParseConditionalExpression(bool accept_IN, |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4255 return; | 4259 return; |
4256 } | 4260 } |
4257 has_seen_constructor_ = true; | 4261 has_seen_constructor_ = true; |
4258 return; | 4262 return; |
4259 } | 4263 } |
4260 } | 4264 } |
4261 } // namespace internal | 4265 } // namespace internal |
4262 } // namespace v8 | 4266 } // namespace v8 |
4263 | 4267 |
4264 #endif // V8_PARSING_PREPARSER_H | 4268 #endif // V8_PARSING_PREPARSER_H |
OLD | NEW |