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

Side by Side 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, 6 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 interface TreeElements { 5 interface TreeElements {
6 Element operator[](Node node); 6 Element operator[](Node node);
7 Selector getSelector(Send send); 7 Selector getSelector(Send send);
8 Type getType(TypeAnnotation annotation); 8 Type getType(TypeAnnotation annotation);
9 } 9 }
10 10
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 report(node.typeArguments, MessageKind.MISSING_TYPE_ARGUMENT); 1123 report(node.typeArguments, MessageKind.MISSING_TYPE_ARGUMENT);
1124 } 1124 }
1125 } 1125 }
1126 if (cls.typeParameters.length == 0) { 1126 if (cls.typeParameters.length == 0) {
1127 // Return the canonical type if it has no type parameters. 1127 // Return the canonical type if it has no type parameters.
1128 type = cls.computeType(compiler); 1128 type = cls.computeType(compiler);
1129 } else { 1129 } else {
1130 type = new InterfaceType(cls, arguments.toLink()); 1130 type = new InterfaceType(cls, arguments.toLink());
1131 } 1131 }
1132 } else if (element.isTypedef()) { 1132 } else if (element.isTypedef()) {
1133 Typedef node = element.parseNode(compiler);
ahe 2012/05/29 12:32:08 Need to wrap this in compiler.withCurrentElement.
1134
1133 // TODO(ngeoffray): This is a hack to help us get support for the 1135 // TODO(ngeoffray): This is a hack to help us get support for the
1134 // DOM library. 1136 // DOM library.
1135 // TODO(ngeoffray): The list of types for the argument is wrong. 1137 LinkBuilder<Type> arguments = new LinkBuilder<Type>();
kasperl 2012/05/29 12:16:24 Factor this code out into a helper function with a
ngeoffray 2012/05/29 12:31:01 I moved the code to TypedefElement.computeType.
1138 for (Link<Node> formals = node.formals.nodes;
ahe 2012/05/29 12:32:08 I'm really concerned about this approach. You need
ngeoffray 2012/05/29 13:06:28 Done.
1139 !formals.isEmpty();
1140 formals = formals.tail) {
1141 arguments.addLast(compiler.types.dynamicType);
ahe 2012/05/29 12:32:08 Since you only build a list of dynamicType, you do
1142 }
1143
1136 type = new FunctionType(compiler.types.dynamicType, 1144 type = new FunctionType(compiler.types.dynamicType,
1137 const EmptyLink<Type>(), 1145 arguments.toLink(),
1138 element); 1146 element);
1139 } else if (element.isTypeVariable()) { 1147 } else if (element.isTypeVariable()) {
1140 type = element.computeType(compiler); 1148 type = element.computeType(compiler);
1141 } else { 1149 } else {
1142 compiler.cancel("unexpected element kind ${element.kind}", 1150 compiler.cancel("unexpected element kind ${element.kind}",
1143 node: node); 1151 node: node);
1144 } 1152 }
1145 } 1153 }
1146 return useType(node, type); 1154 return useType(node, type);
1147 } 1155 }
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 1949
1942 TopScope(LibraryElement library) : super(null, library); 1950 TopScope(LibraryElement library) : super(null, library);
1943 Element lookup(SourceString name) { 1951 Element lookup(SourceString name) {
1944 return library.find(name); 1952 return library.find(name);
1945 } 1953 }
1946 1954
1947 Element add(Element newElement) { 1955 Element add(Element newElement) {
1948 throw "Cannot add an element in the top scope"; 1956 throw "Cannot add an element in the top scope";
1949 } 1957 }
1950 } 1958 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698