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

Side by Side Diff: src/parsing/parser.cc

Issue 1839393002: Add parsing for type aliases (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@types-1841093002-fun-decl
Patch Set: More tests and allow type as an indentifier 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
« no previous file with comments | « src/parsing/parser.h ('k') | src/parsing/parser-base.h » ('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 #include "src/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-rewriter.h" 9 #include "src/ast/ast-expression-rewriter.h"
10 #include "src/ast/ast-expression-visitor.h" 10 #include "src/ast/ast-expression-visitor.h"
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 return ParseVariableStatement(kStatementListItem, NULL, ok); 1282 return ParseVariableStatement(kStatementListItem, NULL, ok);
1283 } 1283 }
1284 break; 1284 break;
1285 case Token::VAR: 1285 case Token::VAR:
1286 return ParseVariableStatement(kStatementListItem, NULL, ok); 1286 return ParseVariableStatement(kStatementListItem, NULL, ok);
1287 case Token::LET: 1287 case Token::LET:
1288 if (IsNextLetKeyword()) { 1288 if (IsNextLetKeyword()) {
1289 return ParseVariableStatement(kStatementListItem, NULL, ok); 1289 return ParseVariableStatement(kStatementListItem, NULL, ok);
1290 } 1290 }
1291 break; 1291 break;
1292 case Token::IDENTIFIER: {
1293 if (!scope_->typed()) break;
1294 int pos = peek_position();
1295 if (PeekContextualKeyword(CStrVector("type")) &&
1296 PeekAhead() == Token::IDENTIFIER) {
1297 Consume(Token::IDENTIFIER);
1298 return ParseTypeAliasDeclaration(pos, ok);
1299 }
1300 break;
1301 }
1302 // TODO(nikolaos): interface
1303 // TODO(nikolaos): ambient
1292 default: 1304 default:
1293 break; 1305 break;
1294 } 1306 }
1295 return ParseStatement(NULL, ok); 1307 return ParseStatement(NULL, ok);
1296 } 1308 }
1297 1309
1298 1310
1299 Statement* Parser::ParseModuleItem(bool* ok) { 1311 Statement* Parser::ParseModuleItem(bool* ok) {
1300 // (Ecma 262 6th Edition, 15.2): 1312 // (Ecma 262 6th Edition, 15.2):
1301 // ModuleItem : 1313 // ModuleItem :
(...skipping 5678 matching lines...) Expand 10 before | Expand all | Expand 10 after
6980 try_block, target); 6992 try_block, target);
6981 final_loop = target; 6993 final_loop = target;
6982 } 6994 }
6983 6995
6984 return final_loop; 6996 return final_loop;
6985 } 6997 }
6986 6998
6987 6999
6988 } // namespace internal 7000 } // namespace internal
6989 } // namespace v8 7001 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698