OLD | NEW |
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; | |
6 | |
7 class TreeValidatorTask extends CompilerTask { | 5 class TreeValidatorTask extends CompilerTask { |
8 TreeValidatorTask(Compiler compiler) : super(compiler); | 6 TreeValidatorTask(Compiler compiler) : super(compiler); |
9 | 7 |
10 void validate(Node tree) { | 8 void validate(Node tree) { |
11 assert(check(tree)); | 9 assert(check(tree)); |
12 } | 10 } |
13 | 11 |
14 bool check(Node tree) { | 12 bool check(Node tree) { |
15 List<InvalidNodeError> errors = []; | 13 List<InvalidNodeError> errors = []; |
16 void report(node, message) { | 14 void report(node, message) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 final String message; | 67 final String message; |
70 InvalidNodeError(this.node, [this.message]); | 68 InvalidNodeError(this.node, [this.message]); |
71 | 69 |
72 toString() { | 70 toString() { |
73 String nodeString = node.toDebugString(); | 71 String nodeString = node.toDebugString(); |
74 String result = 'invalid node: $nodeString'; | 72 String result = 'invalid node: $nodeString'; |
75 if (message != null) result = '$result ($message)'; | 73 if (message != null) result = '$result ($message)'; |
76 return result; | 74 return result; |
77 } | 75 } |
78 } | 76 } |
OLD | NEW |