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 #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 Loading... |
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 Loading... |
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 |
OLD | NEW |