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

Side by Side Diff: pkg/front_end/lib/src/fasta/source/diet_listener.dart

Issue 2728773002: Fix parsing [a]sync[*] function body modifiers with Fasta. (Closed)
Patch Set: Use endExpressionFunctionBody() instead of endReturnStatement(). 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.diet_listener; 5 library fasta.diet_listener;
6 6
7 import 'package:kernel/ast.dart' show AsyncMarker; 7 import 'package:kernel/ast.dart' show AsyncMarker;
8 8
9 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; 9 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
10 10
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 488
489 void parseFunctionBody(StackListener listener, Token token) { 489 void parseFunctionBody(StackListener listener, Token token) {
490 try { 490 try {
491 Parser parser = new Parser(listener); 491 Parser parser = new Parser(listener);
492 token = parser.parseFormalParametersOpt(token); 492 token = parser.parseFormalParametersOpt(token);
493 var formals = listener.pop(); 493 var formals = listener.pop();
494 listener.checkEmpty(token.charOffset); 494 listener.checkEmpty(token.charOffset);
495 listener.prepareInitializers(); 495 listener.prepareInitializers();
496 token = parser.parseInitializersOpt(token); 496 token = parser.parseInitializersOpt(token);
497 token = parser.parseAsyncModifier(token); 497 token = parser.parseAsyncModifier(token);
498 AsyncMarker asyncModifier = listener.pop(); 498 AsyncMarker asyncModifier =
499 astKind == AstKind.Analyzer ? null : listener.pop();
499 bool isExpression = false; 500 bool isExpression = false;
500 bool allowAbstract = true; 501 bool allowAbstract = true;
501 parser.parseFunctionBody(token, isExpression, allowAbstract); 502 parser.parseFunctionBody(token, isExpression, allowAbstract);
502 var body = listener.pop(); 503 var body = listener.pop();
503 listener.checkEmpty(token.charOffset); 504 listener.checkEmpty(token.charOffset);
504 listener.finishFunction(formals, asyncModifier, body); 505 listener.finishFunction(formals, asyncModifier, body);
505 } on InputError { 506 } on InputError {
506 rethrow; 507 rethrow;
507 } catch (e, s) { 508 } catch (e, s) {
508 throw new Crash(uri, token.charOffset, e, s); 509 throw new Crash(uri, token.charOffset, e, s);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 bool get isTargetingDartVm { 559 bool get isTargetingDartVm {
559 // TODO(ahe): Find a more reliable way to check if this is the Dart VM. 560 // TODO(ahe): Find a more reliable way to check if this is the Dart VM.
560 return !coreTypes.containsLibrary("dart:_js_helper"); 561 return !coreTypes.containsLibrary("dart:_js_helper");
561 } 562 }
562 563
563 @override 564 @override
564 void debugEvent(String name) { 565 void debugEvent(String name) {
565 // printEvent(name); 566 // printEvent(name);
566 } 567 }
567 } 568 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/parser.dart ('k') | pkg/front_end/lib/src/fasta/source/stack_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698