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