Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1256)

Unified Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 155703004: Support parameter metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/elements/modelx.dart
diff --git a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index b52189b9b4f7d7b51079b2cf7f30f92cb0b5d050..0ddf9ef111525fce67139df287e3b3891a3c6aa2 100644
--- a/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -1140,6 +1140,12 @@ class VariableElementX extends ElementX implements VariableElement {
variables = null,
super(name, kind, enclosing);
+ void addMetadata(MetadataAnnotation metadata) {
+ variables.addMetadata(metadata);
+ }
+
+ Link<MetadataAnnotation> get metadata => variables.metadata;
+
Node parseNode(DiagnosticListener listener) {
if (cachedNode != null) return cachedNode;
VariableDefinitions definitions = variables.parseNode(listener);
@@ -2461,7 +2467,7 @@ abstract class MetadataAnnotationX implements MetadataAnnotation {
* The compile-time constant which this annotation resolves to.
* In the mirror system, this would be an object mirror.
*/
- Constant get value;
+ Constant value;
Element annotatedElement;
int resolutionState;
@@ -2479,5 +2485,20 @@ abstract class MetadataAnnotationX implements MetadataAnnotation {
return this;
}
+ Node parseNode(DiagnosticListener listener);
+
String toString() => 'MetadataAnnotation($value, $resolutionState)';
}
+
+/// Metadata annotation on a parameter.
+class ParameterMetadataAnnotation extends MetadataAnnotationX {
+ final Metadata metadata;
+
+ ParameterMetadataAnnotation(Metadata this.metadata);
+
+ Node parseNode(DiagnosticListener listener) => metadata.expression;
+
+ Token get beginToken => metadata.getBeginToken();
+
+ Token get endToken => metadata.getEndToken();
+}

Powered by Google App Engine
This is Rietveld 408576698