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

Unified Diff: lib/compiler/implementation/resolver.dart

Issue 10701091: Dartdoc and Apidoc updated to use dart2js through the mirror system. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: create-sdk.py updated Created 8 years, 5 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: lib/compiler/implementation/resolver.dart
diff --git a/lib/compiler/implementation/resolver.dart b/lib/compiler/implementation/resolver.dart
index 284387ffcc078d670f8a98e353c2c67fb0dd3c89..51b51a14cbdb7cb29489fd500cf47a77f8a608b3 100644
--- a/lib/compiler/implementation/resolver.dart
+++ b/lib/compiler/implementation/resolver.dart
@@ -139,7 +139,7 @@ class ResolverTask extends CompilerTask {
} else if (tree.initializers != null) {
error(tree, MessageKind.FUNCTION_WITH_INITIALIZER);
}
- visitor.visit(tree.body);
+ visitBody(visitor, tree.body);
// Resolve the type annotations encountered in the method.
while (!toResolve.isEmpty()) {
@@ -153,6 +153,10 @@ class ResolverTask extends CompilerTask {
});
}
+ void visitBody(ResolverVisitor visitor, Statement body) {
+ visitor.visit(body);
+ }
+
void resolveConstructorImplementation(FunctionElement constructor,
FunctionExpression node) {
if (constructor.defaultImplementation !== constructor) return;
@@ -1947,11 +1951,22 @@ class SignatureResolver extends CommonResolverVisitor<Element> {
} else if (enclosingElement.kind !== ElementKind.GENERATIVE_CONSTRUCTOR) {
error(node, MessageKind.FIELD_PARAMETER_NOT_ALLOWED, []);
} else {
- if (node.selector.asIdentifier() == null) {
- cancel(node,
- 'internal error: unimplemented receiver on parameter send');
+ SourceString name;
kasperl 2012/07/06 12:40:41 Would it make sense to factor this code (the compu
Johnni Winther 2012/07/09 14:57:18 For clarity only. I don't think the computation is
+ var identifier = node.selector.asIdentifier();
+ if (identifier !== null) {
+ // Normal parameter: [:Type name:].
+ name = identifier.source;
+ } else {
+ // Function type parameter: [:void name(Type arg):].
+ var functionExpression = node.selector.asFunctionExpression();
+ if (functionExpression !== null &&
+ functionExpression.name.asIdentifier() !== null) {
+ name = functionExpression.name.asIdentifier().source;
+ } else {
+ cancel(node,
+ 'internal error: unimplemented receiver on parameter send');
+ }
}
- SourceString name = node.selector.asIdentifier().source;
Element fieldElement = currentClass.lookupLocalMember(name);
if (fieldElement === null || fieldElement.kind !== ElementKind.FIELD) {
error(node, MessageKind.NOT_A_FIELD, [name]);
@@ -1960,7 +1975,7 @@ class SignatureResolver extends CommonResolverVisitor<Element> {
}
Element variables = new VariableListElement.node(currentDefinitions,
ElementKind.VARIABLE_LIST, enclosingElement);
- element = new FieldParameterElement(node.selector.asIdentifier().source,
+ element = new FieldParameterElement(name,
fieldElement, variables, enclosingElement, node);
}
return element;

Powered by Google App Engine
This is Rietveld 408576698