| 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 #library('elements'); | 5 #library('elements'); |
| 6 | 6 |
| 7 #import('dart:uri'); | 7 #import('dart:uri'); |
| 8 | 8 |
| 9 #import('../tree/tree.dart'); | 9 #import('../tree/tree.dart'); |
| 10 #import('../scanner/scannerlib.dart'); | 10 #import('../scanner/scannerlib.dart'); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 static bool isInvalid(Element e) => e == null || e.isErroneous(); | 297 static bool isInvalid(Element e) => e == null || e.isErroneous(); |
| 298 } | 298 } |
| 299 | 299 |
| 300 /** | 300 /** |
| 301 * Represents an unresolvable or duplicated element. | 301 * Represents an unresolvable or duplicated element. |
| 302 * | 302 * |
| 303 * An [ErroneousElement] is used instead of [null] to provide additional | 303 * An [ErroneousElement] is used instead of [null] to provide additional |
| 304 * information about the error that caused the element to be unresolvable | 304 * information about the error that caused the element to be unresolvable |
| 305 * or otherwise invalid. | 305 * or otherwise invalid. |
| 306 * | 306 * |
| 307 * Accessing any field or calling any method defined on [Element] except | 307 * Accessing any field or calling any method defined on [ErroneousElement] |
| 308 * [isValid] will currently throw an exception. (This might change when we | 308 * except [isErroneous] will currently throw an exception. (This might |
| 309 * actually want more information on the erroneous element, e.g., the name | 309 * change when we actually want more information on the erroneous element, |
| 310 * of the element we were trying to resolve.) | 310 * e.g., the name of the element we were trying to resolve.) |
| 311 * | 311 * |
| 312 * Code that cannot not handle an [ErroneousElement] should use | 312 * Code that cannot not handle an [ErroneousElement] should use |
| 313 * [: Element.isInvalid(element) :] | 313 * [: Element.isInvalid(element) :] |
| 314 * to check for unresolvable elements instead of | 314 * to check for unresolvable elements instead of |
| 315 * [: element == null :]. | 315 * [: element == null :]. |
| 316 */ | 316 */ |
| 317 class ErroneousElement extends Element { | 317 class ErroneousElement extends Element { |
| 318 final Message errorMessage; | 318 final Message errorMessage; |
| 319 | 319 |
| 320 ErroneousElement(this.errorMessage, Element enclosing) | 320 ErroneousElement(this.errorMessage, Element enclosing) |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 | 1624 |
| 1625 MetadataAnnotation ensureResolved(Compiler compiler) { | 1625 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 1626 if (resolutionState == STATE_NOT_STARTED) { | 1626 if (resolutionState == STATE_NOT_STARTED) { |
| 1627 compiler.resolver.resolveMetadataAnnotation(this); | 1627 compiler.resolver.resolveMetadataAnnotation(this); |
| 1628 } | 1628 } |
| 1629 return this; | 1629 return this; |
| 1630 } | 1630 } |
| 1631 | 1631 |
| 1632 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1632 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 1633 } | 1633 } |
| OLD | NEW |