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

Side by Side Diff: src/parsing/preparser.h

Issue 1853763002: Allow constructor and method signatures in classes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@types-1849803002-intf-decl
Patch Set: Fix method type annotations in the preparser Created 4 years, 8 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
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_PREPARSER_H 5 #ifndef V8_PARSING_PREPARSER_H
6 #define V8_PARSING_PREPARSER_H 6 #define V8_PARSING_PREPARSER_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/hashmap.h" 10 #include "src/hashmap.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 TypeField::encode(kExpression) | 176 TypeField::encode(kExpression) |
177 ExpressionTypeField::encode(kSuperCallReference)); 177 ExpressionTypeField::encode(kSuperCallReference));
178 } 178 }
179 179
180 static PreParserExpression NoTemplateTag() { 180 static PreParserExpression NoTemplateTag() {
181 return PreParserExpression( 181 return PreParserExpression(
182 TypeField::encode(kExpression) | 182 TypeField::encode(kExpression) |
183 ExpressionTypeField::encode(kNoTemplateTagExpression)); 183 ExpressionTypeField::encode(kNoTemplateTagExpression));
184 } 184 }
185 185
186 static PreParserExpression Empty() {
187 return PreParserExpression(TypeField::encode(kEmptyExpression));
188 }
189
190 bool IsEmpty() const { return TypeField::decode(code_) == kEmptyExpression; }
191
186 bool IsIdentifier() const { 192 bool IsIdentifier() const {
187 return TypeField::decode(code_) == kIdentifierExpression; 193 return TypeField::decode(code_) == kIdentifierExpression;
188 } 194 }
189 195
190 PreParserIdentifier AsIdentifier() const { 196 PreParserIdentifier AsIdentifier() const {
191 DCHECK(IsIdentifier()); 197 DCHECK(IsIdentifier());
192 return PreParserIdentifier(IdentifierTypeField::decode(code_)); 198 return PreParserIdentifier(IdentifierTypeField::decode(code_));
193 } 199 }
194 200
195 bool IsAssignment() const { 201 bool IsAssignment() const {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // More dummy implementations of things PreParser doesn't need to track: 281 // More dummy implementations of things PreParser doesn't need to track:
276 void set_index(int index) {} // For YieldExpressions 282 void set_index(int index) {} // For YieldExpressions
277 void set_should_eager_compile() {} 283 void set_should_eager_compile() {}
278 284
279 int position() const { return RelocInfo::kNoPosition; } 285 int position() const { return RelocInfo::kNoPosition; }
280 void set_function_token_position(int position) {} 286 void set_function_token_position(int position) {}
281 287
282 private: 288 private:
283 enum Type { 289 enum Type {
284 kExpression, 290 kExpression,
291 kEmptyExpression,
285 kIdentifierExpression, 292 kIdentifierExpression,
286 kStringLiteralExpression, 293 kStringLiteralExpression,
287 kBinaryOperationExpression, 294 kBinaryOperationExpression,
288 kSpreadExpression, 295 kSpreadExpression,
289 kObjectLiteralExpression, 296 kObjectLiteralExpression,
290 kArrayLiteralExpression 297 kArrayLiteralExpression
291 }; 298 };
292 299
293 enum ExpressionType { 300 enum ExpressionType {
294 kThisExpression, 301 kThisExpression,
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 ParseErrorType error_type = kSyntaxError); 1005 ParseErrorType error_type = kSyntaxError);
999 1006
1000 // "null" return type creators. 1007 // "null" return type creators.
1001 static PreParserIdentifier EmptyIdentifier() { 1008 static PreParserIdentifier EmptyIdentifier() {
1002 return PreParserIdentifier::Default(); 1009 return PreParserIdentifier::Default();
1003 } 1010 }
1004 static PreParserIdentifier EmptyIdentifierString() { 1011 static PreParserIdentifier EmptyIdentifierString() {
1005 return PreParserIdentifier::Default(); 1012 return PreParserIdentifier::Default();
1006 } 1013 }
1007 static PreParserExpression EmptyExpression() { 1014 static PreParserExpression EmptyExpression() {
1008 return PreParserExpression::Default(); 1015 return PreParserExpression::Empty();
1009 } 1016 }
1010 static PreParserExpression EmptyLiteral() { 1017 static PreParserExpression EmptyLiteral() {
1011 return PreParserExpression::Default(); 1018 return PreParserExpression::Default();
1012 } 1019 }
1013 static PreParserExpression EmptyObjectLiteralProperty() { 1020 static PreParserExpression EmptyObjectLiteralProperty() {
1014 return PreParserExpression::Default(); 1021 return PreParserExpression::Default();
1015 } 1022 }
1016 static PreParserExpression EmptyFunctionLiteral() { 1023 static PreParserExpression EmptyFunctionLiteral() {
1017 return PreParserExpression::Default(); 1024 return PreParserExpression::Default();
1018 } 1025 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 } 1059 }
1053 static typesystem::PreParserType HoleTypeElement() { 1060 static typesystem::PreParserType HoleTypeElement() {
1054 return typesystem::PreParserType::Default(false); 1061 return typesystem::PreParserType::Default(false);
1055 } 1062 }
1056 static typesystem::PreParserTypeMembers EmptyTypeMembers() { 1063 static typesystem::PreParserTypeMembers EmptyTypeMembers() {
1057 return typesystem::PreParserTypeMembers(); 1064 return typesystem::PreParserTypeMembers();
1058 } 1065 }
1059 static typesystem::PreParserTypeMember EmptyTypeMember() { 1066 static typesystem::PreParserTypeMember EmptyTypeMember() {
1060 return typesystem::PreParserTypeMember::Default(false, false); 1067 return typesystem::PreParserTypeMember::Default(false, false);
1061 } 1068 }
1069 static bool IsEmptyExpression(const PreParserExpression& expression) {
1070 return expression.IsEmpty();
1071 }
1062 1072
1063 // Odd-ball literal creators. 1073 // Odd-ball literal creators.
1064 static PreParserExpression GetLiteralTheHole(int position, 1074 static PreParserExpression GetLiteralTheHole(int position,
1065 PreParserFactory* factory) { 1075 PreParserFactory* factory) {
1066 return PreParserExpression::Default(); 1076 return PreParserExpression::Default();
1067 } 1077 }
1068 1078
1069 // Producing data during the recursive descent. 1079 // Producing data during the recursive descent.
1070 PreParserIdentifier GetSymbol(Scanner* scanner); 1080 PreParserIdentifier GetSymbol(Scanner* scanner);
1071 PreParserIdentifier GetNumberAsSymbol(Scanner* scanner); 1081 PreParserIdentifier GetNumberAsSymbol(Scanner* scanner);
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 const PreParserFormalParameters& parameters, FunctionKind kind, 1495 const PreParserFormalParameters& parameters, FunctionKind kind,
1486 FunctionLiteral::FunctionType function_type, bool* ok) { 1496 FunctionLiteral::FunctionType function_type, bool* ok) {
1487 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters, 1497 return pre_parser_->ParseEagerFunctionBody(function_name, pos, parameters,
1488 kind, function_type, ok); 1498 kind, function_type, ok);
1489 } 1499 }
1490 1500
1491 } // namespace internal 1501 } // namespace internal
1492 } // namespace v8 1502 } // namespace v8
1493 1503
1494 #endif // V8_PARSING_PREPARSER_H 1504 #endif // V8_PARSING_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparser.cc » ('j') | test/cctest/test-parsing.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698