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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/tree_validator.dart

Issue 169763003: Update dart2js diagnostics to prepare for filtering. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove optional Uri. Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 part of dart2js; 5 part of dart2js;
6 6
7 class TreeValidatorTask extends CompilerTask { 7 class TreeValidatorTask extends CompilerTask {
8 TreeValidatorTask(Compiler compiler) : super(compiler); 8 TreeValidatorTask(Compiler compiler) : super(compiler);
9 9
10 void validate(Node tree) { 10 void validate(Node tree) {
11 assert(check(tree)); 11 assert(check(tree));
12 } 12 }
13 13
14 bool check(Node tree) { 14 bool check(Node tree) {
15 List<InvalidNodeError> errors = []; 15 List<InvalidNodeError> errors = [];
16 void report(node, message) { 16 void report(node, message) {
17 final error = new InvalidNodeError(node, message); 17 final error = new InvalidNodeError(node, message);
18 errors.add(error); 18 errors.add(error);
19 compiler.reportWarning(node, message); 19 compiler.reportWarning(node, MessageKind.GENERIC, {'text': message});
20 }; 20 };
21 final validator = new ValidatorVisitor(report); 21 final validator = new ValidatorVisitor(report);
22 tree.accept(new TraversingVisitor(validator)); 22 tree.accept(new TraversingVisitor(validator));
23 23
24 return errors.isEmpty; 24 return errors.isEmpty;
25 } 25 }
26 } 26 }
27 27
28 class ValidatorVisitor extends Visitor { 28 class ValidatorVisitor extends Visitor {
29 final Function reportInvalidNode; 29 final Function reportInvalidNode;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 final String message; 71 final String message;
72 InvalidNodeError(this.node, [this.message]); 72 InvalidNodeError(this.node, [this.message]);
73 73
74 toString() { 74 toString() {
75 String nodeString = node.toDebugString(); 75 String nodeString = node.toDebugString();
76 String result = 'invalid node: $nodeString'; 76 String result = 'invalid node: $nodeString';
77 if (message != null) result = '$result ($message)'; 77 if (message != null) result = '$result ($message)';
78 return result; 78 return result;
79 } 79 }
80 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698