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

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/listener.dart

Issue 2567133002: Add support for the new function-type syntax. (Closed)
Patch Set: Fixes after rebase. Created 3 years, 9 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.parser.listener; 5 library fasta.parser.listener;
6 6
7 import '../scanner/token.dart' show BeginGroupToken, Token; 7 import '../scanner/token.dart' show BeginGroupToken, Token;
8 8
9 import '../util/link.dart' show Link; 9 import '../util/link.dart' show Link;
10 10
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 void handleFunctionBodySkipped(Token token) {} 237 void handleFunctionBodySkipped(Token token) {}
238 238
239 void beginFunctionName(Token token) {} 239 void beginFunctionName(Token token) {}
240 240
241 void endFunctionName(Token token) { 241 void endFunctionName(Token token) {
242 logEvent("FunctionName"); 242 logEvent("FunctionName");
243 } 243 }
244 244
245 void beginFunctionTypeAlias(Token token) {} 245 void beginFunctionTypeAlias(Token token) {}
246 246
247 /// Handle the end of a typedef declaration. Substructures: 247 /// Handle the end of a typedef declaration.
248 ///
249 /// If [equals] is null, then we have the following substructures:
248 /// - Metadata 250 /// - Metadata
249 /// - Return type 251 /// - Return type
250 /// - Name (identifier) 252 /// - Name (identifier)
251 /// - Type variables 253 /// - Template variables (type variables to the template)
252 /// - Formal parameters 254 /// - Formal parameters
253 void endFunctionTypeAlias(Token typedefKeyword, Token endToken) { 255 ///
256 /// If [equals] is not null, then the have the following substructures:
257 /// - Metadata
258 /// - Name (identifier)
259 /// - Template variables (type variables to the template)
260 /// - Type (FunctionTypeAnnotation)
261 void endFunctionTypeAlias(
262 Token typedefKeyword, Token equals, Token endToken) {
254 logEvent("FunctionTypeAlias"); 263 logEvent("FunctionTypeAlias");
255 } 264 }
256 265
257 void beginMixinApplication(Token token) {} 266 void beginMixinApplication(Token token) {}
258 267
259 /// Handle the end of a mixin application construct (e.g. "A with B, C"). 268 /// Handle the end of a mixin application construct (e.g. "A with B, C").
260 /// Substructures: 269 /// Substructures:
261 /// - supertype 270 /// - supertype
262 /// - mixin types (TypeList) 271 /// - mixin types (TypeList)
263 void endMixinApplication() { 272 void endMixinApplication() {
264 logEvent("MixinApplication"); 273 logEvent("MixinApplication");
265 } 274 }
266 275
267 void beginNamedMixinApplication(Token beginToken, Token name) {} 276 void beginNamedMixinApplication(Token beginToken, Token name) {}
268 277
269 /// Handle the end of a named mixin declaration. Substructures: 278 /// Handle the end of a named mixin declaration. Substructures:
270 /// - metadata 279 /// - metadata
271 /// - modifiers 280 /// - modifiers
272 /// - class name 281 /// - class name
273 /// - type variables 282 /// - type variables
274 /// - mixin application 283 /// - mixin application
275 /// - implemented types (TypeList) 284 /// - implemented types (TypeList)
276 /// 285 ///
277 /// TODO(paulberry,ahe): it seems incosistent that for a named mixin 286 /// TODO(paulberry,ahe): it seems inconsistent that for a named mixin
278 /// application, the implemented types are a TypeList, whereas for a class 287 /// application, the implemented types are a TypeList, whereas for a class
279 /// declaration, each implemented type is listed separately on the stack, and 288 /// declaration, each implemented type is listed separately on the stack, and
280 /// the number of implemented types is passed as a parameter. 289 /// the number of implemented types is passed as a parameter.
281 void endNamedMixinApplication(Token begin, Token classKeyword, Token equals, 290 void endNamedMixinApplication(Token begin, Token classKeyword, Token equals,
282 Token implementsKeyword, Token endToken) { 291 Token implementsKeyword, Token endToken) {
283 logEvent("NamedMixinApplication"); 292 logEvent("NamedMixinApplication");
284 } 293 }
285 294
286 void beginHide(Token hideKeyword) {} 295 void beginHide(Token hideKeyword) {}
287 296
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } 646 }
638 647
639 void handleFinallyBlock(Token finallyKeyword) { 648 void handleFinallyBlock(Token finallyKeyword) {
640 logEvent("FinallyBlock"); 649 logEvent("FinallyBlock");
641 } 650 }
642 651
643 void endTryStatement(int catchCount, Token tryKeyword, Token finallyKeyword) { 652 void endTryStatement(int catchCount, Token tryKeyword, Token finallyKeyword) {
644 logEvent("TryStatement"); 653 logEvent("TryStatement");
645 } 654 }
646 655
647 void endType(Token beginToken, Token endToken) { 656 void handleType(Token beginToken, Token endToken) {
648 logEvent("Type"); 657 logEvent("Type");
649 } 658 }
650 659
660 void handleNoName(Token token) {
661 logEvent("NoName");
662 }
663
664 void handleFunctionType(Token functionToken, Token endToken) {
665 logEvent("FunctionType");
666 }
667
651 void beginTypeArguments(Token token) {} 668 void beginTypeArguments(Token token) {}
652 669
653 void endTypeArguments(int count, Token beginToken, Token endToken) { 670 void endTypeArguments(int count, Token beginToken, Token endToken) {
654 logEvent("TypeArguments"); 671 logEvent("TypeArguments");
655 } 672 }
656 673
657 void handleNoTypeArguments(Token token) { 674 void handleNoTypeArguments(Token token) {
658 logEvent("NoTypeArguments"); 675 logEvent("NoTypeArguments");
659 } 676 }
660 677
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 944
928 final Map arguments; 945 final Map arguments;
929 946
930 ParserError(this.beginOffset, this.endOffset, this.kind, this.arguments); 947 ParserError(this.beginOffset, this.endOffset, this.kind, this.arguments);
931 948
932 ParserError.fromTokens(Token begin, Token end, ErrorKind kind, Map arguments) 949 ParserError.fromTokens(Token begin, Token end, ErrorKind kind, Map arguments)
933 : this(begin.charOffset, end.charOffset + end.charCount, kind, arguments); 950 : this(begin.charOffset, end.charOffset + end.charCount, kind, arguments);
934 951
935 String toString() => "@${beginOffset}: $kind $arguments"; 952 String toString() => "@${beginOffset}: $kind $arguments";
936 } 953 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698