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

Unified Diff: frog/leg/compiler.dart

Issue 9193016: Add the arity to calls, and support noSuchMethodException. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | « no previous file | frog/leg/emitter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/compiler.dart
===================================================================
--- frog/leg/compiler.dart (revision 3539)
+++ frog/leg/compiler.dart (working copy)
@@ -59,6 +59,7 @@
CompileTimeConstantHandler compileTimeConstantHandler;
static final SourceString MAIN = const SourceString('main');
+ static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod');
Compiler()
: types = new Types(),
@@ -133,6 +134,8 @@
// Make our special function a foreign kind.
universe.define(new ForeignElement(const SourceString('JS')));
universe.define(new ForeignElement(const SourceString('UNINTERCEPTED')));
+ // TODO(ngeoffray): Lazily add this method.
+ universe.invokedNames[NO_SUCH_METHOD] = new Set<int>.from(<int>[2]);
}
void enqueueInvokedInstanceMethods() {
@@ -147,9 +150,13 @@
for (Element member in currentClass.members) {
SourceString name = member.name;
if (Elements.isInstanceMethod(member) &&
- universe.generatedCode[member] === null &&
- universe.invokedNames.contains(name.stringValue)) {
- addToWorklist(member);
+ universe.generatedCode[member] === null) {
+ FunctionElement element = member;
+ Set<int> invocations = universe.invokedNames[name];
+ if (invocations != null
+ && invocations.contains(element.parameterCount(this))) {
+ addToWorklist(member);
+ }
}
}
}
@@ -219,16 +226,21 @@
addToWorklist(element);
}
- void registerDynamicInvocation(SourceString methodName) {
- universe.invokedNames.add(methodName.stringValue);
+ void registerDynamicInvocation(SourceString methodName, int arity) {
+ Set<int> existing = universe.invokedNames[methodName];
+ if (existing == null) {
+ universe.invokedNames[methodName] = new Set.from(<int>[arity]);
+ } else {
+ existing.add(arity);
+ }
}
void registerDynamicGetter(SourceString methodName) {
- universe.invokedGetters.add(methodName.stringValue);
+ universe.invokedGetters.add(methodName);
}
void registerDynamicSetter(SourceString methodName) {
- universe.invokedSetters.add(methodName.stringValue);
+ universe.invokedSetters.add(methodName);
}
void registerInstantiatedClass(ClassElement element) {
« no previous file with comments | « no previous file | frog/leg/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698