| OLD | NEW |
| 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 class ValidatorListener implements DiagnosticListener { | 5 class ValidatorListener implements DiagnosticListener { |
| 6 final SourceFile sourceFile; | 6 final SourceFile sourceFile; |
| 7 | 7 |
| 8 ValidatorListener(this.sourceFile); | 8 ValidatorListener(this.sourceFile); |
| 9 | 9 |
| 10 void cancel([String reason, node, token, instruction, element]) { | 10 void cancel([String reason, node, token, instruction, element]) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 void check(Element element) { | 65 void check(Element element) { |
| 66 if (!validateUnparse) return; | 66 if (!validateUnparse) return; |
| 67 | 67 |
| 68 if (element is PartialFunctionElement) { | 68 if (element is PartialFunctionElement) { |
| 69 checkFunction(element); | 69 checkFunction(element); |
| 70 } else if (element.isGenerativeConstructor()) { | 70 } else if (element.isGenerativeConstructor()) { |
| 71 assert(element is FunctionElement); | 71 assert(element is FunctionElement); |
| 72 // Generative constructors parse to very special function expressions. | 72 // Generative constructors parse to very special function expressions. |
| 73 // Handle them when classes are properly handled. | 73 // Handle them when classes are properly handled. |
| 74 } else if (element.isField()) { | 74 } else if (element.isField() || element is AbstractFieldElement) { |
| 75 assert(element is VariableElement); | 75 assert(element is VariableElement || element is AbstractFieldElement); |
| 76 // Fields are just names with possible initialization expressions. | 76 // Fields are just names with possible initialization expressions. |
| 77 // Nothing to care about for now. | 77 // Nothing to care about for now. |
| 78 } else if (element is VoidElement) { |
| 79 // Nothing to do here. |
| 78 } else { | 80 } else { |
| 79 compiler.cancel('Cannot handle $element', element: element); | 81 compiler.cancel('Cannot handle $element'); |
| 80 } | 82 } |
| 81 } | 83 } |
| 82 } | 84 } |
| OLD | NEW |