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

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

Issue 10441071: Use the typedef arity to know how to invoke a closure given by the dom. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 7 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: dart/lib/compiler/implementation/resolver.dart
===================================================================
--- dart/lib/compiler/implementation/resolver.dart (revision 8049)
+++ dart/lib/compiler/implementation/resolver.dart (working copy)
@@ -237,6 +237,10 @@
return measure(() => SignatureResolver.analyze(compiler, element));
}
+ FunctionSignature resolveTypedef(TypedefElement element) {
+ return measure(() => SignatureResolver.analyzeTypedef(compiler, element));
+ }
+
error(Node node, MessageKind kind, [arguments = const []]) {
ResolutionError message = new ResolutionError(kind, arguments);
compiler.reportError(node, message);
@@ -1130,12 +1134,7 @@
type = new InterfaceType(cls, arguments.toLink());
}
} else if (element.isTypedef()) {
- // TODO(ngeoffray): This is a hack to help us get support for the
- // DOM library.
- // TODO(ngeoffray): The list of types for the argument is wrong.
- type = new FunctionType(compiler.types.dynamicType,
- const EmptyLink<Type>(),
- element);
+ type = element.computeType(compiler);
} else if (element.isTypeVariable()) {
type = element.computeType(compiler);
} else {
@@ -1776,6 +1775,23 @@
returnType);
}
+ static FunctionSignature analyzeTypedef(Compiler compiler,
+ TypedefElement element) {
+ Typedef node =
+ compiler.parser.measure(() => element.parseNode(compiler));
+ SignatureResolver visitor = new SignatureResolver(compiler, element);
+ Link<Node> nodes = node.formals.nodes;
+ LinkBuilder<Element> parametersBuilder = visitor.analyzeNodes(nodes);
+ Link<Element> parameters = parametersBuilder.toLink();
+ Type returnType =
+ compiler.resolveTypeAnnotation(element, node.returnType);
+ return new FunctionSignature(parameters,
+ visitor.optionalParameters,
+ parametersBuilder.length,
+ visitor.optionalParameterCount,
+ returnType);
+ }
+
// TODO(ahe): This is temporary.
void resolveExpression(Node node) {
if (node == null) return;

Powered by Google App Engine
This is Rietveld 408576698