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 'package:front_end/src/fasta/parser.dart' | 7 import 'package:front_end/src/fasta/parser.dart' |
8 show FormalParameterKind, IdentifierContext, MemberKind; | 8 show FormalParameterKind, IdentifierContext, MemberKind; |
9 import 'package:front_end/src/fasta/scanner.dart' show Token; | 9 import 'package:front_end/src/fasta/scanner.dart' show Token; |
10 import 'package:front_end/src/scanner/token.dart' show TokenType; | 10 import 'package:front_end/src/scanner/token.dart' show TokenType; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // TODO(sigmund): consider moving metadata into each declaration | 130 // TODO(sigmund): consider moving metadata into each declaration |
131 // element instead. | 131 // element instead. |
132 Node node = popNode(); // top-level declaration | 132 Node node = popNode(); // top-level declaration |
133 popNode(); // Discard metadata | 133 popNode(); // Discard metadata |
134 pushNode(node); | 134 pushNode(node); |
135 super.endTopLevelDeclaration(token); | 135 super.endTopLevelDeclaration(token); |
136 } | 136 } |
137 | 137 |
138 @override | 138 @override |
139 void beginCompilationUnit(Token token) { | 139 void beginCompilationUnit(Token token) { |
| 140 super.beginCompilationUnit(token); |
140 invalidTopLevelDeclarationCount = 0; | 141 invalidTopLevelDeclarationCount = 0; |
141 } | 142 } |
142 | 143 |
143 @override | 144 @override |
144 void endCompilationUnit(int count, Token token) { | 145 void endCompilationUnit(int count, Token token) { |
145 pushNode(makeNodeList( | 146 pushNode(makeNodeList( |
146 count - invalidTopLevelDeclarationCount, null, null, '\n')); | 147 count - invalidTopLevelDeclarationCount, null, null, '\n')); |
147 } | 148 } |
148 | 149 |
149 @override | 150 @override |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 } | 1080 } |
1080 lastErrorWasNativeFunctionBody = false; | 1081 lastErrorWasNativeFunctionBody = false; |
1081 } | 1082 } |
1082 | 1083 |
1083 void internalError({Token token, Node node}) { | 1084 void internalError({Token token, Node node}) { |
1084 // TODO(ahe): This should call reporter.internalError. | 1085 // TODO(ahe): This should call reporter.internalError. |
1085 Spannable spannable = (token == null) ? node : token; | 1086 Spannable spannable = (token == null) ? node : token; |
1086 failedAt(spannable, 'Internal error in parser.'); | 1087 failedAt(spannable, 'Internal error in parser.'); |
1087 } | 1088 } |
1088 } | 1089 } |
OLD | NEW |