Chromium Code Reviews| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 116 |
| 117 Node parseNode(DiagnosticListener listener) { | 117 Node parseNode(DiagnosticListener listener) { |
| 118 listener.cancel("Internal Error: $this.parseNode", token: position()); | 118 listener.cancel("Internal Error: $this.parseNode", token: position()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 Type computeType(Compiler compiler) { | 121 Type computeType(Compiler compiler) { |
| 122 compiler.internalError("$this.computeType.", token: position()); | 122 compiler.internalError("$this.computeType.", token: position()); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void addMetadata(MetadataAnnotation annotation) { | 125 void addMetadata(MetadataAnnotation annotation) { |
| 126 assert(annotation.annotatedElement === null); | |
| 127 annotation.annotatedElement = this; | |
| 126 metadata = metadata.prepend(annotation); | 128 metadata = metadata.prepend(annotation); |
| 127 } | 129 } |
| 128 | 130 |
| 129 bool isFunction() => kind === ElementKind.FUNCTION; | 131 bool isFunction() => kind === ElementKind.FUNCTION; |
| 130 bool isConstructor() => isFactoryConstructor() || isGenerativeConstructor(); | 132 bool isConstructor() => isFactoryConstructor() || isGenerativeConstructor(); |
| 131 bool isClosure() => false; | 133 bool isClosure() => false; |
| 132 bool isMember() { | 134 bool isMember() { |
| 133 // Check that this element is defined in the scope of a Class. | 135 // Check that this element is defined in the scope of a Class. |
| 134 Element enclosing = enclosingElement; | 136 Element enclosing = enclosingElement; |
| 135 if (enclosing !== null && | 137 if (enclosing !== null && |
| (...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1592 * are the same compile-time constant, [: const Data() :]. | 1594 * are the same compile-time constant, [: const Data() :]. |
| 1593 * | 1595 * |
| 1594 * The mirror system does not have a concept matching this class. | 1596 * The mirror system does not have a concept matching this class. |
| 1595 */ | 1597 */ |
| 1596 class MetadataAnnotation { | 1598 class MetadataAnnotation { |
| 1597 /** | 1599 /** |
| 1598 * The compile-time constant which this annotation resolves to. | 1600 * The compile-time constant which this annotation resolves to. |
| 1599 * In the mirror system, this would be an object mirror. | 1601 * In the mirror system, this would be an object mirror. |
| 1600 */ | 1602 */ |
| 1601 abstract Constant get value(); | 1603 abstract Constant get value(); |
| 1604 Element annotatedElement; | |
| 1605 int resolutionState; | |
| 1602 | 1606 |
| 1603 // TODO(ahe): Add more functionality as needed. | 1607 MetadataAnnotation([this.resolutionState = ClassElement.STATE_NOT_STARTED]); |
|
ngeoffray
2012/08/22 21:57:54
Should these constant values be on some other plac
ahe
2012/08/23 05:43:34
Done.
| |
| 1608 | |
| 1609 abstract Node parseNode(DiagnosticListener listener); | |
| 1610 | |
| 1611 MetadataAnnotation ensureResolved(Compiler compiler) { | |
| 1612 if (resolutionState == ClassElement.STATE_NOT_STARTED) { | |
| 1613 compiler.resolver.resolveMetadataAnnotation(this); | |
| 1614 } | |
| 1615 return this; | |
| 1616 } | |
| 1617 | |
| 1618 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | |
| 1604 } | 1619 } |
| OLD | NEW |