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

Unified Diff: lib/compiler/implementation/native_emitter.dart

Issue 10413028: Also use the redirecting name in stubs for native methods. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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 | « no previous file | lib/compiler/implementation/native_handler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/native_emitter.dart
===================================================================
--- lib/compiler/implementation/native_emitter.dart (revision 7782)
+++ lib/compiler/implementation/native_emitter.dart (working copy)
@@ -26,10 +26,12 @@
// to its subclass if it sees an instance whose class is a subclass.
Set<FunctionElement> overriddenMethods;
- // Caches the methods that should just call a native JS
- // implementation.
+ // Caches the methods that have a native body.
Set<FunctionElement> nativeMethods;
+ // Caches the methods that redirect to a JS method.
+ Map<FunctionElement, String> redirectingMethods;
+
NativeEmitter(this.emitter)
: classesWithDynamicDispatch = new Set<ClassElement>(),
nativeClasses = new Set<ClassElement>(),
@@ -37,10 +39,15 @@
directSubtypes = new Map<ClassElement, List<ClassElement>>(),
overriddenMethods = new Set<FunctionElement>(),
nativeMethods = new Set<FunctionElement>(),
+ redirectingMethods = new Map<FunctionElement, String>(),
nativeBuffer = new StringBuffer();
Compiler get compiler() => emitter.compiler;
+ void addRedirectingMethod(FunctionElement element, String name) {
+ redirectingMethods[element] = name;
+ }
+
String get dynamicName() {
Element element = compiler.findHelper(
const SourceString('dynamicFunction'));
@@ -207,7 +214,8 @@
code.add(' return this.${compiler.namer.getName(member)}($arguments)');
} else {
// When calling a JS method, we call it with the native name.
- String name = member.name.slowToString();
+ String name = redirectingMethods[member];
+ if (name === null) name = member.name.slowToString();
code.add(' return this.$name($nativeArguments);');
}
« no previous file with comments | « no previous file | lib/compiler/implementation/native_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698