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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/func-name-inferrer.h" | 10 #include "src/func-name-inferrer.h" |
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1225 static PreParserExpression ExpressionFromIdentifier( | 1225 static PreParserExpression ExpressionFromIdentifier( |
1226 PreParserIdentifier name, int pos, PreParserScope* scope, | 1226 PreParserIdentifier name, int pos, PreParserScope* scope, |
1227 PreParserFactory* factory) { | 1227 PreParserFactory* factory) { |
1228 return PreParserExpression::FromIdentifier(name); | 1228 return PreParserExpression::FromIdentifier(name); |
1229 } | 1229 } |
1230 | 1230 |
1231 PreParserExpression ExpressionFromString(int pos, | 1231 PreParserExpression ExpressionFromString(int pos, |
1232 Scanner* scanner, | 1232 Scanner* scanner, |
1233 PreParserFactory* factory = NULL); | 1233 PreParserFactory* factory = NULL); |
1234 | 1234 |
| 1235 PreParserExpression GetIterator(PreParserExpression iterable, |
| 1236 PreParserFactory* factory) { |
| 1237 return PreParserExpression::Default(); |
| 1238 } |
| 1239 |
1235 static PreParserExpressionList NewExpressionList(int size, void* zone) { | 1240 static PreParserExpressionList NewExpressionList(int size, void* zone) { |
1236 return PreParserExpressionList(); | 1241 return PreParserExpressionList(); |
1237 } | 1242 } |
1238 | 1243 |
1239 static PreParserStatementList NewStatementList(int size, void* zone) { | 1244 static PreParserStatementList NewStatementList(int size, void* zone) { |
1240 return PreParserStatementList(); | 1245 return PreParserStatementList(); |
1241 } | 1246 } |
1242 | 1247 |
1243 static PreParserExpressionList NewPropertyList(int size, void* zone) { | 1248 static PreParserExpressionList NewPropertyList(int size, void* zone) { |
1244 return PreParserExpressionList(); | 1249 return PreParserExpressionList(); |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 // a Yield::SUSPEND operation, given only one look-ahead token. | 2092 // a Yield::SUSPEND operation, given only one look-ahead token. |
2088 if (kind == Yield::SUSPEND) | 2093 if (kind == Yield::SUSPEND) |
2089 break; | 2094 break; |
2090 DCHECK(kind == Yield::DELEGATING); | 2095 DCHECK(kind == Yield::DELEGATING); |
2091 // Delegating yields require an RHS; fall through. | 2096 // Delegating yields require an RHS; fall through. |
2092 default: | 2097 default: |
2093 expression = ParseAssignmentExpression(false, CHECK_OK); | 2098 expression = ParseAssignmentExpression(false, CHECK_OK); |
2094 break; | 2099 break; |
2095 } | 2100 } |
2096 } | 2101 } |
| 2102 if (kind == Yield::DELEGATING) { |
| 2103 // var iterator = subject[Symbol.iterator](); |
| 2104 expression = this->GetIterator(expression, factory()); |
| 2105 } |
2097 typename Traits::Type::YieldExpression yield = | 2106 typename Traits::Type::YieldExpression yield = |
2098 factory()->NewYield(generator_object, expression, kind, pos); | 2107 factory()->NewYield(generator_object, expression, kind, pos); |
2099 if (kind == Yield::DELEGATING) { | 2108 if (kind == Yield::DELEGATING) { |
2100 yield->set_index(function_state_->NextHandlerIndex()); | 2109 yield->set_index(function_state_->NextHandlerIndex()); |
2101 } | 2110 } |
2102 return yield; | 2111 return yield; |
2103 } | 2112 } |
2104 | 2113 |
2105 | 2114 |
2106 // Precedence = 3 | 2115 // Precedence = 3 |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 parser()->ReportMessage("accessor_get_set"); | 2628 parser()->ReportMessage("accessor_get_set"); |
2620 } | 2629 } |
2621 *ok = false; | 2630 *ok = false; |
2622 } | 2631 } |
2623 } | 2632 } |
2624 | 2633 |
2625 | 2634 |
2626 } } // v8::internal | 2635 } } // v8::internal |
2627 | 2636 |
2628 #endif // V8_PREPARSER_H | 2637 #endif // V8_PREPARSER_H |
OLD | NEW |