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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.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/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index af629c483ecf84a7f98210b320a8563f2f0e752a..ecd62c3d4e76ba067d6eb088f036a9b01397411f 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -1196,7 +1196,7 @@ class ResolverTask extends CompilerTask {
namedParameterTypes);
}
- void resolveMetadataAnnotation(PartialMetadataAnnotation annotation) {
+ void resolveMetadataAnnotation(MetadataAnnotationX annotation) {
compiler.withCurrentElement(annotation.annotatedElement, () => measure(() {
assert(annotation.resolutionState == STATE_NOT_STARTED);
annotation.resolutionState = STATE_STARTED;
@@ -2959,14 +2959,15 @@ class ResolverVisitor extends MappingVisitor<Element> {
VariableDefinitionsVisitor visitor =
new VariableDefinitionsVisitor(compiler, node, this,
ElementKind.VARIABLE);
+ VariableListElement variables = visitor.variables;
// Ensure that we set the type of the [VariableListElement] since it depends
// on the current scope. If the current scope is a [MethodScope] or
// [BlockScope] it will not be available for the
// [VariableListElement.computeType] method.
if (node.type != null) {
- visitor.variables.type = resolveTypeAnnotation(node.type);
+ variables.type = resolveTypeAnnotation(node.type);
} else {
- visitor.variables.type = compiler.types.dynamicType;
+ variables.type = compiler.types.dynamicType;
}
Modifiers modifiers = node.modifiers;
@@ -2998,6 +2999,19 @@ class ResolverVisitor extends MappingVisitor<Element> {
reportExtraModifier('static');
}
}
+ if (node.metadata != null) {
+ // TODO(johnniwinther): Unify handling of metadata on locals/formals.
+ for (Link<Node> link = node.metadata.nodes;
+ !link.isEmpty;
+ link = link.tail) {
+ ParameterMetadataAnnotation metadata =
+ new ParameterMetadataAnnotation(link.head);
+ variables.addMetadata(metadata);
+ addDeferredAction(variables, () {
floitsch 2014/02/06 23:09:46 why do we need to defer the action?
+ metadata.ensureResolved(compiler);
+ });
+ }
+ }
visitor.visit(node.definitions);
}

Powered by Google App Engine
This is Rietveld 408576698