| 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; | 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) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 visitNode(Node node) {} | 37 visitNode(Node node) {} |
| 38 | 38 |
| 39 visitSendSet(SendSet node) { | 39 visitSendSet(SendSet node) { |
| 40 final selector = node.selector; | 40 final selector = node.selector; |
| 41 final name = node.assignmentOperator.source.stringValue; | 41 final name = node.assignmentOperator.source.stringValue; |
| 42 final arguments = node.arguments; | 42 final arguments = node.arguments; |
| 43 | 43 |
| 44 expect(node, arguments != null); | 44 expect(node, arguments != null); |
| 45 expect(node, selector is Identifier, 'selector is not assignable'); | 45 expect(node, |
| 46 selector is Identifier || selector is FunctionExpression, |
| 47 'selector is not assignable'); |
| 46 if (identical(name, '++') || identical(name, '--')) { | 48 if (identical(name, '++') || identical(name, '--')) { |
| 47 expect(node, node.assignmentOperator is Operator); | 49 expect(node, node.assignmentOperator is Operator); |
| 48 if (node.isIndex) { | 50 if (node.isIndex) { |
| 49 expect(node.arguments.tail.head, node.arguments.tail.isEmpty); | 51 expect(node.arguments.tail.head, node.arguments.tail.isEmpty); |
| 50 } else { | 52 } else { |
| 51 expect(node.arguments.head, node.arguments.isEmpty); | 53 expect(node.arguments.head, node.arguments.isEmpty); |
| 52 } | 54 } |
| 53 } else { | 55 } else { |
| 54 expect(node, !node.arguments.isEmpty); | 56 expect(node, !node.arguments.isEmpty); |
| 55 } | 57 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 69 final String message; | 71 final String message; |
| 70 InvalidNodeError(this.node, [this.message]); | 72 InvalidNodeError(this.node, [this.message]); |
| 71 | 73 |
| 72 toString() { | 74 toString() { |
| 73 String nodeString = node.toDebugString(); | 75 String nodeString = node.toDebugString(); |
| 74 String result = 'invalid node: $nodeString'; | 76 String result = 'invalid node: $nodeString'; |
| 75 if (message != null) result = '$result ($message)'; | 77 if (message != null) result = '$result ($message)'; |
| 76 return result; | 78 return result; |
| 77 } | 79 } |
| 78 } | 80 } |
| OLD | NEW |