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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/signatures.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /** 7 /**
8 * [SignatureResolver] resolves function signatures. 8 * [SignatureResolver] resolves function signatures.
9 */ 9 */
10 class SignatureResolver extends CommonResolverVisitor<Element> { 10 class SignatureResolver extends CommonResolverVisitor<Element> {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 if (node.modifiers.isStatic()) { 57 if (node.modifiers.isStatic()) {
58 error(node, MessageKind.FORMAL_DECLARED_STATIC); 58 error(node, MessageKind.FORMAL_DECLARED_STATIC);
59 } 59 }
60 60
61 if (currentDefinitions != null) { 61 if (currentDefinitions != null) {
62 cancel(node, 'function type parameters not supported'); 62 cancel(node, 'function type parameters not supported');
63 } 63 }
64 currentDefinitions = node; 64 currentDefinitions = node;
65 Element element = definition.accept(this); 65 Element element = definition.accept(this);
66 if (currentDefinitions.metadata != null) {
67 // TODO(johnniwinther): Unify handling of metadata on locals/formals.
68 for (Link<Node> link = currentDefinitions.metadata.nodes;
69 !link.isEmpty;
70 link = link.tail) {
71 ParameterMetadataAnnotation metadata =
72 new ParameterMetadataAnnotation(link.head);
73 element.addMetadata(metadata);
74 addDeferredAction(element, () {
75 metadata.ensureResolved(compiler);
76 });
77 }
78 }
66 currentDefinitions = null; 79 currentDefinitions = null;
67 return element; 80 return element;
68 } 81 }
69 82
70 void validateName(Identifier node) { 83 void validateName(Identifier node) {
71 String name = node.source; 84 String name = node.source;
72 if (isOptionalParameter && 85 if (isOptionalParameter &&
73 optionalParametersAreNamed && 86 optionalParametersAreNamed &&
74 isPrivateName(node.source)) { 87 isPrivateName(node.source)) {
75 compiler.reportError(node, MessageKind.PRIVATE_NAMED_PARAMETER); 88 compiler.reportError(node, MessageKind.PRIVATE_NAMED_PARAMETER);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 node.accept(new ResolverVisitor(compiler, enclosingElement, 274 node.accept(new ResolverVisitor(compiler, enclosingElement,
262 new TreeElementMapping(enclosingElement))); 275 new TreeElementMapping(enclosingElement)));
263 } 276 }
264 277
265 // TODO(ahe): This is temporary. 278 // TODO(ahe): This is temporary.
266 ClassElement get currentClass { 279 ClassElement get currentClass {
267 return enclosingElement.isMember() 280 return enclosingElement.isMember()
268 ? enclosingElement.getEnclosingClass() : null; 281 ? enclosingElement.getEnclosingClass() : null;
269 } 282 }
270 } 283 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698