Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: src/parsing/parser-base.h

Issue 2258313002: [async functions] Disallow 'await' in arrow params inside async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parsing/expression-classifier.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/hashmap.h" 10 #include "src/base/hashmap.h"
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 void ValidateFormalParameterInitializer( 926 void ValidateFormalParameterInitializer(
927 const ExpressionClassifier* classifier, bool* ok) { 927 const ExpressionClassifier* classifier, bool* ok) {
928 if (!classifier->is_valid_formal_parameter_initializer()) { 928 if (!classifier->is_valid_formal_parameter_initializer()) {
929 ReportClassifierError(classifier->formal_parameter_initializer_error()); 929 ReportClassifierError(classifier->formal_parameter_initializer_error());
930 *ok = false; 930 *ok = false;
931 } 931 }
932 } 932 }
933 933
934 void ValidateBindingPattern(const ExpressionClassifier* classifier, 934 void ValidateBindingPattern(const ExpressionClassifier* classifier,
935 bool* ok) { 935 bool* ok) {
936 if (!classifier->is_valid_binding_pattern() || 936 if (!classifier->is_valid_binding_pattern()) {
caitp 2016/08/19 23:04:34 If this passes tests, it looks great. At some poin
adamk 2016/08/19 23:07:42 Yeah, that was exactly my thinking (and it seems t
937 !classifier->is_valid_async_binding_pattern()) { 937 ReportClassifierError(classifier->binding_pattern_error());
938 const Scanner::Location& a = classifier->binding_pattern_error().location;
939 const Scanner::Location& b =
940 classifier->async_binding_pattern_error().location;
941 if (a.beg_pos < 0 || (b.beg_pos >= 0 && a.beg_pos > b.beg_pos)) {
942 ReportClassifierError(classifier->async_binding_pattern_error());
943 } else {
944 ReportClassifierError(classifier->binding_pattern_error());
945 }
946 *ok = false; 938 *ok = false;
947 } 939 }
948 } 940 }
949 941
950 void ValidateAssignmentPattern(const ExpressionClassifier* classifier, 942 void ValidateAssignmentPattern(const ExpressionClassifier* classifier,
951 bool* ok) { 943 bool* ok) {
952 if (!classifier->is_valid_assignment_pattern()) { 944 if (!classifier->is_valid_assignment_pattern()) {
953 ReportClassifierError(classifier->assignment_pattern_error()); 945 ReportClassifierError(classifier->assignment_pattern_error());
954 *ok = false; 946 *ok = false;
955 } 947 }
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 int beg_pos = peek_position(); 2773 int beg_pos = peek_position();
2782 switch (PeekAhead()) { 2774 switch (PeekAhead()) {
2783 case Token::RPAREN: 2775 case Token::RPAREN:
2784 case Token::RBRACK: 2776 case Token::RBRACK:
2785 case Token::RBRACE: 2777 case Token::RBRACE:
2786 case Token::ASSIGN: 2778 case Token::ASSIGN:
2787 case Token::COMMA: { 2779 case Token::COMMA: {
2788 Next(); 2780 Next();
2789 IdentifierT name = this->GetSymbol(scanner()); 2781 IdentifierT name = this->GetSymbol(scanner());
2790 2782
2791 // Possibly async arrow formals --- record ExpressionError just in case. 2783 classifier->RecordBindingPatternError(
2792 ExpressionUnexpectedToken(classifier);
2793 classifier->RecordAsyncBindingPatternError(
2794 Scanner::Location(beg_pos, scanner()->location().end_pos), 2784 Scanner::Location(beg_pos, scanner()->location().end_pos),
2795 MessageTemplate::kAwaitBindingIdentifier); 2785 MessageTemplate::kAwaitBindingIdentifier);
2796 classifier->RecordAsyncArrowFormalParametersError( 2786 classifier->RecordArrowFormalParametersError(
caitp 2016/08/19 23:04:34 good find!
2797 Scanner::Location(beg_pos, scanner()->location().end_pos), 2787 Scanner::Location(beg_pos, scanner()->location().end_pos),
2798 MessageTemplate::kAwaitBindingIdentifier); 2788 MessageTemplate::kAwaitBindingIdentifier);
2799 2789
2800 return this->ExpressionFromIdentifier(name, beg_pos, 2790 return this->ExpressionFromIdentifier(name, beg_pos,
2801 scanner()->location().end_pos); 2791 scanner()->location().end_pos);
2802 } 2792 }
2803 default: 2793 default:
2804 break; 2794 break;
2805 } 2795 }
2806 2796
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
3753 has_seen_constructor_ = true; 3743 has_seen_constructor_ = true;
3754 return; 3744 return;
3755 } 3745 }
3756 } 3746 }
3757 3747
3758 3748
3759 } // namespace internal 3749 } // namespace internal
3760 } // namespace v8 3750 } // namespace v8
3761 3751
3762 #endif // V8_PARSING_PARSER_BASE_H 3752 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/parsing/expression-classifier.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698