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/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 void Swap(TailCallExpressionList& other) { | 333 void Swap(TailCallExpressionList& other) { |
334 expressions_.Swap(&other.expressions_); | 334 expressions_.Swap(&other.expressions_); |
335 std::swap(loc_, other.loc_); | 335 std::swap(loc_, other.loc_); |
336 std::swap(has_explicit_tail_calls_, other.has_explicit_tail_calls_); | 336 std::swap(has_explicit_tail_calls_, other.has_explicit_tail_calls_); |
337 } | 337 } |
338 | 338 |
339 void AddImplicitTailCall(ExpressionT expr) { | 339 void AddImplicitTailCall(ExpressionT expr) { |
340 expressions_.Add(expr, zone_); | 340 expressions_.Add(expr, zone_); |
341 } | 341 } |
342 | 342 |
343 void AddExplicitTailCall(ExpressionT expr, const Scanner::Location& loc) { | |
344 if (!has_explicit_tail_calls()) { | |
345 loc_ = loc; | |
346 has_explicit_tail_calls_ = true; | |
347 } | |
348 expressions_.Add(expr, zone_); | |
349 } | |
350 | |
351 void Append(const TailCallExpressionList& other) { | 343 void Append(const TailCallExpressionList& other) { |
352 if (!has_explicit_tail_calls()) { | 344 if (!has_explicit_tail_calls()) { |
353 loc_ = other.loc_; | 345 loc_ = other.loc_; |
354 has_explicit_tail_calls_ = other.has_explicit_tail_calls_; | 346 has_explicit_tail_calls_ = other.has_explicit_tail_calls_; |
355 } | 347 } |
356 expressions_.AddAll(other.expressions_, zone_); | 348 expressions_.AddAll(other.expressions_, zone_); |
357 } | 349 } |
358 | 350 |
359 private: | 351 private: |
360 Zone* zone_; | 352 Zone* zone_; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 422 |
431 TailCallExpressionList& tail_call_expressions() { | 423 TailCallExpressionList& tail_call_expressions() { |
432 return tail_call_expressions_; | 424 return tail_call_expressions_; |
433 } | 425 } |
434 void AddImplicitTailCallExpression(ExpressionT expression) { | 426 void AddImplicitTailCallExpression(ExpressionT expression) { |
435 if (return_expr_context() == | 427 if (return_expr_context() == |
436 ReturnExprContext::kInsideValidReturnStatement) { | 428 ReturnExprContext::kInsideValidReturnStatement) { |
437 tail_call_expressions_.AddImplicitTailCall(expression); | 429 tail_call_expressions_.AddImplicitTailCall(expression); |
438 } | 430 } |
439 } | 431 } |
440 void AddExplicitTailCallExpression(ExpressionT expression, | |
441 const Scanner::Location& loc) { | |
442 DCHECK(expression->IsCall()); | |
443 if (return_expr_context() == | |
444 ReturnExprContext::kInsideValidReturnStatement) { | |
445 tail_call_expressions_.AddExplicitTailCall(expression, loc); | |
446 } | |
447 } | |
448 | 432 |
449 ZoneList<typename ExpressionClassifier::Error>* GetReportedErrorList() { | 433 ZoneList<typename ExpressionClassifier::Error>* GetReportedErrorList() { |
450 return &reported_errors_; | 434 return &reported_errors_; |
451 } | 435 } |
452 | 436 |
453 ReturnExprContext return_expr_context() const { | 437 ReturnExprContext return_expr_context() const { |
454 return return_expr_context_; | 438 return return_expr_context_; |
455 } | 439 } |
456 void set_return_expr_context(ReturnExprContext context) { | 440 void set_return_expr_context(ReturnExprContext context) { |
457 return_expr_context_ = context; | 441 return_expr_context_ = context; |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 } | 1034 } |
1051 } | 1035 } |
1052 | 1036 |
1053 void ValidateLetPattern(bool* ok) { | 1037 void ValidateLetPattern(bool* ok) { |
1054 if (!classifier()->is_valid_let_pattern()) { | 1038 if (!classifier()->is_valid_let_pattern()) { |
1055 ReportClassifierError(classifier()->let_pattern_error()); | 1039 ReportClassifierError(classifier()->let_pattern_error()); |
1056 *ok = false; | 1040 *ok = false; |
1057 } | 1041 } |
1058 } | 1042 } |
1059 | 1043 |
1060 void CheckNoTailCallExpressions(bool* ok) { | |
1061 if (FLAG_harmony_explicit_tailcalls && | |
1062 classifier()->has_tail_call_expression()) { | |
1063 ReportClassifierError(classifier()->tail_call_expression_error()); | |
1064 *ok = false; | |
1065 } | |
1066 } | |
1067 | |
1068 void ExpressionUnexpectedToken() { | 1044 void ExpressionUnexpectedToken() { |
1069 MessageTemplate::Template message = MessageTemplate::kUnexpectedToken; | 1045 MessageTemplate::Template message = MessageTemplate::kUnexpectedToken; |
1070 const char* arg; | 1046 const char* arg; |
1071 Scanner::Location location = scanner()->peek_location(); | 1047 Scanner::Location location = scanner()->peek_location(); |
1072 GetUnexpectedTokenMessage(peek(), &message, &location, &arg); | 1048 GetUnexpectedTokenMessage(peek(), &message, &location, &arg); |
1073 classifier()->RecordExpressionError(location, message, arg); | 1049 classifier()->RecordExpressionError(location, message, arg); |
1074 } | 1050 } |
1075 | 1051 |
1076 void BindingPatternUnexpectedToken() { | 1052 void BindingPatternUnexpectedToken() { |
1077 MessageTemplate::Template message = MessageTemplate::kUnexpectedToken; | 1053 MessageTemplate::Template message = MessageTemplate::kUnexpectedToken; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 ObjectLiteralChecker* checker, bool* is_computed_name, bool* ok); | 1144 ObjectLiteralChecker* checker, bool* is_computed_name, bool* ok); |
1169 ExpressionListT ParseArguments(Scanner::Location* first_spread_pos, | 1145 ExpressionListT ParseArguments(Scanner::Location* first_spread_pos, |
1170 bool maybe_arrow, bool* ok); | 1146 bool maybe_arrow, bool* ok); |
1171 ExpressionListT ParseArguments(Scanner::Location* first_spread_pos, | 1147 ExpressionListT ParseArguments(Scanner::Location* first_spread_pos, |
1172 bool* ok) { | 1148 bool* ok) { |
1173 return ParseArguments(first_spread_pos, false, ok); | 1149 return ParseArguments(first_spread_pos, false, ok); |
1174 } | 1150 } |
1175 | 1151 |
1176 ExpressionT ParseAssignmentExpression(bool accept_IN, bool* ok); | 1152 ExpressionT ParseAssignmentExpression(bool accept_IN, bool* ok); |
1177 ExpressionT ParseYieldExpression(bool accept_IN, bool* ok); | 1153 ExpressionT ParseYieldExpression(bool accept_IN, bool* ok); |
1178 ExpressionT ParseTailCallExpression(bool* ok); | |
1179 ExpressionT ParseConditionalExpression(bool accept_IN, bool* ok); | 1154 ExpressionT ParseConditionalExpression(bool accept_IN, bool* ok); |
1180 ExpressionT ParseBinaryExpression(int prec, bool accept_IN, bool* ok); | 1155 ExpressionT ParseBinaryExpression(int prec, bool accept_IN, bool* ok); |
1181 ExpressionT ParseUnaryExpression(bool* ok); | 1156 ExpressionT ParseUnaryExpression(bool* ok); |
1182 ExpressionT ParsePostfixExpression(bool* ok); | 1157 ExpressionT ParsePostfixExpression(bool* ok); |
1183 ExpressionT ParseLeftHandSideExpression(bool* ok); | 1158 ExpressionT ParseLeftHandSideExpression(bool* ok); |
1184 ExpressionT ParseMemberWithNewPrefixesExpression(bool* is_async, bool* ok); | 1159 ExpressionT ParseMemberWithNewPrefixesExpression(bool* is_async, bool* ok); |
1185 ExpressionT ParseMemberExpression(bool* is_async, bool* ok); | 1160 ExpressionT ParseMemberExpression(bool* is_async, bool* ok); |
1186 ExpressionT ParseMemberExpressionContinuation(ExpressionT expression, | 1161 ExpressionT ParseMemberExpressionContinuation(ExpressionT expression, |
1187 bool* is_async, bool* ok); | 1162 bool* is_async, bool* ok); |
1188 ExpressionT ParseArrowFunctionLiteral(bool accept_IN, | 1163 ExpressionT ParseArrowFunctionLiteral(bool accept_IN, |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 | 1825 |
1851 template <typename Impl> | 1826 template <typename Impl> |
1852 typename ParserBase<Impl>::ExpressionT | 1827 typename ParserBase<Impl>::ExpressionT |
1853 ParserBase<Impl>::ParseExpressionCoverGrammar(bool accept_IN, bool* ok) { | 1828 ParserBase<Impl>::ParseExpressionCoverGrammar(bool accept_IN, bool* ok) { |
1854 // Expression :: | 1829 // Expression :: |
1855 // AssignmentExpression | 1830 // AssignmentExpression |
1856 // Expression ',' AssignmentExpression | 1831 // Expression ',' AssignmentExpression |
1857 | 1832 |
1858 ExpressionT result = impl()->EmptyExpression(); | 1833 ExpressionT result = impl()->EmptyExpression(); |
1859 while (true) { | 1834 while (true) { |
1860 CheckNoTailCallExpressions(CHECK_OK); | |
1861 int comma_pos = position(); | 1835 int comma_pos = position(); |
1862 ExpressionClassifier binding_classifier(this); | 1836 ExpressionClassifier binding_classifier(this); |
1863 ExpressionT right; | 1837 ExpressionT right; |
1864 if (Check(Token::ELLIPSIS)) { | 1838 if (Check(Token::ELLIPSIS)) { |
1865 // 'x, y, ...z' in CoverParenthesizedExpressionAndArrowParameterList only | 1839 // 'x, y, ...z' in CoverParenthesizedExpressionAndArrowParameterList only |
1866 // as the formal parameters of'(x, y, ...z) => foo', and is not itself a | 1840 // as the formal parameters of'(x, y, ...z) => foo', and is not itself a |
1867 // valid expression. | 1841 // valid expression. |
1868 classifier()->RecordExpressionError(scanner()->location(), | 1842 classifier()->RecordExpressionError(scanner()->location(), |
1869 MessageTemplate::kUnexpectedToken, | 1843 MessageTemplate::kUnexpectedToken, |
1870 Token::String(Token::ELLIPSIS)); | 1844 Token::String(Token::ELLIPSIS)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 Expect(Token::LBRACK, CHECK_OK); | 1893 Expect(Token::LBRACK, CHECK_OK); |
1920 while (peek() != Token::RBRACK) { | 1894 while (peek() != Token::RBRACK) { |
1921 ExpressionT elem; | 1895 ExpressionT elem; |
1922 if (peek() == Token::COMMA) { | 1896 if (peek() == Token::COMMA) { |
1923 elem = impl()->GetLiteralTheHole(peek_position()); | 1897 elem = impl()->GetLiteralTheHole(peek_position()); |
1924 } else if (peek() == Token::ELLIPSIS) { | 1898 } else if (peek() == Token::ELLIPSIS) { |
1925 int start_pos = peek_position(); | 1899 int start_pos = peek_position(); |
1926 Consume(Token::ELLIPSIS); | 1900 Consume(Token::ELLIPSIS); |
1927 int expr_pos = peek_position(); | 1901 int expr_pos = peek_position(); |
1928 ExpressionT argument = ParseAssignmentExpression(true, CHECK_OK); | 1902 ExpressionT argument = ParseAssignmentExpression(true, CHECK_OK); |
1929 CheckNoTailCallExpressions(CHECK_OK); | |
1930 elem = factory()->NewSpread(argument, start_pos, expr_pos); | 1903 elem = factory()->NewSpread(argument, start_pos, expr_pos); |
1931 | 1904 |
1932 if (first_spread_index < 0) { | 1905 if (first_spread_index < 0) { |
1933 first_spread_index = values->length(); | 1906 first_spread_index = values->length(); |
1934 } | 1907 } |
1935 | 1908 |
1936 if (argument->IsAssignment()) { | 1909 if (argument->IsAssignment()) { |
1937 classifier()->RecordPatternError( | 1910 classifier()->RecordPatternError( |
1938 Scanner::Location(start_pos, scanner()->location().end_pos), | 1911 Scanner::Location(start_pos, scanner()->location().end_pos), |
1939 MessageTemplate::kInvalidDestructuringTarget); | 1912 MessageTemplate::kInvalidDestructuringTarget); |
1940 } else { | 1913 } else { |
1941 CheckDestructuringElement(argument, start_pos, | 1914 CheckDestructuringElement(argument, start_pos, |
1942 scanner()->location().end_pos); | 1915 scanner()->location().end_pos); |
1943 } | 1916 } |
1944 | 1917 |
1945 if (peek() == Token::COMMA) { | 1918 if (peek() == Token::COMMA) { |
1946 classifier()->RecordPatternError( | 1919 classifier()->RecordPatternError( |
1947 Scanner::Location(start_pos, scanner()->location().end_pos), | 1920 Scanner::Location(start_pos, scanner()->location().end_pos), |
1948 MessageTemplate::kElementAfterRest); | 1921 MessageTemplate::kElementAfterRest); |
1949 } | 1922 } |
1950 } else { | 1923 } else { |
1951 int beg_pos = peek_position(); | 1924 int beg_pos = peek_position(); |
1952 elem = ParseAssignmentExpression(true, CHECK_OK); | 1925 elem = ParseAssignmentExpression(true, CHECK_OK); |
1953 CheckNoTailCallExpressions(CHECK_OK); | |
1954 CheckDestructuringElement(elem, beg_pos, scanner()->location().end_pos); | 1926 CheckDestructuringElement(elem, beg_pos, scanner()->location().end_pos); |
1955 } | 1927 } |
1956 values->Add(elem, zone_); | 1928 values->Add(elem, zone_); |
1957 if (peek() != Token::RBRACK) { | 1929 if (peek() != Token::RBRACK) { |
1958 Expect(Token::COMMA, CHECK_OK); | 1930 Expect(Token::COMMA, CHECK_OK); |
1959 } | 1931 } |
1960 } | 1932 } |
1961 Expect(Token::RBRACK, CHECK_OK); | 1933 Expect(Token::RBRACK, CHECK_OK); |
1962 | 1934 |
1963 // Update the scope information before the pre-parsing bailout. | 1935 // Update the scope information before the pre-parsing bailout. |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2528 bool done = (peek() == Token::RPAREN); | 2500 bool done = (peek() == Token::RPAREN); |
2529 bool was_unspread = false; | 2501 bool was_unspread = false; |
2530 int unspread_sequences_count = 0; | 2502 int unspread_sequences_count = 0; |
2531 while (!done) { | 2503 while (!done) { |
2532 int start_pos = peek_position(); | 2504 int start_pos = peek_position(); |
2533 bool is_spread = Check(Token::ELLIPSIS); | 2505 bool is_spread = Check(Token::ELLIPSIS); |
2534 int expr_pos = peek_position(); | 2506 int expr_pos = peek_position(); |
2535 | 2507 |
2536 ExpressionT argument = | 2508 ExpressionT argument = |
2537 ParseAssignmentExpression(true, CHECK_OK_CUSTOM(NullExpressionList)); | 2509 ParseAssignmentExpression(true, CHECK_OK_CUSTOM(NullExpressionList)); |
2538 CheckNoTailCallExpressions(CHECK_OK_CUSTOM(NullExpressionList)); | |
2539 if (!maybe_arrow) { | 2510 if (!maybe_arrow) { |
2540 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(NullExpressionList)); | 2511 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(NullExpressionList)); |
2541 } | 2512 } |
2542 if (is_spread) { | 2513 if (is_spread) { |
2543 if (!spread_arg.IsValid()) { | 2514 if (!spread_arg.IsValid()) { |
2544 spread_arg.beg_pos = start_pos; | 2515 spread_arg.beg_pos = start_pos; |
2545 spread_arg.end_pos = peek_position(); | 2516 spread_arg.end_pos = peek_position(); |
2546 } | 2517 } |
2547 argument = factory()->NewSpread(argument, start_pos, expr_pos); | 2518 argument = factory()->NewSpread(argument, start_pos, expr_pos); |
2548 } | 2519 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2720 if (!Token::IsAssignmentOp(peek())) { | 2691 if (!Token::IsAssignmentOp(peek())) { |
2721 // Parsed conditional expression only (no assignment). | 2692 // Parsed conditional expression only (no assignment). |
2722 // Pending non-pattern expressions must be merged. | 2693 // Pending non-pattern expressions must be merged. |
2723 impl()->Accumulate(productions); | 2694 impl()->Accumulate(productions); |
2724 return expression; | 2695 return expression; |
2725 } else { | 2696 } else { |
2726 // Pending non-pattern expressions must be discarded. | 2697 // Pending non-pattern expressions must be discarded. |
2727 impl()->Accumulate(productions, false); | 2698 impl()->Accumulate(productions, false); |
2728 } | 2699 } |
2729 | 2700 |
2730 CheckNoTailCallExpressions(CHECK_OK); | |
2731 | |
2732 if (is_destructuring_assignment) { | 2701 if (is_destructuring_assignment) { |
2733 ValidateAssignmentPattern(CHECK_OK); | 2702 ValidateAssignmentPattern(CHECK_OK); |
2734 } else { | 2703 } else { |
2735 expression = CheckAndRewriteReferenceExpression( | 2704 expression = CheckAndRewriteReferenceExpression( |
2736 expression, lhs_beg_pos, scanner()->location().end_pos, | 2705 expression, lhs_beg_pos, scanner()->location().end_pos, |
2737 MessageTemplate::kInvalidLhsInAssignment, CHECK_OK); | 2706 MessageTemplate::kInvalidLhsInAssignment, CHECK_OK); |
2738 } | 2707 } |
2739 | 2708 |
2740 expression = impl()->MarkExpressionAsAssigned(expression); | 2709 expression = impl()->MarkExpressionAsAssigned(expression); |
2741 | 2710 |
2742 Token::Value op = Next(); // Get assignment operator. | 2711 Token::Value op = Next(); // Get assignment operator. |
2743 if (op != Token::ASSIGN) { | 2712 if (op != Token::ASSIGN) { |
2744 classifier()->RecordPatternError(scanner()->location(), | 2713 classifier()->RecordPatternError(scanner()->location(), |
2745 MessageTemplate::kUnexpectedToken, | 2714 MessageTemplate::kUnexpectedToken, |
2746 Token::String(op)); | 2715 Token::String(op)); |
2747 } | 2716 } |
2748 int pos = position(); | 2717 int pos = position(); |
2749 | 2718 |
2750 ExpressionClassifier rhs_classifier(this); | 2719 ExpressionClassifier rhs_classifier(this); |
2751 | 2720 |
2752 ExpressionT right = ParseAssignmentExpression(accept_IN, CHECK_OK); | 2721 ExpressionT right = ParseAssignmentExpression(accept_IN, CHECK_OK); |
2753 CheckNoTailCallExpressions(CHECK_OK); | |
2754 impl()->RewriteNonPattern(CHECK_OK); | 2722 impl()->RewriteNonPattern(CHECK_OK); |
2755 impl()->AccumulateFormalParameterContainmentErrors(); | 2723 impl()->AccumulateFormalParameterContainmentErrors(); |
2756 | 2724 |
2757 // TODO(1231235): We try to estimate the set of properties set by | 2725 // TODO(1231235): We try to estimate the set of properties set by |
2758 // constructors. We define a new property whenever there is an | 2726 // constructors. We define a new property whenever there is an |
2759 // assignment to a property of 'this'. We should probably only add | 2727 // assignment to a property of 'this'. We should probably only add |
2760 // properties if we haven't seen them before. Otherwise we'll | 2728 // properties if we haven't seen them before. Otherwise we'll |
2761 // probably overestimate the number of properties. | 2729 // probably overestimate the number of properties. |
2762 if (op == Token::ASSIGN && impl()->IsThisProperty(expression)) { | 2730 if (op == Token::ASSIGN && impl()->IsThisProperty(expression)) { |
2763 function_state_->AddProperty(); | 2731 function_state_->AddProperty(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2840 } | 2808 } |
2841 | 2809 |
2842 expression = impl()->BuildIteratorResult(expression, false); | 2810 expression = impl()->BuildIteratorResult(expression, false); |
2843 // Hackily disambiguate o from o.next and o [Symbol.iterator](). | 2811 // Hackily disambiguate o from o.next and o [Symbol.iterator](). |
2844 // TODO(verwaest): Come up with a better solution. | 2812 // TODO(verwaest): Come up with a better solution. |
2845 ExpressionT yield = factory()->NewYield(generator_object, expression, pos, | 2813 ExpressionT yield = factory()->NewYield(generator_object, expression, pos, |
2846 Yield::kOnExceptionThrow); | 2814 Yield::kOnExceptionThrow); |
2847 return yield; | 2815 return yield; |
2848 } | 2816 } |
2849 | 2817 |
2850 template <typename Impl> | |
2851 typename ParserBase<Impl>::ExpressionT | |
2852 ParserBase<Impl>::ParseTailCallExpression(bool* ok) { | |
2853 // TailCallExpression:: | |
2854 // 'continue' MemberExpression Arguments | |
2855 // 'continue' CallExpression Arguments | |
2856 // 'continue' MemberExpression TemplateLiteral | |
2857 // 'continue' CallExpression TemplateLiteral | |
2858 Expect(Token::CONTINUE, CHECK_OK); | |
2859 int pos = position(); | |
2860 int sub_expression_pos = peek_position(); | |
2861 ExpressionT expression = ParseLeftHandSideExpression(CHECK_OK); | |
2862 CheckNoTailCallExpressions(CHECK_OK); | |
2863 | |
2864 Scanner::Location loc(pos, scanner()->location().end_pos); | |
2865 | |
2866 if (!expression->IsCall()) { | |
2867 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); | |
2868 impl()->ReportMessageAt(sub_loc, | |
2869 MessageTemplate::kUnexpectedInsideTailCall); | |
2870 *ok = false; | |
2871 return impl()->EmptyExpression(); | |
2872 } | |
2873 if (impl()->IsDirectEvalCall(expression)) { | |
2874 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); | |
2875 impl()->ReportMessageAt(sub_loc, | |
2876 MessageTemplate::kUnexpectedTailCallOfEval); | |
2877 *ok = false; | |
2878 return impl()->EmptyExpression(); | |
2879 } | |
2880 if (!is_strict(language_mode())) { | |
2881 impl()->ReportMessageAt(loc, MessageTemplate::kUnexpectedSloppyTailCall); | |
2882 *ok = false; | |
2883 return impl()->EmptyExpression(); | |
2884 } | |
2885 if (is_resumable()) { | |
2886 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); | |
2887 impl()->ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedTailCall); | |
2888 *ok = false; | |
2889 return impl()->EmptyExpression(); | |
2890 } | |
2891 ReturnExprContext return_expr_context = | |
2892 function_state_->return_expr_context(); | |
2893 if (return_expr_context != ReturnExprContext::kInsideValidReturnStatement) { | |
2894 MessageTemplate::Template msg = MessageTemplate::kNone; | |
2895 switch (return_expr_context) { | |
2896 case ReturnExprContext::kInsideValidReturnStatement: | |
2897 UNREACHABLE(); | |
2898 return impl()->EmptyExpression(); | |
2899 case ReturnExprContext::kInsideValidBlock: | |
2900 msg = MessageTemplate::kUnexpectedTailCall; | |
2901 break; | |
2902 case ReturnExprContext::kInsideTryBlock: | |
2903 msg = MessageTemplate::kUnexpectedTailCallInTryBlock; | |
2904 break; | |
2905 case ReturnExprContext::kInsideForInOfBody: | |
2906 msg = MessageTemplate::kUnexpectedTailCallInForInOf; | |
2907 break; | |
2908 } | |
2909 impl()->ReportMessageAt(loc, msg); | |
2910 *ok = false; | |
2911 return impl()->EmptyExpression(); | |
2912 } | |
2913 classifier()->RecordTailCallExpressionError( | |
2914 loc, MessageTemplate::kUnexpectedTailCall); | |
2915 function_state_->AddExplicitTailCallExpression(expression, loc); | |
2916 return expression; | |
2917 } | |
2918 | |
2919 // Precedence = 3 | 2818 // Precedence = 3 |
2920 template <typename Impl> | 2819 template <typename Impl> |
2921 typename ParserBase<Impl>::ExpressionT | 2820 typename ParserBase<Impl>::ExpressionT |
2922 ParserBase<Impl>::ParseConditionalExpression(bool accept_IN, | 2821 ParserBase<Impl>::ParseConditionalExpression(bool accept_IN, |
2923 bool* ok) { | 2822 bool* ok) { |
2924 // ConditionalExpression :: | 2823 // ConditionalExpression :: |
2925 // LogicalOrExpression | 2824 // LogicalOrExpression |
2926 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression | 2825 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression |
2927 | 2826 |
2928 int pos = peek_position(); | 2827 int pos = peek_position(); |
2929 // We start using the binary expression parser for prec >= 4 only! | 2828 // We start using the binary expression parser for prec >= 4 only! |
2930 ExpressionT expression = ParseBinaryExpression(4, accept_IN, CHECK_OK); | 2829 ExpressionT expression = ParseBinaryExpression(4, accept_IN, CHECK_OK); |
2931 if (peek() != Token::CONDITIONAL) return expression; | 2830 if (peek() != Token::CONDITIONAL) return expression; |
2932 CheckNoTailCallExpressions(CHECK_OK); | |
2933 impl()->RewriteNonPattern(CHECK_OK); | 2831 impl()->RewriteNonPattern(CHECK_OK); |
2934 BindingPatternUnexpectedToken(); | 2832 BindingPatternUnexpectedToken(); |
2935 ArrowFormalParametersUnexpectedToken(); | 2833 ArrowFormalParametersUnexpectedToken(); |
2936 Consume(Token::CONDITIONAL); | 2834 Consume(Token::CONDITIONAL); |
2937 // In parsing the first assignment expression in conditional | 2835 // In parsing the first assignment expression in conditional |
2938 // expressions we always accept the 'in' keyword; see ECMA-262, | 2836 // expressions we always accept the 'in' keyword; see ECMA-262, |
2939 // section 11.12, page 58. | 2837 // section 11.12, page 58. |
2940 ExpressionT left = ParseAssignmentExpression(true, CHECK_OK); | 2838 ExpressionT left = ParseAssignmentExpression(true, CHECK_OK); |
2941 impl()->RewriteNonPattern(CHECK_OK); | 2839 impl()->RewriteNonPattern(CHECK_OK); |
2942 Expect(Token::COLON, CHECK_OK); | 2840 Expect(Token::COLON, CHECK_OK); |
2943 ExpressionT right = ParseAssignmentExpression(accept_IN, CHECK_OK); | 2841 ExpressionT right = ParseAssignmentExpression(accept_IN, CHECK_OK); |
2944 impl()->RewriteNonPattern(CHECK_OK); | 2842 impl()->RewriteNonPattern(CHECK_OK); |
2945 return factory()->NewConditional(expression, left, right, pos); | 2843 return factory()->NewConditional(expression, left, right, pos); |
2946 } | 2844 } |
2947 | 2845 |
2948 | 2846 |
2949 // Precedence >= 4 | 2847 // Precedence >= 4 |
2950 template <typename Impl> | 2848 template <typename Impl> |
2951 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseBinaryExpression( | 2849 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseBinaryExpression( |
2952 int prec, bool accept_IN, bool* ok) { | 2850 int prec, bool accept_IN, bool* ok) { |
2953 DCHECK(prec >= 4); | 2851 DCHECK(prec >= 4); |
2954 ExpressionT x = ParseUnaryExpression(CHECK_OK); | 2852 ExpressionT x = ParseUnaryExpression(CHECK_OK); |
2955 for (int prec1 = Precedence(peek(), accept_IN); prec1 >= prec; prec1--) { | 2853 for (int prec1 = Precedence(peek(), accept_IN); prec1 >= prec; prec1--) { |
2956 // prec1 >= 4 | 2854 // prec1 >= 4 |
2957 while (Precedence(peek(), accept_IN) == prec1) { | 2855 while (Precedence(peek(), accept_IN) == prec1) { |
2958 CheckNoTailCallExpressions(CHECK_OK); | |
2959 impl()->RewriteNonPattern(CHECK_OK); | 2856 impl()->RewriteNonPattern(CHECK_OK); |
2960 BindingPatternUnexpectedToken(); | 2857 BindingPatternUnexpectedToken(); |
2961 ArrowFormalParametersUnexpectedToken(); | 2858 ArrowFormalParametersUnexpectedToken(); |
2962 Token::Value op = Next(); | 2859 Token::Value op = Next(); |
2963 int pos = position(); | 2860 int pos = position(); |
2964 | 2861 |
2965 const bool is_right_associative = op == Token::EXP; | 2862 const bool is_right_associative = op == Token::EXP; |
2966 const int next_prec = is_right_associative ? prec1 : prec1 + 1; | 2863 const int next_prec = is_right_associative ? prec1 : prec1 + 1; |
2967 ExpressionT y = ParseBinaryExpression(next_prec, accept_IN, CHECK_OK); | 2864 ExpressionT y = ParseBinaryExpression(next_prec, accept_IN, CHECK_OK); |
2968 if (op != Token::OR && op != Token::AND) { | |
2969 CheckNoTailCallExpressions(CHECK_OK); | |
2970 } | |
2971 impl()->RewriteNonPattern(CHECK_OK); | 2865 impl()->RewriteNonPattern(CHECK_OK); |
2972 | 2866 |
2973 if (impl()->ShortcutNumericLiteralBinaryExpression(&x, y, op, pos)) { | 2867 if (impl()->ShortcutNumericLiteralBinaryExpression(&x, y, op, pos)) { |
2974 continue; | 2868 continue; |
2975 } | 2869 } |
2976 | 2870 |
2977 // For now we distinguish between comparisons and other binary | 2871 // For now we distinguish between comparisons and other binary |
2978 // operations. (We could combine the two and get rid of this | 2872 // operations. (We could combine the two and get rid of this |
2979 // code and AST node eventually.) | 2873 // code and AST node eventually.) |
2980 if (Token::IsCompareOp(op)) { | 2874 if (Token::IsCompareOp(op)) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3018 // [+Await] AwaitExpression[?Yield] | 2912 // [+Await] AwaitExpression[?Yield] |
3019 | 2913 |
3020 Token::Value op = peek(); | 2914 Token::Value op = peek(); |
3021 if (Token::IsUnaryOp(op)) { | 2915 if (Token::IsUnaryOp(op)) { |
3022 BindingPatternUnexpectedToken(); | 2916 BindingPatternUnexpectedToken(); |
3023 ArrowFormalParametersUnexpectedToken(); | 2917 ArrowFormalParametersUnexpectedToken(); |
3024 | 2918 |
3025 op = Next(); | 2919 op = Next(); |
3026 int pos = position(); | 2920 int pos = position(); |
3027 ExpressionT expression = ParseUnaryExpression(CHECK_OK); | 2921 ExpressionT expression = ParseUnaryExpression(CHECK_OK); |
3028 CheckNoTailCallExpressions(CHECK_OK); | |
3029 impl()->RewriteNonPattern(CHECK_OK); | 2922 impl()->RewriteNonPattern(CHECK_OK); |
3030 | 2923 |
3031 if (op == Token::DELETE && is_strict(language_mode())) { | 2924 if (op == Token::DELETE && is_strict(language_mode())) { |
3032 if (impl()->IsIdentifier(expression)) { | 2925 if (impl()->IsIdentifier(expression)) { |
3033 // "delete identifier" is a syntax error in strict mode. | 2926 // "delete identifier" is a syntax error in strict mode. |
3034 ReportMessage(MessageTemplate::kStrictDelete); | 2927 ReportMessage(MessageTemplate::kStrictDelete); |
3035 *ok = false; | 2928 *ok = false; |
3036 return impl()->EmptyExpression(); | 2929 return impl()->EmptyExpression(); |
3037 } | 2930 } |
3038 } | 2931 } |
3039 | 2932 |
3040 if (peek() == Token::EXP) { | 2933 if (peek() == Token::EXP) { |
3041 ReportUnexpectedToken(Next()); | 2934 ReportUnexpectedToken(Next()); |
3042 *ok = false; | 2935 *ok = false; |
3043 return impl()->EmptyExpression(); | 2936 return impl()->EmptyExpression(); |
3044 } | 2937 } |
3045 | 2938 |
3046 // Allow the parser's implementation to rewrite the expression. | 2939 // Allow the parser's implementation to rewrite the expression. |
3047 return impl()->BuildUnaryExpression(expression, op, pos); | 2940 return impl()->BuildUnaryExpression(expression, op, pos); |
3048 } else if (Token::IsCountOp(op)) { | 2941 } else if (Token::IsCountOp(op)) { |
3049 BindingPatternUnexpectedToken(); | 2942 BindingPatternUnexpectedToken(); |
3050 ArrowFormalParametersUnexpectedToken(); | 2943 ArrowFormalParametersUnexpectedToken(); |
3051 op = Next(); | 2944 op = Next(); |
3052 int beg_pos = peek_position(); | 2945 int beg_pos = peek_position(); |
3053 ExpressionT expression = ParseUnaryExpression(CHECK_OK); | 2946 ExpressionT expression = ParseUnaryExpression(CHECK_OK); |
3054 CheckNoTailCallExpressions(CHECK_OK); | |
3055 expression = CheckAndRewriteReferenceExpression( | 2947 expression = CheckAndRewriteReferenceExpression( |
3056 expression, beg_pos, scanner()->location().end_pos, | 2948 expression, beg_pos, scanner()->location().end_pos, |
3057 MessageTemplate::kInvalidLhsInPrefixOp, CHECK_OK); | 2949 MessageTemplate::kInvalidLhsInPrefixOp, CHECK_OK); |
3058 expression = impl()->MarkExpressionAsAssigned(expression); | 2950 expression = impl()->MarkExpressionAsAssigned(expression); |
3059 impl()->RewriteNonPattern(CHECK_OK); | 2951 impl()->RewriteNonPattern(CHECK_OK); |
3060 | 2952 |
3061 return factory()->NewCountOperation(op, | 2953 return factory()->NewCountOperation(op, |
3062 true /* prefix */, | 2954 true /* prefix */, |
3063 expression, | 2955 expression, |
3064 position()); | 2956 position()); |
(...skipping 17 matching lines...) Expand all Loading... |
3082 template <typename Impl> | 2974 template <typename Impl> |
3083 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePostfixExpression( | 2975 typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParsePostfixExpression( |
3084 bool* ok) { | 2976 bool* ok) { |
3085 // PostfixExpression :: | 2977 // PostfixExpression :: |
3086 // LeftHandSideExpression ('++' | '--')? | 2978 // LeftHandSideExpression ('++' | '--')? |
3087 | 2979 |
3088 int lhs_beg_pos = peek_position(); | 2980 int lhs_beg_pos = peek_position(); |
3089 ExpressionT expression = ParseLeftHandSideExpression(CHECK_OK); | 2981 ExpressionT expression = ParseLeftHandSideExpression(CHECK_OK); |
3090 if (!scanner()->HasAnyLineTerminatorBeforeNext() && | 2982 if (!scanner()->HasAnyLineTerminatorBeforeNext() && |
3091 Token::IsCountOp(peek())) { | 2983 Token::IsCountOp(peek())) { |
3092 CheckNoTailCallExpressions(CHECK_OK); | |
3093 BindingPatternUnexpectedToken(); | 2984 BindingPatternUnexpectedToken(); |
3094 ArrowFormalParametersUnexpectedToken(); | 2985 ArrowFormalParametersUnexpectedToken(); |
3095 | 2986 |
3096 expression = CheckAndRewriteReferenceExpression( | 2987 expression = CheckAndRewriteReferenceExpression( |
3097 expression, lhs_beg_pos, scanner()->location().end_pos, | 2988 expression, lhs_beg_pos, scanner()->location().end_pos, |
3098 MessageTemplate::kInvalidLhsInPostfixOp, CHECK_OK); | 2989 MessageTemplate::kInvalidLhsInPostfixOp, CHECK_OK); |
3099 expression = impl()->MarkExpressionAsAssigned(expression); | 2990 expression = impl()->MarkExpressionAsAssigned(expression); |
3100 impl()->RewriteNonPattern(CHECK_OK); | 2991 impl()->RewriteNonPattern(CHECK_OK); |
3101 | 2992 |
3102 Token::Value next = Next(); | 2993 Token::Value next = Next(); |
3103 expression = | 2994 expression = |
3104 factory()->NewCountOperation(next, | 2995 factory()->NewCountOperation(next, |
3105 false /* postfix */, | 2996 false /* postfix */, |
3106 expression, | 2997 expression, |
3107 position()); | 2998 position()); |
3108 } | 2999 } |
3109 return expression; | 3000 return expression; |
3110 } | 3001 } |
3111 | 3002 |
3112 template <typename Impl> | 3003 template <typename Impl> |
3113 typename ParserBase<Impl>::ExpressionT | 3004 typename ParserBase<Impl>::ExpressionT |
3114 ParserBase<Impl>::ParseLeftHandSideExpression(bool* ok) { | 3005 ParserBase<Impl>::ParseLeftHandSideExpression(bool* ok) { |
3115 // LeftHandSideExpression :: | 3006 // LeftHandSideExpression :: |
3116 // (NewExpression | MemberExpression) ... | 3007 // (NewExpression | MemberExpression) ... |
3117 | 3008 |
3118 if (FLAG_harmony_explicit_tailcalls && peek() == Token::CONTINUE) { | |
3119 return ParseTailCallExpression(ok); | |
3120 } | |
3121 | |
3122 bool is_async = false; | 3009 bool is_async = false; |
3123 ExpressionT result = | 3010 ExpressionT result = |
3124 ParseMemberWithNewPrefixesExpression(&is_async, CHECK_OK); | 3011 ParseMemberWithNewPrefixesExpression(&is_async, CHECK_OK); |
3125 | 3012 |
3126 while (true) { | 3013 while (true) { |
3127 switch (peek()) { | 3014 switch (peek()) { |
3128 case Token::LBRACK: { | 3015 case Token::LBRACK: { |
3129 CheckNoTailCallExpressions(CHECK_OK); | |
3130 impl()->RewriteNonPattern(CHECK_OK); | 3016 impl()->RewriteNonPattern(CHECK_OK); |
3131 BindingPatternUnexpectedToken(); | 3017 BindingPatternUnexpectedToken(); |
3132 ArrowFormalParametersUnexpectedToken(); | 3018 ArrowFormalParametersUnexpectedToken(); |
3133 Consume(Token::LBRACK); | 3019 Consume(Token::LBRACK); |
3134 int pos = position(); | 3020 int pos = position(); |
3135 ExpressionT index = ParseExpressionCoverGrammar(true, CHECK_OK); | 3021 ExpressionT index = ParseExpressionCoverGrammar(true, CHECK_OK); |
3136 impl()->RewriteNonPattern(CHECK_OK); | 3022 impl()->RewriteNonPattern(CHECK_OK); |
3137 result = factory()->NewProperty(result, index, pos); | 3023 result = factory()->NewProperty(result, index, pos); |
3138 Expect(Token::RBRACK, CHECK_OK); | 3024 Expect(Token::RBRACK, CHECK_OK); |
3139 break; | 3025 break; |
3140 } | 3026 } |
3141 | 3027 |
3142 case Token::LPAREN: { | 3028 case Token::LPAREN: { |
3143 CheckNoTailCallExpressions(CHECK_OK); | |
3144 int pos; | 3029 int pos; |
3145 impl()->RewriteNonPattern(CHECK_OK); | 3030 impl()->RewriteNonPattern(CHECK_OK); |
3146 BindingPatternUnexpectedToken(); | 3031 BindingPatternUnexpectedToken(); |
3147 if (scanner()->current_token() == Token::IDENTIFIER || | 3032 if (scanner()->current_token() == Token::IDENTIFIER || |
3148 scanner()->current_token() == Token::SUPER || | 3033 scanner()->current_token() == Token::SUPER || |
3149 scanner()->current_token() == Token::ASYNC) { | 3034 scanner()->current_token() == Token::ASYNC) { |
3150 // For call of an identifier we want to report position of | 3035 // For call of an identifier we want to report position of |
3151 // the identifier as position of the call in the stack trace. | 3036 // the identifier as position of the call in the stack trace. |
3152 pos = position(); | 3037 pos = position(); |
3153 } else { | 3038 } else { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3221 ExpressionT this_expr = impl()->ThisExpression(pos); | 3106 ExpressionT this_expr = impl()->ThisExpression(pos); |
3222 result = | 3107 result = |
3223 factory()->NewAssignment(Token::INIT, this_expr, result, pos); | 3108 factory()->NewAssignment(Token::INIT, this_expr, result, pos); |
3224 } | 3109 } |
3225 | 3110 |
3226 if (fni_ != NULL) fni_->RemoveLastFunction(); | 3111 if (fni_ != NULL) fni_->RemoveLastFunction(); |
3227 break; | 3112 break; |
3228 } | 3113 } |
3229 | 3114 |
3230 case Token::PERIOD: { | 3115 case Token::PERIOD: { |
3231 CheckNoTailCallExpressions(CHECK_OK); | |
3232 impl()->RewriteNonPattern(CHECK_OK); | 3116 impl()->RewriteNonPattern(CHECK_OK); |
3233 BindingPatternUnexpectedToken(); | 3117 BindingPatternUnexpectedToken(); |
3234 ArrowFormalParametersUnexpectedToken(); | 3118 ArrowFormalParametersUnexpectedToken(); |
3235 Consume(Token::PERIOD); | 3119 Consume(Token::PERIOD); |
3236 int pos = position(); | 3120 int pos = position(); |
3237 IdentifierT name = ParseIdentifierName(CHECK_OK); | 3121 IdentifierT name = ParseIdentifierName(CHECK_OK); |
3238 result = factory()->NewProperty( | 3122 result = factory()->NewProperty( |
3239 result, factory()->NewStringLiteral(name, pos), pos); | 3123 result, factory()->NewStringLiteral(name, pos), pos); |
3240 impl()->PushLiteralName(name); | 3124 impl()->PushLiteralName(name); |
3241 break; | 3125 break; |
3242 } | 3126 } |
3243 | 3127 |
3244 case Token::TEMPLATE_SPAN: | 3128 case Token::TEMPLATE_SPAN: |
3245 case Token::TEMPLATE_TAIL: { | 3129 case Token::TEMPLATE_TAIL: { |
3246 CheckNoTailCallExpressions(CHECK_OK); | |
3247 impl()->RewriteNonPattern(CHECK_OK); | 3130 impl()->RewriteNonPattern(CHECK_OK); |
3248 BindingPatternUnexpectedToken(); | 3131 BindingPatternUnexpectedToken(); |
3249 ArrowFormalParametersUnexpectedToken(); | 3132 ArrowFormalParametersUnexpectedToken(); |
3250 result = ParseTemplateLiteral(result, position(), CHECK_OK); | 3133 result = ParseTemplateLiteral(result, position(), CHECK_OK); |
3251 break; | 3134 break; |
3252 } | 3135 } |
3253 | 3136 |
3254 default: | 3137 default: |
3255 return result; | 3138 return result; |
3256 } | 3139 } |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4064 } else if (next == Token::ILLEGAL) { | 3947 } else if (next == Token::ILLEGAL) { |
4065 impl()->ReportMessageAt( | 3948 impl()->ReportMessageAt( |
4066 Scanner::Location(position() + 1, peek_position()), | 3949 Scanner::Location(position() + 1, peek_position()), |
4067 MessageTemplate::kUnexpectedToken, "ILLEGAL", kSyntaxError); | 3950 MessageTemplate::kUnexpectedToken, "ILLEGAL", kSyntaxError); |
4068 *ok = false; | 3951 *ok = false; |
4069 return impl()->EmptyExpression(); | 3952 return impl()->EmptyExpression(); |
4070 } | 3953 } |
4071 | 3954 |
4072 int expr_pos = peek_position(); | 3955 int expr_pos = peek_position(); |
4073 ExpressionT expression = ParseExpressionCoverGrammar(true, CHECK_OK); | 3956 ExpressionT expression = ParseExpressionCoverGrammar(true, CHECK_OK); |
4074 CheckNoTailCallExpressions(CHECK_OK); | |
4075 impl()->RewriteNonPattern(CHECK_OK); | 3957 impl()->RewriteNonPattern(CHECK_OK); |
4076 impl()->AddTemplateExpression(&ts, expression); | 3958 impl()->AddTemplateExpression(&ts, expression); |
4077 | 3959 |
4078 if (peek() != Token::RBRACE) { | 3960 if (peek() != Token::RBRACE) { |
4079 impl()->ReportMessageAt(Scanner::Location(expr_pos, peek_position()), | 3961 impl()->ReportMessageAt(Scanner::Location(expr_pos, peek_position()), |
4080 MessageTemplate::kUnterminatedTemplateExpr); | 3962 MessageTemplate::kUnterminatedTemplateExpr); |
4081 *ok = false; | 3963 *ok = false; |
4082 return impl()->EmptyExpression(); | 3964 return impl()->EmptyExpression(); |
4083 } | 3965 } |
4084 | 3966 |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4983 } | 4865 } |
4984 } | 4866 } |
4985 | 4867 |
4986 catch_info.scope->set_end_position(scanner()->location().end_pos); | 4868 catch_info.scope->set_end_position(scanner()->location().end_pos); |
4987 } | 4869 } |
4988 | 4870 |
4989 BlockT finally_block = impl()->NullBlock(); | 4871 BlockT finally_block = impl()->NullBlock(); |
4990 DCHECK(peek() == Token::FINALLY || !impl()->IsNullStatement(catch_block)); | 4872 DCHECK(peek() == Token::FINALLY || !impl()->IsNullStatement(catch_block)); |
4991 if (Check(Token::FINALLY)) { | 4873 if (Check(Token::FINALLY)) { |
4992 finally_block = ParseBlock(nullptr, CHECK_OK); | 4874 finally_block = ParseBlock(nullptr, CHECK_OK); |
4993 | |
4994 if (FLAG_harmony_explicit_tailcalls && | |
4995 catch_info.tail_call_expressions.has_explicit_tail_calls()) { | |
4996 // TODO(ishell): update chapter number. | |
4997 // ES8 XX.YY.ZZ | |
4998 impl()->ReportMessageAt(catch_info.tail_call_expressions.location(), | |
4999 MessageTemplate::kUnexpectedTailCallInCatchBlock); | |
5000 *ok = false; | |
5001 return impl()->NullStatement(); | |
5002 } | |
5003 } | 4875 } |
5004 | 4876 |
5005 return impl()->RewriteTryStatement(try_block, catch_block, finally_block, | 4877 return impl()->RewriteTryStatement(try_block, catch_block, finally_block, |
5006 catch_info, pos); | 4878 catch_info, pos); |
5007 } | 4879 } |
5008 | 4880 |
5009 template <typename Impl> | 4881 template <typename Impl> |
5010 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForStatement( | 4882 typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseForStatement( |
5011 ZoneList<const AstRawString*>* labels, bool* ok) { | 4883 ZoneList<const AstRawString*>* labels, bool* ok) { |
5012 int stmt_pos = peek_position(); | 4884 int stmt_pos = peek_position(); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5321 has_seen_constructor_ = true; | 5193 has_seen_constructor_ = true; |
5322 return; | 5194 return; |
5323 } | 5195 } |
5324 } | 5196 } |
5325 | 5197 |
5326 | 5198 |
5327 } // namespace internal | 5199 } // namespace internal |
5328 } // namespace v8 | 5200 } // namespace v8 |
5329 | 5201 |
5330 #endif // V8_PARSING_PARSER_BASE_H | 5202 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |