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

Unified Diff: pkg/compiler/lib/src/js_emitter/program_builder.dart

Issue 896763003: dart2js: emit noSuchMethod stubs in the new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
Index: pkg/compiler/lib/src/js_emitter/program_builder.dart
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder.dart
index 912ab3754d8d9cd0035b4a5a56a02f0fde1027b7..18ccb1a1e14748021ed235c5a48a2172cf3df753 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder.dart
@@ -300,7 +300,10 @@ class ProgramBuilder {
bool onlyForRti = _task.typeTestRegistry.rtiNeededClasses.contains(element);
List<Method> methods = [];
- List<StubMethod> callStubs = <StubMethod>[];
+ List<StubMethod> stubs = <StubMethod>[];
+
+ ClassStubGenerator classStubGenerator =
+ new ClassStubGenerator(_compiler, namer, backend);
void visitMember(ClassElement enclosing, Element member) {
assert(invariant(element, member.isDeclaration));
@@ -316,17 +319,24 @@ class ProgramBuilder {
Set<Selector> selectors =
_compiler.codegenWorld.invokedNames[member.name];
if (selectors != null && !selectors.isEmpty) {
- ClassStubGenerator generator =
- new ClassStubGenerator(_compiler, namer, backend);
+
Map<String, js.Expression> callStubsForMember =
- generator.generateCallStubsForGetter(member, selectors);
+ classStubGenerator.generateCallStubsForGetter(member, selectors);
callStubsForMember.forEach((String name, js.Expression code) {
- callStubs.add(_buildStubMethod(name, code, element: member));
+ stubs.add(_buildStubMethod(name, code, element: member));
});
}
}
}
+ if (element == _compiler.objectClass) {
+ Map<String, Selector> selectors =
+ classStubGenerator.computeSelectorsForNsmHandlers();
+ selectors.forEach((String name, Selector selector) {
+ stubs.add(classStubGenerator.generateStubForNoSuchMethod(selector));
+ });
+ }
+
ClassElement implementation = element.implementation;
// MixinApplications run through the members of their mixin. Here, we are
@@ -367,7 +377,7 @@ class ProgramBuilder {
name, holder,
instanceFields,
staticFieldsForReflection,
- callStubs,
+ stubs,
isChecks,
typeTests.functionTypeIndex,
isDirectlyInstantiated: isInstantiated,
@@ -376,7 +386,7 @@ class ProgramBuilder {
result = new Class(element,
name, holder, methods, instanceFields,
staticFieldsForReflection,
- callStubs,
+ stubs,
isChecks,
typeTests.functionTypeIndex,
isDirectlyInstantiated: isInstantiated,

Powered by Google App Engine
This is Rietveld 408576698