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

Unified Diff: dart/lib/compiler/implementation/elements/elements.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
« no previous file with comments | « dart/lib/compiler/implementation/compiler.dart ('k') | dart/lib/compiler/implementation/lib/js_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/compiler/implementation/elements/elements.dart
===================================================================
--- dart/lib/compiler/implementation/elements/elements.dart (revision 8049)
+++ dart/lib/compiler/implementation/elements/elements.dart (working copy)
@@ -354,17 +354,29 @@
}
class TypedefElement extends Element {
- final Token token;
Type cachedType;
+ Typedef cachedNode;
- TypedefElement(SourceString name, Element enclosing, this.token)
- : super(name, ElementKind.TYPEDEF, enclosing) {
- cachedType = new InterfaceType(this);
+ TypedefElement(SourceString name, Element enclosing)
+ : super(name, ElementKind.TYPEDEF, enclosing);
+
+ Type computeType(Compiler compiler) {
ahe 2012/05/29 13:21:50 I'm absolutely 100% lukewarm on this approach. Thi
+ if (cachedType !== null) return cachedType;
+ compiler.withCurrentElement(this, () {
+ FunctionSignature signature = compiler.resolveTypedef(this);
+ LinkBuilder<Type> parameterTypes = new LinkBuilder<Type>();
+ for (Link<Element> link = signature.requiredParameters;
+ !link.isEmpty();
+ link = link.tail) {
+ parameterTypes.addLast(link.head.computeType(compiler));
+ // TODO(karlklose): optional parameters.
+ }
+ cachedType = new FunctionType(compiler.types.dynamicType,
+ parameterTypes.toLink(),
+ this);
+ });
+ return cachedType;
}
-
- position() => findMyName(token);
-
- Type computeType(Compiler compiler) => cachedType;
}
class VariableElement extends Element {
« no previous file with comments | « dart/lib/compiler/implementation/compiler.dart ('k') | dart/lib/compiler/implementation/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698