Chromium Code Reviews| 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/bailout-reason.h" | 8 #include "src/bailout-reason.h" |
| 9 #include "src/expression-classifier.h" | 9 #include "src/expression-classifier.h" |
| 10 #include "src/func-name-inferrer.h" | 10 #include "src/func-name-inferrer.h" |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 677 ExpressionClassifier* classifier, bool* ok); | 677 ExpressionClassifier* classifier, bool* ok); |
| 678 | 678 |
| 679 ExpressionT ParsePrimaryExpression(ExpressionClassifier* classifier, | 679 ExpressionT ParsePrimaryExpression(ExpressionClassifier* classifier, |
| 680 bool* ok); | 680 bool* ok); |
| 681 ExpressionT ParseExpression(bool accept_IN, bool* ok); | 681 ExpressionT ParseExpression(bool accept_IN, bool* ok); |
| 682 ExpressionT ParseExpression(bool accept_IN, ExpressionClassifier* classifier, | 682 ExpressionT ParseExpression(bool accept_IN, ExpressionClassifier* classifier, |
| 683 bool* ok); | 683 bool* ok); |
| 684 ExpressionT ParseArrayLiteral(ExpressionClassifier* classifier, bool* ok); | 684 ExpressionT ParseArrayLiteral(ExpressionClassifier* classifier, bool* ok); |
| 685 ExpressionT ParsePropertyName(IdentifierT* name, bool* is_get, bool* is_set, | 685 ExpressionT ParsePropertyName(IdentifierT* name, bool* is_get, bool* is_set, |
| 686 bool* is_static, bool* is_computed_name, | 686 bool* is_static, bool* is_computed_name, |
| 687 bool* is_identifier, bool* is_escaped_keyword, | |
| 687 ExpressionClassifier* classifier, bool* ok); | 688 ExpressionClassifier* classifier, bool* ok); |
| 688 ExpressionT ParseObjectLiteral(ExpressionClassifier* classifier, bool* ok); | 689 ExpressionT ParseObjectLiteral(ExpressionClassifier* classifier, bool* ok); |
| 689 ObjectLiteralPropertyT ParsePropertyDefinition( | 690 ObjectLiteralPropertyT ParsePropertyDefinition( |
| 690 ObjectLiteralCheckerBase* checker, bool in_class, bool has_extends, | 691 ObjectLiteralCheckerBase* checker, bool in_class, bool has_extends, |
| 691 bool is_static, bool* is_computed_name, bool* has_seen_constructor, | 692 bool is_static, bool* is_computed_name, bool* has_seen_constructor, |
| 692 ExpressionClassifier* classifier, bool* ok); | 693 ExpressionClassifier* classifier, bool* ok); |
| 693 typename Traits::Type::ExpressionList ParseArguments( | 694 typename Traits::Type::ExpressionList ParseArguments( |
| 694 Scanner::Location* first_spread_pos, ExpressionClassifier* classifier, | 695 Scanner::Location* first_spread_pos, ExpressionClassifier* classifier, |
| 695 bool* ok); | 696 bool* ok); |
| 696 ExpressionT ParseAssignmentExpression(bool accept_IN, | 697 ExpressionT ParseAssignmentExpression(bool accept_IN, |
| (...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2009 *message = is_strict(language_mode()) | 2010 *message = is_strict(language_mode()) |
| 2010 ? MessageTemplate::kUnexpectedStrictReserved | 2011 ? MessageTemplate::kUnexpectedStrictReserved |
| 2011 : MessageTemplate::kUnexpectedTokenIdentifier; | 2012 : MessageTemplate::kUnexpectedTokenIdentifier; |
| 2012 *arg = nullptr; | 2013 *arg = nullptr; |
| 2013 break; | 2014 break; |
| 2014 case Token::TEMPLATE_SPAN: | 2015 case Token::TEMPLATE_SPAN: |
| 2015 case Token::TEMPLATE_TAIL: | 2016 case Token::TEMPLATE_TAIL: |
| 2016 *message = MessageTemplate::kUnexpectedTemplateString; | 2017 *message = MessageTemplate::kUnexpectedTemplateString; |
| 2017 *arg = nullptr; | 2018 *arg = nullptr; |
| 2018 break; | 2019 break; |
| 2020 case Token::ESCAPED_STRICT_RESERVED_WORD: | |
| 2021 case Token::ESCAPED_KEYWORD: | |
| 2022 *message = MessageTemplate::kInvalidEscapedReservedWord; | |
| 2023 *arg = nullptr; | |
| 2024 break; | |
| 2019 default: | 2025 default: |
| 2020 const char* name = Token::String(token); | 2026 const char* name = Token::String(token); |
| 2021 DCHECK(name != NULL); | 2027 DCHECK(name != NULL); |
| 2022 *arg = name; | 2028 *arg = name; |
| 2023 break; | 2029 break; |
| 2024 } | 2030 } |
| 2025 } | 2031 } |
| 2026 | 2032 |
| 2027 | 2033 |
| 2028 template <class Traits> | 2034 template <class Traits> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2060 | 2066 |
| 2061 return result; | 2067 return result; |
| 2062 } | 2068 } |
| 2063 | 2069 |
| 2064 | 2070 |
| 2065 template <class Traits> | 2071 template <class Traits> |
| 2066 typename ParserBase<Traits>::IdentifierT | 2072 typename ParserBase<Traits>::IdentifierT |
| 2067 ParserBase<Traits>::ParseAndClassifyIdentifier(ExpressionClassifier* classifier, | 2073 ParserBase<Traits>::ParseAndClassifyIdentifier(ExpressionClassifier* classifier, |
| 2068 bool* ok) { | 2074 bool* ok) { |
| 2069 Token::Value next = Next(); | 2075 Token::Value next = Next(); |
| 2076 if (next == Token::ESCAPED_STRICT_RESERVED_WORD) { | |
| 2077 if (is_strict(language_mode())) { | |
| 2078 ReportUnexpectedToken(next); | |
| 2079 *ok = false; | |
| 2080 return Traits::EmptyIdentifier(); | |
| 2081 } | |
| 2082 next = Token::IDENTIFIER; | |
| 2083 } | |
| 2070 if (next == Token::IDENTIFIER) { | 2084 if (next == Token::IDENTIFIER) { |
| 2071 IdentifierT name = this->GetSymbol(scanner()); | 2085 IdentifierT name = this->GetSymbol(scanner()); |
| 2072 // When this function is used to read a formal parameter, we don't always | 2086 // When this function is used to read a formal parameter, we don't always |
| 2073 // know whether the function is going to be strict or sloppy. Indeed for | 2087 // know whether the function is going to be strict or sloppy. Indeed for |
| 2074 // arrow functions we don't always know that the identifier we are reading | 2088 // arrow functions we don't always know that the identifier we are reading |
| 2075 // is actually a formal parameter. Therefore besides the errors that we | 2089 // is actually a formal parameter. Therefore besides the errors that we |
| 2076 // must detect because we know we're in strict mode, we also record any | 2090 // must detect because we know we're in strict mode, we also record any |
| 2077 // error that we might make in the future once we know the language mode. | 2091 // error that we might make in the future once we know the language mode. |
| 2078 if (this->IsEval(name)) { | 2092 if (this->IsEval(name)) { |
| 2079 classifier->RecordStrictModeFormalParameterError( | 2093 classifier->RecordStrictModeFormalParameterError( |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2154 return name; | 2168 return name; |
| 2155 } | 2169 } |
| 2156 | 2170 |
| 2157 | 2171 |
| 2158 template <class Traits> | 2172 template <class Traits> |
| 2159 typename ParserBase<Traits>::IdentifierT | 2173 typename ParserBase<Traits>::IdentifierT |
| 2160 ParserBase<Traits>::ParseIdentifierName(bool* ok) { | 2174 ParserBase<Traits>::ParseIdentifierName(bool* ok) { |
| 2161 Token::Value next = Next(); | 2175 Token::Value next = Next(); |
| 2162 if (next != Token::IDENTIFIER && next != Token::FUTURE_RESERVED_WORD && | 2176 if (next != Token::IDENTIFIER && next != Token::FUTURE_RESERVED_WORD && |
| 2163 next != Token::LET && next != Token::STATIC && next != Token::YIELD && | 2177 next != Token::LET && next != Token::STATIC && next != Token::YIELD && |
| 2164 next != Token::FUTURE_STRICT_RESERVED_WORD && !Token::IsKeyword(next)) { | 2178 next != Token::FUTURE_STRICT_RESERVED_WORD && |
| 2179 next != Token::ESCAPED_KEYWORD && | |
| 2180 next != Token::ESCAPED_STRICT_RESERVED_WORD && !Token::IsKeyword(next)) { | |
| 2165 this->ReportUnexpectedToken(next); | 2181 this->ReportUnexpectedToken(next); |
| 2166 *ok = false; | 2182 *ok = false; |
| 2167 return Traits::EmptyIdentifier(); | 2183 return Traits::EmptyIdentifier(); |
| 2168 } | 2184 } |
| 2169 | 2185 |
| 2170 IdentifierT name = this->GetSymbol(scanner()); | 2186 IdentifierT name = this->GetSymbol(scanner()); |
| 2171 if (this->IsArguments(name)) scope_->RecordArgumentsUsage(); | 2187 if (this->IsArguments(name)) scope_->RecordArgumentsUsage(); |
| 2172 return name; | 2188 return name; |
| 2173 } | 2189 } |
| 2174 | 2190 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2281 scanner()->peek_location(), MessageTemplate::kUnexpectedTokenNumber); | 2297 scanner()->peek_location(), MessageTemplate::kUnexpectedTokenNumber); |
| 2282 Next(); | 2298 Next(); |
| 2283 result = | 2299 result = |
| 2284 this->ExpressionFromLiteral(token, beg_pos, scanner(), factory()); | 2300 this->ExpressionFromLiteral(token, beg_pos, scanner(), factory()); |
| 2285 break; | 2301 break; |
| 2286 | 2302 |
| 2287 case Token::IDENTIFIER: | 2303 case Token::IDENTIFIER: |
| 2288 case Token::LET: | 2304 case Token::LET: |
| 2289 case Token::STATIC: | 2305 case Token::STATIC: |
| 2290 case Token::YIELD: | 2306 case Token::YIELD: |
| 2307 case Token::ESCAPED_STRICT_RESERVED_WORD: | |
| 2291 case Token::FUTURE_STRICT_RESERVED_WORD: { | 2308 case Token::FUTURE_STRICT_RESERVED_WORD: { |
| 2292 // Using eval or arguments in this context is OK even in strict mode. | 2309 // Using eval or arguments in this context is OK even in strict mode. |
| 2293 IdentifierT name = ParseAndClassifyIdentifier(classifier, CHECK_OK); | 2310 IdentifierT name = ParseAndClassifyIdentifier(classifier, CHECK_OK); |
| 2294 result = this->ExpressionFromIdentifier(name, beg_pos, end_pos, scope_, | 2311 result = this->ExpressionFromIdentifier(name, beg_pos, end_pos, scope_, |
| 2295 factory()); | 2312 factory()); |
| 2296 break; | 2313 break; |
| 2297 } | 2314 } |
| 2298 | 2315 |
| 2299 case Token::STRING: { | 2316 case Token::STRING: { |
| 2300 classifier->RecordBindingPatternError( | 2317 classifier->RecordBindingPatternError( |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2556 // Update the scope information before the pre-parsing bailout. | 2573 // Update the scope information before the pre-parsing bailout. |
| 2557 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 2574 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
| 2558 | 2575 |
| 2559 return factory()->NewArrayLiteral(values, first_spread_index, literal_index, | 2576 return factory()->NewArrayLiteral(values, first_spread_index, literal_index, |
| 2560 is_strong(language_mode()), pos); | 2577 is_strong(language_mode()), pos); |
| 2561 } | 2578 } |
| 2562 | 2579 |
| 2563 | 2580 |
| 2564 template <class Traits> | 2581 template <class Traits> |
| 2565 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( | 2582 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( |
| 2566 IdentifierT* name, bool* is_get, bool* is_set, bool* is_static, | 2583 IdentifierT* name, bool* is_get, bool* is_set, bool* is_static, |
|
rossberg
2015/11/06 13:31:05
There are so many flags now that it's worth turnin
caitp (gmail)
2015/11/06 16:10:30
I've started to do this, but it's a pretty substan
| |
| 2567 bool* is_computed_name, ExpressionClassifier* classifier, bool* ok) { | 2584 bool* is_computed_name, bool* is_identifier, bool* is_escaped_keyword, |
| 2585 ExpressionClassifier* classifier, bool* ok) { | |
| 2568 Token::Value token = peek(); | 2586 Token::Value token = peek(); |
| 2569 int pos = peek_position(); | 2587 int pos = peek_position(); |
| 2570 | 2588 |
| 2571 // For non computed property names we normalize the name a bit: | 2589 // For non computed property names we normalize the name a bit: |
| 2572 // | 2590 // |
| 2573 // "12" -> 12 | 2591 // "12" -> 12 |
| 2574 // 12.3 -> "12.3" | 2592 // 12.3 -> "12.3" |
| 2575 // 12.30 -> "12.3" | 2593 // 12.30 -> "12.3" |
| 2576 // identifier -> "identifier" | 2594 // identifier -> "identifier" |
| 2577 // | 2595 // |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 2598 Consume(Token::LBRACK); | 2616 Consume(Token::LBRACK); |
| 2599 ExpressionClassifier computed_name_classifier; | 2617 ExpressionClassifier computed_name_classifier; |
| 2600 ExpressionT expression = | 2618 ExpressionT expression = |
| 2601 ParseAssignmentExpression(true, &computed_name_classifier, CHECK_OK); | 2619 ParseAssignmentExpression(true, &computed_name_classifier, CHECK_OK); |
| 2602 classifier->Accumulate(computed_name_classifier, | 2620 classifier->Accumulate(computed_name_classifier, |
| 2603 ExpressionClassifier::ExpressionProductions); | 2621 ExpressionClassifier::ExpressionProductions); |
| 2604 Expect(Token::RBRACK, CHECK_OK); | 2622 Expect(Token::RBRACK, CHECK_OK); |
| 2605 return expression; | 2623 return expression; |
| 2606 } | 2624 } |
| 2607 | 2625 |
| 2626 case Token::ESCAPED_KEYWORD: | |
| 2627 *is_escaped_keyword = true; | |
| 2628 *is_identifier = true; | |
|
rossberg
2015/11/06 13:31:04
Why does an escaped keyword qualify as an identifi
caitp (gmail)
2015/11/06 16:10:30
Yeah, I guess --- the thing is, the error is only
| |
| 2629 *name = ParseIdentifierNameOrGetOrSet(is_get, is_set, CHECK_OK); | |
| 2630 break; | |
| 2631 | |
| 2608 case Token::STATIC: | 2632 case Token::STATIC: |
| 2609 *is_static = true; | 2633 *is_static = true; |
| 2610 | 2634 |
| 2611 // Fall through. | 2635 // Fall through. |
| 2612 default: | 2636 default: |
| 2637 *is_identifier = true; | |
| 2613 *name = ParseIdentifierNameOrGetOrSet(is_get, is_set, CHECK_OK); | 2638 *name = ParseIdentifierNameOrGetOrSet(is_get, is_set, CHECK_OK); |
| 2614 break; | 2639 break; |
| 2615 } | 2640 } |
| 2616 | 2641 |
| 2617 uint32_t index; | 2642 uint32_t index; |
| 2618 return this->IsArrayIndex(*name, &index) | 2643 return this->IsArrayIndex(*name, &index) |
| 2619 ? factory()->NewNumberLiteral(index, pos) | 2644 ? factory()->NewNumberLiteral(index, pos) |
| 2620 : factory()->NewStringLiteral(*name, pos); | 2645 : factory()->NewStringLiteral(*name, pos); |
| 2621 } | 2646 } |
| 2622 | 2647 |
| 2623 | 2648 |
| 2624 template <class Traits> | 2649 template <class Traits> |
| 2625 typename ParserBase<Traits>::ObjectLiteralPropertyT | 2650 typename ParserBase<Traits>::ObjectLiteralPropertyT |
| 2626 ParserBase<Traits>::ParsePropertyDefinition( | 2651 ParserBase<Traits>::ParsePropertyDefinition( |
| 2627 ObjectLiteralCheckerBase* checker, bool in_class, bool has_extends, | 2652 ObjectLiteralCheckerBase* checker, bool in_class, bool has_extends, |
| 2628 bool is_static, bool* is_computed_name, bool* has_seen_constructor, | 2653 bool is_static, bool* is_computed_name, bool* has_seen_constructor, |
| 2629 ExpressionClassifier* classifier, bool* ok) { | 2654 ExpressionClassifier* classifier, bool* ok) { |
| 2630 DCHECK(!in_class || is_static || has_seen_constructor != nullptr); | 2655 DCHECK(!in_class || is_static || has_seen_constructor != nullptr); |
| 2631 ExpressionT value = this->EmptyExpression(); | 2656 ExpressionT value = this->EmptyExpression(); |
| 2632 IdentifierT name = this->EmptyIdentifier(); | 2657 IdentifierT name = this->EmptyIdentifier(); |
| 2633 bool is_get = false; | 2658 bool is_get = false; |
| 2634 bool is_set = false; | 2659 bool is_set = false; |
| 2635 bool name_is_static = false; | 2660 bool name_is_static = false; |
| 2636 bool is_generator = Check(Token::MUL); | 2661 bool is_generator = Check(Token::MUL); |
| 2637 | 2662 |
| 2638 Token::Value name_token = peek(); | 2663 Token::Value name_token = peek(); |
| 2639 int next_beg_pos = scanner()->peek_location().beg_pos; | 2664 int next_beg_pos = scanner()->peek_location().beg_pos; |
| 2640 int next_end_pos = scanner()->peek_location().end_pos; | 2665 int next_end_pos = scanner()->peek_location().end_pos; |
| 2666 bool is_identifier = false; | |
| 2667 bool is_escaped_keyword = false; | |
| 2641 ExpressionT name_expression = ParsePropertyName( | 2668 ExpressionT name_expression = ParsePropertyName( |
| 2642 &name, &is_get, &is_set, &name_is_static, is_computed_name, classifier, | 2669 &name, &is_get, &is_set, &name_is_static, is_computed_name, |
| 2670 &is_identifier, &is_escaped_keyword, classifier, | |
| 2643 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2671 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2644 | 2672 |
| 2645 if (fni_ != nullptr && !*is_computed_name) { | 2673 if (fni_ != nullptr && !*is_computed_name) { |
| 2646 this->PushLiteralName(fni_, name); | 2674 this->PushLiteralName(fni_, name); |
| 2647 } | 2675 } |
| 2648 | 2676 |
| 2649 if (!in_class && !is_generator) { | 2677 if (!in_class && !is_generator) { |
| 2650 DCHECK(!is_static); | 2678 DCHECK(!is_static); |
| 2651 | 2679 |
| 2652 if (peek() == Token::COLON) { | 2680 if (peek() == Token::COLON) { |
| 2653 // PropertyDefinition | 2681 // PropertyDefinition |
| 2654 // PropertyName ':' AssignmentExpression | 2682 // PropertyName ':' AssignmentExpression |
| 2655 if (!*is_computed_name) { | 2683 if (!*is_computed_name) { |
| 2656 checker->CheckProperty(name_token, kValueProperty, false, false, | 2684 checker->CheckProperty(name_token, kValueProperty, false, false, |
| 2657 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2685 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2658 } | 2686 } |
| 2659 Consume(Token::COLON); | 2687 Consume(Token::COLON); |
| 2660 value = this->ParseAssignmentExpression( | 2688 value = this->ParseAssignmentExpression( |
| 2661 true, classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2689 true, classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2662 return factory()->NewObjectLiteralProperty(name_expression, value, false, | 2690 return factory()->NewObjectLiteralProperty(name_expression, value, false, |
| 2663 *is_computed_name); | 2691 *is_computed_name); |
| 2664 } | 2692 } |
| 2665 | 2693 |
| 2666 if (Token::IsIdentifier(name_token, language_mode(), | 2694 if (is_identifier && (peek() == Token::COMMA || peek() == Token::RBRACE || |
| 2667 this->is_generator()) && | 2695 peek() == Token::ASSIGN)) { |
| 2668 (peek() == Token::COMMA || peek() == Token::RBRACE || | |
| 2669 peek() == Token::ASSIGN)) { | |
| 2670 // PropertyDefinition | 2696 // PropertyDefinition |
| 2671 // IdentifierReference | 2697 // IdentifierReference |
| 2672 // CoverInitializedName | 2698 // CoverInitializedName |
| 2673 // | 2699 // |
| 2674 // CoverInitializedName | 2700 // CoverInitializedName |
| 2675 // IdentifierReference Initializer? | 2701 // IdentifierReference Initializer? |
| 2702 if (!Token::IsIdentifier(name_token, language_mode(), | |
| 2703 this->is_generator())) { | |
| 2704 ReportUnexpectedTokenAt(scanner()->location(), name_token); | |
| 2705 *ok = false; | |
| 2706 return this->EmptyObjectLiteralProperty(); | |
| 2707 } | |
| 2708 if (is_escaped_keyword) { | |
|
rossberg
2015/11/06 13:31:05
See above, I'm confused, which case would this cov
caitp (gmail)
2015/11/06 19:08:06
originally, I had wanted to report a slightly diff
| |
| 2709 classifier->RecordExpressionError( | |
|
rossberg
2015/11/06 13:31:05
Wouldn't this be an error unconditionally? In whic
caitp (gmail)
2015/11/06 19:08:06
it always is, the original idea was just to use a
| |
| 2710 scanner()->location(), | |
| 2711 MessageTemplate::kInvalidEscapedReservedWord); | |
| 2712 classifier->RecordBindingPatternError( | |
| 2713 scanner()->location(), | |
| 2714 MessageTemplate::kInvalidEscapedReservedWord); | |
| 2715 } | |
| 2676 if (classifier->duplicate_finder() != nullptr && | 2716 if (classifier->duplicate_finder() != nullptr && |
| 2677 scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) { | 2717 scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) { |
| 2678 classifier->RecordDuplicateFormalParameterError(scanner()->location()); | 2718 classifier->RecordDuplicateFormalParameterError(scanner()->location()); |
| 2679 } | 2719 } |
| 2680 if (name_token == Token::LET) { | 2720 if (name_token == Token::LET) { |
| 2681 classifier->RecordLetPatternError( | 2721 classifier->RecordLetPatternError( |
| 2682 scanner()->location(), MessageTemplate::kLetInLexicalBinding); | 2722 scanner()->location(), MessageTemplate::kLetInLexicalBinding); |
| 2683 } | 2723 } |
| 2684 | 2724 |
| 2685 ExpressionT lhs = this->ExpressionFromIdentifier( | 2725 ExpressionT lhs = this->ExpressionFromIdentifier( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2747 | 2787 |
| 2748 if (is_get || is_set) { | 2788 if (is_get || is_set) { |
| 2749 // MethodDefinition (Accessors) | 2789 // MethodDefinition (Accessors) |
| 2750 // get PropertyName '(' ')' '{' FunctionBody '}' | 2790 // get PropertyName '(' ')' '{' FunctionBody '}' |
| 2751 // set PropertyName '(' PropertySetParameterList ')' '{' FunctionBody '}' | 2791 // set PropertyName '(' PropertySetParameterList ')' '{' FunctionBody '}' |
| 2752 name = this->EmptyIdentifier(); | 2792 name = this->EmptyIdentifier(); |
| 2753 bool dont_care = false; | 2793 bool dont_care = false; |
| 2754 name_token = peek(); | 2794 name_token = peek(); |
| 2755 | 2795 |
| 2756 name_expression = ParsePropertyName( | 2796 name_expression = ParsePropertyName( |
| 2757 &name, &dont_care, &dont_care, &dont_care, is_computed_name, classifier, | 2797 &name, &dont_care, &dont_care, &dont_care, is_computed_name, &dont_care, |
| 2758 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2798 &dont_care, classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2759 | 2799 |
| 2760 if (!*is_computed_name) { | 2800 if (!*is_computed_name) { |
| 2761 checker->CheckProperty(name_token, kAccessorProperty, is_static, | 2801 checker->CheckProperty(name_token, kAccessorProperty, is_static, |
| 2762 is_generator, | 2802 is_generator, |
| 2763 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2803 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2764 } | 2804 } |
| 2765 | 2805 |
| 2766 FunctionKind kind = FunctionKind::kAccessorFunction; | 2806 FunctionKind kind = FunctionKind::kAccessorFunction; |
| 2767 if (!in_class) kind = WithObjectLiteralBit(kind); | 2807 if (!in_class) kind = WithObjectLiteralBit(kind); |
| 2768 typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral( | 2808 typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral( |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4221 return; | 4261 return; |
| 4222 } | 4262 } |
| 4223 has_seen_constructor_ = true; | 4263 has_seen_constructor_ = true; |
| 4224 return; | 4264 return; |
| 4225 } | 4265 } |
| 4226 } | 4266 } |
| 4227 } // namespace internal | 4267 } // namespace internal |
| 4228 } // namespace v8 | 4268 } // namespace v8 |
| 4229 | 4269 |
| 4230 #endif // V8_PREPARSER_H | 4270 #endif // V8_PREPARSER_H |
| OLD | NEW |