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

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

Issue 1839393002: Add parsing for type aliases (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@types-1841093002-fun-decl
Patch Set: 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 case Token::CONST: 186 case Token::CONST:
187 if (allow_const()) { 187 if (allow_const()) {
188 return ParseVariableStatement(kStatementListItem, ok); 188 return ParseVariableStatement(kStatementListItem, ok);
189 } 189 }
190 break; 190 break;
191 case Token::LET: 191 case Token::LET:
192 if (IsNextLetKeyword()) { 192 if (IsNextLetKeyword()) {
193 return ParseVariableStatement(kStatementListItem, ok); 193 return ParseVariableStatement(kStatementListItem, ok);
194 } 194 }
195 break; 195 break;
196 case Token::IDENTIFIER: {
197 if (!scope_->typed()) break;
198 int pos = peek_position();
199 if (CheckContextualKeyword(CStrVector("type"))) {
200 return ParseTypeAliasDeclaration(pos, ok);
201 }
202 break;
203 }
204 // TODO(nikolaos): interface
205 // TODO(nikolaos): ambient
196 default: 206 default:
197 break; 207 break;
198 } 208 }
199 return ParseStatement(ok); 209 return ParseStatement(ok);
200 } 210 }
201 211
202 212
203 void PreParser::ParseStatementList(int end_token, bool* ok, 213 void PreParser::ParseStatementList(int end_token, bool* ok,
204 Scanner::BookmarkScope* bookmark) { 214 Scanner::BookmarkScope* bookmark) {
205 // SourceElements :: 215 // SourceElements ::
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 Expect(Token::RBRACE, CHECK_OK); 1204 Expect(Token::RBRACE, CHECK_OK);
1195 return PreParserExpression::Default(); 1205 return PreParserExpression::Default();
1196 } 1206 }
1197 } 1207 }
1198 1208
1199 #undef CHECK_OK 1209 #undef CHECK_OK
1200 1210
1201 1211
1202 } // namespace internal 1212 } // namespace internal
1203 } // namespace v8 1213 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698