OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.parser.node_listener; | 5 library dart2js.parser.node_listener; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../elements/elements.dart' show CompilationUnitElement; | 8 import '../elements/elements.dart' show CompilationUnitElement; |
9 import 'package:front_end/src/fasta/parser/parser.dart' | 9 import 'package:front_end/src/fasta/parser/parser.dart' |
10 show FormalParameterType; | 10 show FormalParameterType; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 constructor = new Send(classReference, name); | 295 constructor = new Send(classReference, name); |
296 } | 296 } |
297 pushNode(constructor); | 297 pushNode(constructor); |
298 } | 298 } |
299 | 299 |
300 @override | 300 @override |
301 void endRedirectingFactoryBody(Token beginToken, Token endToken) { | 301 void endRedirectingFactoryBody(Token beginToken, Token endToken) { |
302 pushNode(new RedirectingFactoryBody(beginToken, endToken, popNode())); | 302 pushNode(new RedirectingFactoryBody(beginToken, endToken, popNode())); |
303 } | 303 } |
304 | 304 |
| 305 void endExpressionFunctionBody(Token arrowToken, Token endToken) { |
| 306 endReturnStatement(true, arrowToken, endToken); |
| 307 } |
| 308 |
305 @override | 309 @override |
306 void endReturnStatement( | 310 void endReturnStatement( |
307 bool hasExpression, Token beginToken, Token endToken) { | 311 bool hasExpression, Token beginToken, Token endToken) { |
308 Expression expression = hasExpression ? popNode() : null; | 312 Expression expression = hasExpression ? popNode() : null; |
309 pushNode(new Return(beginToken, endToken, expression)); | 313 pushNode(new Return(beginToken, endToken, expression)); |
310 } | 314 } |
311 | 315 |
312 @override | 316 @override |
313 void endYieldStatement(Token yieldToken, Token starToken, Token endToken) { | 317 void endYieldStatement(Token yieldToken, Token starToken, Token endToken) { |
314 Expression expression = popNode(); | 318 Expression expression = popNode(); |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 } | 1009 } |
1006 lastErrorWasNativeFunctionBody = false; | 1010 lastErrorWasNativeFunctionBody = false; |
1007 } | 1011 } |
1008 | 1012 |
1009 void internalError({Token token, Node node}) { | 1013 void internalError({Token token, Node node}) { |
1010 // TODO(ahe): This should call reporter.internalError. | 1014 // TODO(ahe): This should call reporter.internalError. |
1011 Spannable spannable = (token == null) ? node : token; | 1015 Spannable spannable = (token == null) ? node : token; |
1012 throw new SpannableAssertionFailure(spannable, 'Internal error in parser.'); | 1016 throw new SpannableAssertionFailure(spannable, 'Internal error in parser.'); |
1013 } | 1017 } |
1014 } | 1018 } |
OLD | NEW |