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_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_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 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 DCHECK_EQ(Yield::kDelegating, kind); | 2139 DCHECK_EQ(Yield::kDelegating, kind); |
2140 // Delegating yields require an RHS; fall through. | 2140 // Delegating yields require an RHS; fall through. |
2141 default: | 2141 default: |
2142 expression = ParseAssignmentExpression(false, classifier, CHECK_OK); | 2142 expression = ParseAssignmentExpression(false, classifier, CHECK_OK); |
2143 expression = | 2143 expression = |
2144 Traits::RewriteNonPattern(expression, classifier, CHECK_OK); | 2144 Traits::RewriteNonPattern(expression, classifier, CHECK_OK); |
2145 break; | 2145 break; |
2146 } | 2146 } |
2147 } | 2147 } |
2148 if (kind == Yield::kDelegating) { | 2148 if (kind == Yield::kDelegating) { |
2149 // var iterator = subject[Symbol.iterator](); | 2149 return Traits::RewriteYieldStar(generator_object, expression, pos); |
2150 // Hackily disambiguate o from o.next and o [Symbol.iterator](). | |
2151 // TODO(verwaest): Come up with a better solution. | |
2152 expression = this->GetIterator(expression, factory(), pos + 1); | |
2153 } | 2150 } |
2154 // Hackily disambiguate o from o.next and o [Symbol.iterator](). | 2151 // Hackily disambiguate o from o.next and o [Symbol.iterator](). |
2155 // TODO(verwaest): Come up with a better solution. | 2152 // TODO(verwaest): Come up with a better solution. |
2156 typename Traits::Type::YieldExpression yield = | 2153 typename Traits::Type::YieldExpression yield = |
2157 factory()->NewYield(generator_object, expression, kind, pos); | 2154 factory()->NewYield(generator_object, expression, kind, pos); |
2158 return yield; | 2155 return yield; |
2159 } | 2156 } |
2160 | 2157 |
2161 | 2158 |
2162 // Precedence = 3 | 2159 // Precedence = 3 |
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3364 return; | 3361 return; |
3365 } | 3362 } |
3366 has_seen_constructor_ = true; | 3363 has_seen_constructor_ = true; |
3367 return; | 3364 return; |
3368 } | 3365 } |
3369 } | 3366 } |
3370 } // namespace internal | 3367 } // namespace internal |
3371 } // namespace v8 | 3368 } // namespace v8 |
3372 | 3369 |
3373 #endif // V8_PARSING_PARSER_BASE_H | 3370 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |