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

Side by Side 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, 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 #library('elements'); 5 #library('elements');
6 6
7 #import('../tree/tree.dart'); 7 #import('../tree/tree.dart');
8 #import('../scanner/scannerlib.dart'); 8 #import('../scanner/scannerlib.dart');
9 #import('../leg.dart'); // TODO(karlklose): we only need type. 9 #import('../leg.dart'); // TODO(karlklose): we only need type.
10 #import('../util/util.dart'); 10 #import('../util/util.dart');
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 lookupLocalMember(SourceString memberName) => imported[memberName]; 349 lookupLocalMember(SourceString memberName) => imported[memberName];
350 350
351 Type computeType(Compiler compiler) => compiler.types.dynamicType; 351 Type computeType(Compiler compiler) => compiler.types.dynamicType;
352 352
353 Token position() => firstPosition; 353 Token position() => firstPosition;
354 } 354 }
355 355
356 class TypedefElement extends Element { 356 class TypedefElement extends Element {
357 final Token token; 357 final Token token;
358 Type cachedType; 358 Type cachedType;
359 Node cachedNode;
ahe 2012/05/29 12:32:08 The type should be Typedef.
ngeoffray 2012/05/29 13:06:28 Done.
359 360
360 TypedefElement(SourceString name, Element enclosing, this.token) 361 TypedefElement(SourceString name, Element enclosing, this.token)
361 : super(name, ElementKind.TYPEDEF, enclosing) { 362 : super(name, ElementKind.TYPEDEF, enclosing) {
362 cachedType = new InterfaceType(this); 363 cachedType = new InterfaceType(this);
363 } 364 }
364 365
366 Node parseNode(Compiler compiler) {
ahe 2012/05/29 12:32:08 I would prefer if this followed the "PartialFuncti
ngeoffray 2012/05/29 13:06:28 Done.
367 if (cachedNode !== null) return cachedNode;
368 NodeListener listener = new NodeListener(compiler, enclosingElement);
369 Parser parser = new Parser(listener);
370 Token token = parser.parseTopLevelDeclaration(token);
371 cachedNode = listener.popNode();
372 assert(listener.nodes.isEmpty());
kasperl 2012/05/29 12:16:24 Maybe cancel with an internal error instead?
ahe 2012/05/29 12:32:08 This is consistent with other code.
373 return cachedNode;
374 }
375
365 position() => findMyName(token); 376 position() => findMyName(token);
366 377
367 Type computeType(Compiler compiler) => cachedType; 378 Type computeType(Compiler compiler) => cachedType;
368 } 379 }
369 380
370 class VariableElement extends Element { 381 class VariableElement extends Element {
371 final VariableListElement variables; 382 final VariableListElement variables;
372 Expression cachedNode; // The send or the identifier in the variables list. 383 Expression cachedNode; // The send or the identifier in the variables list.
373 384
374 Modifiers get modifiers() => variables.modifiers; 385 Modifiers get modifiers() => variables.modifiers;
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 final Node node; 1057 final Node node;
1047 Type bound; 1058 Type bound;
1048 Type type; 1059 Type type;
1049 TypeVariableElement(name, Element enclosing, this.node, this.type, 1060 TypeVariableElement(name, Element enclosing, this.node, this.type,
1050 [this.bound]) 1061 [this.bound])
1051 : super(name, ElementKind.TYPE_VARIABLE, enclosing); 1062 : super(name, ElementKind.TYPE_VARIABLE, enclosing);
1052 Type computeType(compiler) => type; 1063 Type computeType(compiler) => type;
1053 Node parseNode(compiler) => node; 1064 Node parseNode(compiler) => node;
1054 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; 1065 toString() => "${enclosingElement.toString()}.${name.slowToString()}";
1055 } 1066 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698