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

Side by Side Diff: pkg/compiler/lib/src/tree/nodes.dart

Issue 2778213002: Use message.yaml in parser. (Closed)
Patch Set: Update subpackage relationships. Created 3 years, 8 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) 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 '../common.dart'; 7 import '../common.dart';
8 import '../elements/elements.dart' show MetadataAnnotation; 8 import '../elements/elements.dart' show MetadataAnnotation;
9 import 'package:front_end/src/fasta/scanner/precedence.dart' as Precedence 9 import 'package:front_end/src/fasta/scanner/precedence.dart' as Precedence
10 show FUNCTION_INFO; 10 show FUNCTION_INFO;
11 import 'package:front_end/src/fasta/scanner.dart' show BeginGroupToken, Token; 11 import 'package:front_end/src/fasta/scanner.dart' show BeginGroupToken, Token;
12 import 'package:front_end/src/fasta/scanner/token_constants.dart' as Tokens 12 import 'package:front_end/src/fasta/scanner/token_constants.dart' as Tokens
13 show PLUS_TOKEN; 13 show PLUS_TOKEN;
14 import 'package:front_end/src/fasta/scanner/characters.dart'; 14 import 'package:front_end/src/fasta/scanner/characters.dart';
15 import '../util/util.dart'; 15 import '../util/util.dart';
16 import 'dartstring.dart'; 16 import 'dartstring.dart';
17 import 'prettyprint.dart'; 17 import 'prettyprint.dart';
18 import 'unparser.dart'; 18 import 'unparser.dart';
19 import 'package:front_end/src/fasta/parser.dart' show ErrorKind; 19 import 'package:front_end/src/fasta/fasta_codes.dart' show FastaMessage;
20 20
21 abstract class Visitor<R> { 21 abstract class Visitor<R> {
22 const Visitor(); 22 const Visitor();
23 23
24 R visitNode(Node node); 24 R visitNode(Node node);
25 25
26 R visitAssert(Assert node) => visitStatement(node); 26 R visitAssert(Assert node) => visitStatement(node);
27 R visitAsyncForIn(AsyncForIn node) => visitForIn(node); 27 R visitAsyncForIn(AsyncForIn node) => visitForIn(node);
28 R visitAsyncModifier(AsyncModifier node) => visitNode(node); 28 R visitAsyncModifier(AsyncModifier node) => visitNode(node);
29 R visitAwait(Await node) => visitExpression(node); 29 R visitAwait(Await node) => visitExpression(node);
(...skipping 3135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3165 bool visitStringJuxtaposition(StringJuxtaposition node) => 3165 bool visitStringJuxtaposition(StringJuxtaposition node) =>
3166 node.isInterpolation; 3166 node.isInterpolation;
3167 } 3167 }
3168 3168
3169 /// Erroneous node used to recover from parser errors. Implements various 3169 /// Erroneous node used to recover from parser errors. Implements various
3170 /// interfaces and provides bare minimum of implementation to avoid unnecessary 3170 /// interfaces and provides bare minimum of implementation to avoid unnecessary
3171 /// messages. 3171 /// messages.
3172 class ErrorNode extends Node 3172 class ErrorNode extends Node
3173 implements FunctionExpression, VariableDefinitions, Typedef { 3173 implements FunctionExpression, VariableDefinitions, Typedef {
3174 final Token token; 3174 final Token token;
3175 final ErrorKind kind; 3175 final FastaMessage message;
3176 final Map arguments;
3177 final Identifier name; 3176 final Identifier name;
3178 final NodeList definitions; 3177 final NodeList definitions;
3179 3178
3180 ErrorNode.internal( 3179 ErrorNode.internal(this.token, this.message, this.name, this.definitions);
3181 this.token, this.kind, this.arguments, this.name, this.definitions);
3182 3180
3183 factory ErrorNode(Token token, ErrorKind kind, Map arguments) { 3181 factory ErrorNode(Token token, FastaMessage message) {
3184 Identifier name = new Identifier(token); 3182 Identifier name = new Identifier(token);
3185 NodeList definitions = 3183 NodeList definitions =
3186 new NodeList(null, const Link<Node>().prepend(name), null, null); 3184 new NodeList(null, const Link<Node>().prepend(name), null, null);
3187 return new ErrorNode.internal(token, kind, arguments, name, definitions); 3185 return new ErrorNode.internal(token, message, name, definitions);
3188 } 3186 }
3189 3187
3190 Token get beginToken => token; 3188 Token get beginToken => token;
3191 Token get endToken => token; 3189 Token get endToken => token;
3192 3190
3193 Token getBeginToken() => token; 3191 Token getBeginToken() => token;
3194 3192
3195 Token getEndToken() => token; 3193 Token getEndToken() => token;
3196 3194
3197 accept(Visitor visitor) {} 3195 accept(Visitor visitor) {}
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3280 */ 3278 */
3281 Object getTreeElement(TreeElementMixin node) => node._element; 3279 Object getTreeElement(TreeElementMixin node) => node._element;
3282 3280
3283 /** 3281 /**
3284 * Do not call this method directly. Instead, use an instance of 3282 * Do not call this method directly. Instead, use an instance of
3285 * TreeElements. 3283 * TreeElements.
3286 */ 3284 */
3287 void setTreeElement(TreeElementMixin node, Object value) { 3285 void setTreeElement(TreeElementMixin node, Object value) {
3288 node._element = value; 3286 node._element = value;
3289 } 3287 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/parser/partial_elements.dart ('k') | pkg/front_end/lib/src/fasta/fasta_codes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698