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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 678 ExpressionClassifier* classifier, bool* ok); | 678 ExpressionClassifier* classifier, bool* ok); |
| 679 | 679 |
| 680 ExpressionT ParsePrimaryExpression(ExpressionClassifier* classifier, | 680 ExpressionT ParsePrimaryExpression(ExpressionClassifier* classifier, |
| 681 bool* ok); | 681 bool* ok); |
| 682 ExpressionT ParseExpression(bool accept_IN, bool* ok); | 682 ExpressionT ParseExpression(bool accept_IN, bool* ok); |
| 683 ExpressionT ParseExpression(bool accept_IN, ExpressionClassifier* classifier, | 683 ExpressionT ParseExpression(bool accept_IN, ExpressionClassifier* classifier, |
| 684 bool* ok); | 684 bool* ok); |
| 685 ExpressionT ParseArrayLiteral(ExpressionClassifier* classifier, bool* ok); | 685 ExpressionT ParseArrayLiteral(ExpressionClassifier* classifier, bool* ok); |
| 686 ExpressionT ParsePropertyName(IdentifierT* name, bool* is_get, bool* is_set, | 686 ExpressionT ParsePropertyName(IdentifierT* name, bool* is_get, bool* is_set, |
| 687 bool* is_static, bool* is_computed_name, | 687 bool* is_static, bool* is_computed_name, |
| 688 bool* is_identifier, bool* is_escaped_keyword, | |
| 688 ExpressionClassifier* classifier, bool* ok); | 689 ExpressionClassifier* classifier, bool* ok); |
| 689 ExpressionT ParseObjectLiteral(ExpressionClassifier* classifier, bool* ok); | 690 ExpressionT ParseObjectLiteral(ExpressionClassifier* classifier, bool* ok); |
| 690 ObjectLiteralPropertyT ParsePropertyDefinition( | 691 ObjectLiteralPropertyT ParsePropertyDefinition( |
| 691 ObjectLiteralCheckerBase* checker, bool in_class, bool has_extends, | 692 ObjectLiteralCheckerBase* checker, bool in_class, bool has_extends, |
| 692 bool is_static, bool* is_computed_name, bool* has_seen_constructor, | 693 bool is_static, bool* is_computed_name, bool* has_seen_constructor, |
| 693 ExpressionClassifier* classifier, bool* ok); | 694 ExpressionClassifier* classifier, bool* ok); |
| 694 typename Traits::Type::ExpressionList ParseArguments( | 695 typename Traits::Type::ExpressionList ParseArguments( |
| 695 Scanner::Location* first_spread_pos, ExpressionClassifier* classifier, | 696 Scanner::Location* first_spread_pos, ExpressionClassifier* classifier, |
| 696 bool* ok); | 697 bool* ok); |
| 697 ExpressionT ParseAssignmentExpression(bool accept_IN, | 698 ExpressionT ParseAssignmentExpression(bool accept_IN, |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1992 *message = is_strict(language_mode()) | 1993 *message = is_strict(language_mode()) |
| 1993 ? MessageTemplate::kUnexpectedStrictReserved | 1994 ? MessageTemplate::kUnexpectedStrictReserved |
| 1994 : MessageTemplate::kUnexpectedTokenIdentifier; | 1995 : MessageTemplate::kUnexpectedTokenIdentifier; |
| 1995 *arg = nullptr; | 1996 *arg = nullptr; |
| 1996 break; | 1997 break; |
| 1997 case Token::TEMPLATE_SPAN: | 1998 case Token::TEMPLATE_SPAN: |
| 1998 case Token::TEMPLATE_TAIL: | 1999 case Token::TEMPLATE_TAIL: |
| 1999 *message = MessageTemplate::kUnexpectedTemplateString; | 2000 *message = MessageTemplate::kUnexpectedTemplateString; |
| 2000 *arg = nullptr; | 2001 *arg = nullptr; |
| 2001 break; | 2002 break; |
| 2003 case Token::ESCAPED_STRICT_RESERVED_WORD: | |
| 2004 case Token::ESCAPED_KEYWORD: | |
| 2005 *message = MessageTemplate::kInvalidEscapedReservedWord; | |
| 2006 *arg = nullptr; | |
| 2007 break; | |
| 2002 default: | 2008 default: |
| 2003 const char* name = Token::String(token); | 2009 const char* name = Token::String(token); |
| 2004 DCHECK(name != NULL); | 2010 DCHECK(name != NULL); |
| 2005 *arg = name; | 2011 *arg = name; |
| 2006 break; | 2012 break; |
| 2007 } | 2013 } |
| 2008 } | 2014 } |
| 2009 | 2015 |
| 2010 | 2016 |
| 2011 template <class Traits> | 2017 template <class Traits> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2043 | 2049 |
| 2044 return result; | 2050 return result; |
| 2045 } | 2051 } |
| 2046 | 2052 |
| 2047 | 2053 |
| 2048 template <class Traits> | 2054 template <class Traits> |
| 2049 typename ParserBase<Traits>::IdentifierT | 2055 typename ParserBase<Traits>::IdentifierT |
| 2050 ParserBase<Traits>::ParseAndClassifyIdentifier(ExpressionClassifier* classifier, | 2056 ParserBase<Traits>::ParseAndClassifyIdentifier(ExpressionClassifier* classifier, |
| 2051 bool* ok) { | 2057 bool* ok) { |
| 2052 Token::Value next = Next(); | 2058 Token::Value next = Next(); |
| 2059 if (next == Token::ESCAPED_STRICT_RESERVED_WORD) { | |
|
rossberg
2015/11/06 13:31:04
Any reason not to put this into an else-if branch
caitp (gmail)
2015/11/06 16:10:30
The duplicate finder bit doesn't seem to stop `var
| |
| 2060 if (is_strict(language_mode())) { | |
| 2061 ReportUnexpectedToken(next); | |
| 2062 *ok = false; | |
| 2063 return Traits::EmptyIdentifier(); | |
| 2064 } | |
| 2065 next = Token::IDENTIFIER; | |
| 2066 } | |
| 2053 if (next == Token::IDENTIFIER) { | 2067 if (next == Token::IDENTIFIER) { |
| 2054 IdentifierT name = this->GetSymbol(scanner()); | 2068 IdentifierT name = this->GetSymbol(scanner()); |
| 2055 // When this function is used to read a formal parameter, we don't always | 2069 // When this function is used to read a formal parameter, we don't always |
| 2056 // know whether the function is going to be strict or sloppy. Indeed for | 2070 // know whether the function is going to be strict or sloppy. Indeed for |
| 2057 // arrow functions we don't always know that the identifier we are reading | 2071 // arrow functions we don't always know that the identifier we are reading |
| 2058 // is actually a formal parameter. Therefore besides the errors that we | 2072 // is actually a formal parameter. Therefore besides the errors that we |
| 2059 // must detect because we know we're in strict mode, we also record any | 2073 // must detect because we know we're in strict mode, we also record any |
| 2060 // error that we might make in the future once we know the language mode. | 2074 // error that we might make in the future once we know the language mode. |
| 2061 if (this->IsEval(name)) { | 2075 if (this->IsEval(name)) { |
| 2062 classifier->RecordStrictModeFormalParameterError( | 2076 classifier->RecordStrictModeFormalParameterError( |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2137 return name; | 2151 return name; |
| 2138 } | 2152 } |
| 2139 | 2153 |
| 2140 | 2154 |
| 2141 template <class Traits> | 2155 template <class Traits> |
| 2142 typename ParserBase<Traits>::IdentifierT | 2156 typename ParserBase<Traits>::IdentifierT |
| 2143 ParserBase<Traits>::ParseIdentifierName(bool* ok) { | 2157 ParserBase<Traits>::ParseIdentifierName(bool* ok) { |
| 2144 Token::Value next = Next(); | 2158 Token::Value next = Next(); |
| 2145 if (next != Token::IDENTIFIER && next != Token::FUTURE_RESERVED_WORD && | 2159 if (next != Token::IDENTIFIER && next != Token::FUTURE_RESERVED_WORD && |
| 2146 next != Token::LET && next != Token::STATIC && next != Token::YIELD && | 2160 next != Token::LET && next != Token::STATIC && next != Token::YIELD && |
| 2147 next != Token::FUTURE_STRICT_RESERVED_WORD && !Token::IsKeyword(next)) { | 2161 next != Token::FUTURE_STRICT_RESERVED_WORD && |
| 2162 next != Token::ESCAPED_KEYWORD && | |
| 2163 next != Token::ESCAPED_STRICT_RESERVED_WORD && !Token::IsKeyword(next)) { | |
| 2148 this->ReportUnexpectedToken(next); | 2164 this->ReportUnexpectedToken(next); |
| 2149 *ok = false; | 2165 *ok = false; |
| 2150 return Traits::EmptyIdentifier(); | 2166 return Traits::EmptyIdentifier(); |
| 2151 } | 2167 } |
| 2152 | 2168 |
| 2153 IdentifierT name = this->GetSymbol(scanner()); | 2169 IdentifierT name = this->GetSymbol(scanner()); |
| 2154 if (this->IsArguments(name)) scope_->RecordArgumentsUsage(); | 2170 if (this->IsArguments(name)) scope_->RecordArgumentsUsage(); |
| 2155 return name; | 2171 return name; |
| 2156 } | 2172 } |
| 2157 | 2173 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2264 scanner()->peek_location(), MessageTemplate::kUnexpectedTokenNumber); | 2280 scanner()->peek_location(), MessageTemplate::kUnexpectedTokenNumber); |
| 2265 Next(); | 2281 Next(); |
| 2266 result = | 2282 result = |
| 2267 this->ExpressionFromLiteral(token, beg_pos, scanner(), factory()); | 2283 this->ExpressionFromLiteral(token, beg_pos, scanner(), factory()); |
| 2268 break; | 2284 break; |
| 2269 | 2285 |
| 2270 case Token::IDENTIFIER: | 2286 case Token::IDENTIFIER: |
| 2271 case Token::LET: | 2287 case Token::LET: |
| 2272 case Token::STATIC: | 2288 case Token::STATIC: |
| 2273 case Token::YIELD: | 2289 case Token::YIELD: |
| 2290 case Token::ESCAPED_STRICT_RESERVED_WORD: | |
| 2274 case Token::FUTURE_STRICT_RESERVED_WORD: { | 2291 case Token::FUTURE_STRICT_RESERVED_WORD: { |
| 2275 // Using eval or arguments in this context is OK even in strict mode. | 2292 // Using eval or arguments in this context is OK even in strict mode. |
| 2276 IdentifierT name = ParseAndClassifyIdentifier(classifier, CHECK_OK); | 2293 IdentifierT name = ParseAndClassifyIdentifier(classifier, CHECK_OK); |
| 2277 result = this->ExpressionFromIdentifier(name, beg_pos, end_pos, scope_, | 2294 result = this->ExpressionFromIdentifier(name, beg_pos, end_pos, scope_, |
| 2278 factory()); | 2295 factory()); |
| 2279 break; | 2296 break; |
| 2280 } | 2297 } |
| 2281 | 2298 |
| 2282 case Token::STRING: { | 2299 case Token::STRING: { |
| 2283 classifier->RecordBindingPatternError( | 2300 classifier->RecordBindingPatternError( |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2540 int literal_index = function_state_->NextMaterializedLiteralIndex(); | 2557 int literal_index = function_state_->NextMaterializedLiteralIndex(); |
| 2541 | 2558 |
| 2542 return factory()->NewArrayLiteral(values, first_spread_index, literal_index, | 2559 return factory()->NewArrayLiteral(values, first_spread_index, literal_index, |
| 2543 is_strong(language_mode()), pos); | 2560 is_strong(language_mode()), pos); |
| 2544 } | 2561 } |
| 2545 | 2562 |
| 2546 | 2563 |
| 2547 template <class Traits> | 2564 template <class Traits> |
| 2548 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( | 2565 typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParsePropertyName( |
| 2549 IdentifierT* name, bool* is_get, bool* is_set, bool* is_static, | 2566 IdentifierT* name, bool* is_get, bool* is_set, bool* is_static, |
| 2550 bool* is_computed_name, ExpressionClassifier* classifier, bool* ok) { | 2567 bool* is_computed_name, bool* is_identifier, bool* is_escaped_keyword, |
| 2568 ExpressionClassifier* classifier, bool* ok) { | |
| 2551 Token::Value token = peek(); | 2569 Token::Value token = peek(); |
| 2552 int pos = peek_position(); | 2570 int pos = peek_position(); |
| 2553 | 2571 |
| 2554 // For non computed property names we normalize the name a bit: | 2572 // For non computed property names we normalize the name a bit: |
| 2555 // | 2573 // |
| 2556 // "12" -> 12 | 2574 // "12" -> 12 |
| 2557 // 12.3 -> "12.3" | 2575 // 12.3 -> "12.3" |
| 2558 // 12.30 -> "12.3" | 2576 // 12.30 -> "12.3" |
| 2559 // identifier -> "identifier" | 2577 // identifier -> "identifier" |
| 2560 // | 2578 // |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 2581 Consume(Token::LBRACK); | 2599 Consume(Token::LBRACK); |
| 2582 ExpressionClassifier computed_name_classifier; | 2600 ExpressionClassifier computed_name_classifier; |
| 2583 ExpressionT expression = | 2601 ExpressionT expression = |
| 2584 ParseAssignmentExpression(true, &computed_name_classifier, CHECK_OK); | 2602 ParseAssignmentExpression(true, &computed_name_classifier, CHECK_OK); |
| 2585 classifier->Accumulate(computed_name_classifier, | 2603 classifier->Accumulate(computed_name_classifier, |
| 2586 ExpressionClassifier::ExpressionProductions); | 2604 ExpressionClassifier::ExpressionProductions); |
| 2587 Expect(Token::RBRACK, CHECK_OK); | 2605 Expect(Token::RBRACK, CHECK_OK); |
| 2588 return expression; | 2606 return expression; |
| 2589 } | 2607 } |
| 2590 | 2608 |
| 2609 case Token::ESCAPED_KEYWORD: | |
| 2610 *is_escaped_keyword = true; | |
| 2611 *is_identifier = true; | |
| 2612 *name = ParseIdentifierNameOrGetOrSet(is_get, is_set, CHECK_OK); | |
| 2613 break; | |
| 2614 | |
| 2591 case Token::STATIC: | 2615 case Token::STATIC: |
| 2592 *is_static = true; | 2616 *is_static = true; |
| 2593 | 2617 |
| 2594 // Fall through. | 2618 // Fall through. |
| 2595 default: | 2619 default: |
| 2620 *is_identifier = true; | |
| 2596 *name = ParseIdentifierNameOrGetOrSet(is_get, is_set, CHECK_OK); | 2621 *name = ParseIdentifierNameOrGetOrSet(is_get, is_set, CHECK_OK); |
| 2597 break; | 2622 break; |
| 2598 } | 2623 } |
| 2599 | 2624 |
| 2600 uint32_t index; | 2625 uint32_t index; |
| 2601 return this->IsArrayIndex(*name, &index) | 2626 return this->IsArrayIndex(*name, &index) |
| 2602 ? factory()->NewNumberLiteral(index, pos) | 2627 ? factory()->NewNumberLiteral(index, pos) |
| 2603 : factory()->NewStringLiteral(*name, pos); | 2628 : factory()->NewStringLiteral(*name, pos); |
| 2604 } | 2629 } |
| 2605 | 2630 |
| 2606 | 2631 |
| 2607 template <class Traits> | 2632 template <class Traits> |
| 2608 typename ParserBase<Traits>::ObjectLiteralPropertyT | 2633 typename ParserBase<Traits>::ObjectLiteralPropertyT |
| 2609 ParserBase<Traits>::ParsePropertyDefinition( | 2634 ParserBase<Traits>::ParsePropertyDefinition( |
| 2610 ObjectLiteralCheckerBase* checker, bool in_class, bool has_extends, | 2635 ObjectLiteralCheckerBase* checker, bool in_class, bool has_extends, |
| 2611 bool is_static, bool* is_computed_name, bool* has_seen_constructor, | 2636 bool is_static, bool* is_computed_name, bool* has_seen_constructor, |
| 2612 ExpressionClassifier* classifier, bool* ok) { | 2637 ExpressionClassifier* classifier, bool* ok) { |
| 2613 DCHECK(!in_class || is_static || has_seen_constructor != nullptr); | 2638 DCHECK(!in_class || is_static || has_seen_constructor != nullptr); |
| 2614 ExpressionT value = this->EmptyExpression(); | 2639 ExpressionT value = this->EmptyExpression(); |
| 2615 IdentifierT name = this->EmptyIdentifier(); | 2640 IdentifierT name = this->EmptyIdentifier(); |
| 2616 bool is_get = false; | 2641 bool is_get = false; |
| 2617 bool is_set = false; | 2642 bool is_set = false; |
| 2618 bool name_is_static = false; | 2643 bool name_is_static = false; |
| 2619 bool is_generator = Check(Token::MUL); | 2644 bool is_generator = Check(Token::MUL); |
| 2620 | 2645 |
| 2621 Token::Value name_token = peek(); | 2646 Token::Value name_token = peek(); |
| 2622 int next_beg_pos = scanner()->peek_location().beg_pos; | 2647 int next_beg_pos = scanner()->peek_location().beg_pos; |
| 2623 int next_end_pos = scanner()->peek_location().end_pos; | 2648 int next_end_pos = scanner()->peek_location().end_pos; |
| 2649 bool is_identifier = false; | |
| 2650 bool is_escaped_keyword = false; | |
| 2624 ExpressionT name_expression = ParsePropertyName( | 2651 ExpressionT name_expression = ParsePropertyName( |
| 2625 &name, &is_get, &is_set, &name_is_static, is_computed_name, classifier, | 2652 &name, &is_get, &is_set, &name_is_static, is_computed_name, |
| 2653 &is_identifier, &is_escaped_keyword, classifier, | |
| 2626 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2654 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2627 | 2655 |
| 2628 if (fni_ != nullptr && !*is_computed_name) { | 2656 if (fni_ != nullptr && !*is_computed_name) { |
| 2629 this->PushLiteralName(fni_, name); | 2657 this->PushLiteralName(fni_, name); |
| 2630 } | 2658 } |
| 2631 | 2659 |
| 2632 if (!in_class && !is_generator) { | 2660 if (!in_class && !is_generator) { |
| 2633 DCHECK(!is_static); | 2661 DCHECK(!is_static); |
| 2634 | 2662 |
| 2635 if (peek() == Token::COLON) { | 2663 if (peek() == Token::COLON) { |
| 2636 // PropertyDefinition | 2664 // PropertyDefinition |
| 2637 // PropertyName ':' AssignmentExpression | 2665 // PropertyName ':' AssignmentExpression |
| 2638 if (!*is_computed_name) { | 2666 if (!*is_computed_name) { |
| 2639 checker->CheckProperty(name_token, kValueProperty, false, false, | 2667 checker->CheckProperty(name_token, kValueProperty, false, false, |
| 2640 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2668 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2641 } | 2669 } |
| 2642 Consume(Token::COLON); | 2670 Consume(Token::COLON); |
| 2643 value = this->ParseAssignmentExpression( | 2671 value = this->ParseAssignmentExpression( |
| 2644 true, classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2672 true, classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2645 return factory()->NewObjectLiteralProperty(name_expression, value, false, | 2673 return factory()->NewObjectLiteralProperty(name_expression, value, false, |
| 2646 *is_computed_name); | 2674 *is_computed_name); |
| 2647 } | 2675 } |
| 2648 | 2676 |
| 2649 if (Token::IsIdentifier(name_token, language_mode(), | 2677 if (is_identifier && (peek() == Token::COMMA || peek() == Token::RBRACE || |
| 2650 this->is_generator()) && | 2678 peek() == Token::ASSIGN)) { |
| 2651 (peek() == Token::COMMA || peek() == Token::RBRACE || | |
| 2652 peek() == Token::ASSIGN)) { | |
| 2653 // PropertyDefinition | 2679 // PropertyDefinition |
| 2654 // IdentifierReference | 2680 // IdentifierReference |
| 2655 // CoverInitializedName | 2681 // CoverInitializedName |
| 2656 // | 2682 // |
| 2657 // CoverInitializedName | 2683 // CoverInitializedName |
| 2658 // IdentifierReference Initializer? | 2684 // IdentifierReference Initializer? |
| 2685 if (!Token::IsIdentifier(name_token, language_mode(), | |
| 2686 this->is_generator())) { | |
| 2687 ReportUnexpectedTokenAt(scanner()->location(), name_token); | |
| 2688 *ok = false; | |
| 2689 return this->EmptyObjectLiteralProperty(); | |
| 2690 } | |
| 2691 if (is_escaped_keyword) { | |
| 2692 classifier->RecordExpressionError( | |
| 2693 scanner()->location(), | |
| 2694 MessageTemplate::kInvalidEscapedReservedWord); | |
| 2695 classifier->RecordBindingPatternError( | |
| 2696 scanner()->location(), | |
| 2697 MessageTemplate::kInvalidEscapedReservedWord); | |
| 2698 } | |
| 2659 if (classifier->duplicate_finder() != nullptr && | 2699 if (classifier->duplicate_finder() != nullptr && |
| 2660 scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) { | 2700 scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) { |
| 2661 classifier->RecordDuplicateFormalParameterError(scanner()->location()); | 2701 classifier->RecordDuplicateFormalParameterError(scanner()->location()); |
| 2662 } | 2702 } |
| 2663 if (name_token == Token::LET) { | 2703 if (name_token == Token::LET) { |
| 2664 classifier->RecordLetPatternError( | 2704 classifier->RecordLetPatternError( |
| 2665 scanner()->location(), MessageTemplate::kLetInLexicalBinding); | 2705 scanner()->location(), MessageTemplate::kLetInLexicalBinding); |
| 2666 } | 2706 } |
| 2667 | 2707 |
| 2668 ExpressionT lhs = this->ExpressionFromIdentifier( | 2708 ExpressionT lhs = this->ExpressionFromIdentifier( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2730 | 2770 |
| 2731 if (is_get || is_set) { | 2771 if (is_get || is_set) { |
| 2732 // MethodDefinition (Accessors) | 2772 // MethodDefinition (Accessors) |
| 2733 // get PropertyName '(' ')' '{' FunctionBody '}' | 2773 // get PropertyName '(' ')' '{' FunctionBody '}' |
| 2734 // set PropertyName '(' PropertySetParameterList ')' '{' FunctionBody '}' | 2774 // set PropertyName '(' PropertySetParameterList ')' '{' FunctionBody '}' |
| 2735 name = this->EmptyIdentifier(); | 2775 name = this->EmptyIdentifier(); |
| 2736 bool dont_care = false; | 2776 bool dont_care = false; |
| 2737 name_token = peek(); | 2777 name_token = peek(); |
| 2738 | 2778 |
| 2739 name_expression = ParsePropertyName( | 2779 name_expression = ParsePropertyName( |
| 2740 &name, &dont_care, &dont_care, &dont_care, is_computed_name, classifier, | 2780 &name, &dont_care, &dont_care, &dont_care, is_computed_name, &dont_care, |
| 2741 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2781 &dont_care, classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2742 | 2782 |
| 2743 if (!*is_computed_name) { | 2783 if (!*is_computed_name) { |
| 2744 checker->CheckProperty(name_token, kAccessorProperty, is_static, | 2784 checker->CheckProperty(name_token, kAccessorProperty, is_static, |
| 2745 is_generator, | 2785 is_generator, |
| 2746 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 2786 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 2747 } | 2787 } |
| 2748 | 2788 |
| 2749 FunctionKind kind = FunctionKind::kAccessorFunction; | 2789 FunctionKind kind = FunctionKind::kAccessorFunction; |
| 2750 if (!in_class) kind = WithObjectLiteralBit(kind); | 2790 if (!in_class) kind = WithObjectLiteralBit(kind); |
| 2751 typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral( | 2791 typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral( |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4204 return; | 4244 return; |
| 4205 } | 4245 } |
| 4206 has_seen_constructor_ = true; | 4246 has_seen_constructor_ = true; |
| 4207 return; | 4247 return; |
| 4208 } | 4248 } |
| 4209 } | 4249 } |
| 4210 } // namespace internal | 4250 } // namespace internal |
| 4211 } // namespace v8 | 4251 } // namespace v8 |
| 4212 | 4252 |
| 4213 #endif // V8_PREPARSER_H | 4253 #endif // V8_PREPARSER_H |
| OLD | NEW |