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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 pushNode(new EmptyStatement(token)); | 857 pushNode(new EmptyStatement(token)); |
858 } | 858 } |
859 | 859 |
860 @override | 860 @override |
861 void endFactoryMethod(Token beginToken, Token endToken) { | 861 void endFactoryMethod(Token beginToken, Token endToken) { |
862 super.endFactoryMethod(beginToken, endToken); | 862 super.endFactoryMethod(beginToken, endToken); |
863 Statement body = popNode(); | 863 Statement body = popNode(); |
864 AsyncModifier asyncModifier = popNode(); | 864 AsyncModifier asyncModifier = popNode(); |
865 NodeList formals = popNode(); | 865 NodeList formals = popNode(); |
866 Node name = popNode(); | 866 Node name = popNode(); |
| 867 popNode(); // Discard modifiers. They're recomputed below. |
867 | 868 |
868 // TODO(ahe): Move this parsing to the parser. | 869 // TODO(ahe): Move this parsing to the parser. |
869 int modifierCount = 0; | 870 int modifierCount = 0; |
870 Token modifier = beginToken; | 871 Token modifier = beginToken; |
871 if (modifier.stringValue == "external") { | 872 if (modifier.stringValue == "external") { |
872 handleModifier(modifier); | 873 handleModifier(modifier); |
873 modifierCount++; | 874 modifierCount++; |
874 modifier = modifier.next; | 875 modifier = modifier.next; |
875 } | 876 } |
876 if (modifier.stringValue == "const") { | 877 if (modifier.stringValue == "const") { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1011 } | 1012 } |
1012 lastErrorWasNativeFunctionBody = false; | 1013 lastErrorWasNativeFunctionBody = false; |
1013 } | 1014 } |
1014 | 1015 |
1015 void internalError({Token token, Node node}) { | 1016 void internalError({Token token, Node node}) { |
1016 // TODO(ahe): This should call reporter.internalError. | 1017 // TODO(ahe): This should call reporter.internalError. |
1017 Spannable spannable = (token == null) ? node : token; | 1018 Spannable spannable = (token == null) ? node : token; |
1018 throw new SpannableAssertionFailure(spannable, 'Internal error in parser.'); | 1019 throw new SpannableAssertionFailure(spannable, 'Internal error in parser.'); |
1019 } | 1020 } |
1020 } | 1021 } |
OLD | NEW |