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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element get currentElement; 8 Element get currentElement;
9 Setlet<Node> get superUses; 9 Setlet<Node> get superUses;
10 10
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 optionalParameterTypes = optionalParameterTypesBuilder.toLink(); 1189 optionalParameterTypes = optionalParameterTypesBuilder.toLink();
1190 } 1190 }
1191 return new FunctionType(element, 1191 return new FunctionType(element,
1192 signature.returnType, 1192 signature.returnType,
1193 parameterTypes.toLink(), 1193 parameterTypes.toLink(),
1194 optionalParameterTypes, 1194 optionalParameterTypes,
1195 namedParameters, 1195 namedParameters,
1196 namedParameterTypes); 1196 namedParameterTypes);
1197 } 1197 }
1198 1198
1199 void resolveMetadataAnnotation(PartialMetadataAnnotation annotation) { 1199 void resolveMetadataAnnotation(MetadataAnnotationX annotation) {
1200 compiler.withCurrentElement(annotation.annotatedElement, () => measure(() { 1200 compiler.withCurrentElement(annotation.annotatedElement, () => measure(() {
1201 assert(annotation.resolutionState == STATE_NOT_STARTED); 1201 assert(annotation.resolutionState == STATE_NOT_STARTED);
1202 annotation.resolutionState = STATE_STARTED; 1202 annotation.resolutionState = STATE_STARTED;
1203 1203
1204 Node node = annotation.parseNode(compiler); 1204 Node node = annotation.parseNode(compiler);
1205 Element annotatedElement = annotation.annotatedElement; 1205 Element annotatedElement = annotation.annotatedElement;
1206 Element context = annotatedElement.enclosingElement; 1206 Element context = annotatedElement.enclosingElement;
1207 if (context == null) { 1207 if (context == null) {
1208 context = annotatedElement; 1208 context = annotatedElement;
1209 } 1209 }
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after
2952 2952
2953 visitThrow(Throw node) { 2953 visitThrow(Throw node) {
2954 compiler.backend.registerThrowExpression(mapping); 2954 compiler.backend.registerThrowExpression(mapping);
2955 visit(node.expression); 2955 visit(node.expression);
2956 } 2956 }
2957 2957
2958 visitVariableDefinitions(VariableDefinitions node) { 2958 visitVariableDefinitions(VariableDefinitions node) {
2959 VariableDefinitionsVisitor visitor = 2959 VariableDefinitionsVisitor visitor =
2960 new VariableDefinitionsVisitor(compiler, node, this, 2960 new VariableDefinitionsVisitor(compiler, node, this,
2961 ElementKind.VARIABLE); 2961 ElementKind.VARIABLE);
2962 VariableListElement variables = visitor.variables;
2962 // Ensure that we set the type of the [VariableListElement] since it depends 2963 // Ensure that we set the type of the [VariableListElement] since it depends
2963 // on the current scope. If the current scope is a [MethodScope] or 2964 // on the current scope. If the current scope is a [MethodScope] or
2964 // [BlockScope] it will not be available for the 2965 // [BlockScope] it will not be available for the
2965 // [VariableListElement.computeType] method. 2966 // [VariableListElement.computeType] method.
2966 if (node.type != null) { 2967 if (node.type != null) {
2967 visitor.variables.type = resolveTypeAnnotation(node.type); 2968 variables.type = resolveTypeAnnotation(node.type);
2968 } else { 2969 } else {
2969 visitor.variables.type = compiler.types.dynamicType; 2970 variables.type = compiler.types.dynamicType;
2970 } 2971 }
2971 2972
2972 Modifiers modifiers = node.modifiers; 2973 Modifiers modifiers = node.modifiers;
2973 void reportExtraModifier(String modifier) { 2974 void reportExtraModifier(String modifier) {
2974 Node modifierNode; 2975 Node modifierNode;
2975 for (Link<Node> nodes = modifiers.nodes.nodes; 2976 for (Link<Node> nodes = modifiers.nodes.nodes;
2976 !nodes.isEmpty; 2977 !nodes.isEmpty;
2977 nodes = nodes.tail) { 2978 nodes = nodes.tail) {
2978 if (modifier == nodes.head.asIdentifier().source) { 2979 if (modifier == nodes.head.asIdentifier().source) {
2979 modifierNode = nodes.head; 2980 modifierNode = nodes.head;
(...skipping 11 matching lines...) Expand all
2991 reportExtraModifier('var'); 2992 reportExtraModifier('var');
2992 } 2993 }
2993 if (enclosingElement.isFunction()) { 2994 if (enclosingElement.isFunction()) {
2994 if (modifiers.isAbstract()) { 2995 if (modifiers.isAbstract()) {
2995 reportExtraModifier('abstract'); 2996 reportExtraModifier('abstract');
2996 } 2997 }
2997 if (modifiers.isStatic()) { 2998 if (modifiers.isStatic()) {
2998 reportExtraModifier('static'); 2999 reportExtraModifier('static');
2999 } 3000 }
3000 } 3001 }
3002 if (node.metadata != null) {
3003 // TODO(johnniwinther): Unify handling of metadata on locals/formals.
3004 for (Link<Node> link = node.metadata.nodes;
3005 !link.isEmpty;
3006 link = link.tail) {
3007 ParameterMetadataAnnotation metadata =
3008 new ParameterMetadataAnnotation(link.head);
3009 variables.addMetadata(metadata);
3010 addDeferredAction(variables, () {
floitsch 2014/02/06 23:09:46 why do we need to defer the action?
3011 metadata.ensureResolved(compiler);
3012 });
3013 }
3014 }
3001 visitor.visit(node.definitions); 3015 visitor.visit(node.definitions);
3002 } 3016 }
3003 3017
3004 visitWhile(While node) { 3018 visitWhile(While node) {
3005 visit(node.condition); 3019 visit(node.condition);
3006 visitLoopBodyIn(node, node.body, new BlockScope(scope)); 3020 visitLoopBodyIn(node, node.body, new BlockScope(scope));
3007 } 3021 }
3008 3022
3009 visitParenthesizedExpression(ParenthesizedExpression node) { 3023 visitParenthesizedExpression(ParenthesizedExpression node) {
3010 bool oldSendIsMemberAccess = sendIsMemberAccess; 3024 bool oldSendIsMemberAccess = sendIsMemberAccess;
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
4505 return finishConstructorReference(visit(expression), 4519 return finishConstructorReference(visit(expression),
4506 expression, expression); 4520 expression, expression);
4507 } 4521 }
4508 } 4522 }
4509 4523
4510 /// Looks up [name] in [scope] and unwraps the result. 4524 /// Looks up [name] in [scope] and unwraps the result.
4511 Element lookupInScope(Compiler compiler, Node node, 4525 Element lookupInScope(Compiler compiler, Node node,
4512 Scope scope, String name) { 4526 Scope scope, String name) {
4513 return Elements.unwrap(scope.lookup(name), compiler, node); 4527 return Elements.unwrap(scope.lookup(name), compiler, node);
4514 } 4528 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698