OLD | NEW |
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 import 'dart:collection' show IterableMixin; | 5 import 'dart:collection' show IterableMixin; |
6 | 6 |
7 import 'package:front_end/src/fasta/fasta_codes.dart' show FastaMessage; | 7 import 'package:front_end/src/fasta/fasta_codes.dart' show Message; |
8 import 'package:front_end/src/fasta/scanner.dart' show Token; | 8 import 'package:front_end/src/fasta/scanner.dart' show Token; |
9 import 'package:front_end/src/fasta/scanner/token_constants.dart' as Tokens | 9 import 'package:front_end/src/fasta/scanner/token_constants.dart' as Tokens |
10 show PLUS_TOKEN; | 10 show PLUS_TOKEN; |
11 import 'package:front_end/src/fasta/scanner/characters.dart'; | 11 import 'package:front_end/src/fasta/scanner/characters.dart'; |
12 import 'package:front_end/src/scanner/token.dart' show BeginToken, TokenType; | 12 import 'package:front_end/src/scanner/token.dart' show BeginToken, TokenType; |
13 | 13 |
14 import '../common.dart'; | 14 import '../common.dart'; |
15 import '../elements/elements.dart' show MetadataAnnotation; | 15 import '../elements/elements.dart' show MetadataAnnotation; |
16 import '../util/util.dart'; | 16 import '../util/util.dart'; |
17 import 'dartstring.dart'; | 17 import 'dartstring.dart'; |
(...skipping 3152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3170 bool visitStringJuxtaposition(StringJuxtaposition node) => | 3170 bool visitStringJuxtaposition(StringJuxtaposition node) => |
3171 node.isInterpolation; | 3171 node.isInterpolation; |
3172 } | 3172 } |
3173 | 3173 |
3174 /// Erroneous node used to recover from parser errors. Implements various | 3174 /// Erroneous node used to recover from parser errors. Implements various |
3175 /// interfaces and provides bare minimum of implementation to avoid unnecessary | 3175 /// interfaces and provides bare minimum of implementation to avoid unnecessary |
3176 /// messages. | 3176 /// messages. |
3177 class ErrorNode extends Node | 3177 class ErrorNode extends Node |
3178 implements FunctionExpression, VariableDefinitions, Typedef { | 3178 implements FunctionExpression, VariableDefinitions, Typedef { |
3179 final Token token; | 3179 final Token token; |
3180 final FastaMessage message; | 3180 final Message message; |
3181 final Identifier name; | 3181 final Identifier name; |
3182 final NodeList definitions; | 3182 final NodeList definitions; |
3183 | 3183 |
3184 ErrorNode.internal(this.token, this.message, this.name, this.definitions); | 3184 ErrorNode.internal(this.token, this.message, this.name, this.definitions); |
3185 | 3185 |
3186 factory ErrorNode(Token token, FastaMessage message) { | 3186 factory ErrorNode(Token token, Message message) { |
3187 Identifier name = new Identifier(token); | 3187 Identifier name = new Identifier(token); |
3188 NodeList definitions = | 3188 NodeList definitions = |
3189 new NodeList(null, const Link<Node>().prepend(name), null, null); | 3189 new NodeList(null, const Link<Node>().prepend(name), null, null); |
3190 return new ErrorNode.internal(token, message, name, definitions); | 3190 return new ErrorNode.internal(token, message, name, definitions); |
3191 } | 3191 } |
3192 | 3192 |
3193 Token get beginToken => token; | 3193 Token get beginToken => token; |
3194 Token get endToken => token; | 3194 Token get endToken => token; |
3195 | 3195 |
3196 Token getBeginToken() => token; | 3196 Token getBeginToken() => token; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3283 */ | 3283 */ |
3284 Object getTreeElement(TreeElementMixin node) => node._element; | 3284 Object getTreeElement(TreeElementMixin node) => node._element; |
3285 | 3285 |
3286 /** | 3286 /** |
3287 * Do not call this method directly. Instead, use an instance of | 3287 * Do not call this method directly. Instead, use an instance of |
3288 * TreeElements. | 3288 * TreeElements. |
3289 */ | 3289 */ |
3290 void setTreeElement(TreeElementMixin node, Object value) { | 3290 void setTreeElement(TreeElementMixin node, Object value) { |
3291 node._element = value; | 3291 node._element = value; |
3292 } | 3292 } |
OLD | NEW |