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

Unified Diff: frog/leg/native_handler.dart

Issue 9633015: Map typeName getter to the global typeNameOf. This is a unspoken rule from the native interface :) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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
« client/tests/client/client-leg.status ('K') | « frog/leg/elements/elements.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/native_handler.dart
===================================================================
--- frog/leg/native_handler.dart (revision 5159)
+++ frog/leg/native_handler.dart (working copy)
@@ -137,10 +137,23 @@
compiler.registerStaticUse(
compiler.findHelper(new SourceString('captureStackTrace')));
+ FunctionElement element = builder.work.element;
kasperl 2012/03/08 13:22:00 Please add a comment here explaining what this doe
ngeoffray 2012/03/08 13:34:07 Done.
+ NativeEmitter nativeEmitter = compiler.emitter.nativeEmitter;
+ if (element.name == const SourceString('typeName')
+ && element.isGetter()
+ && nativeEmitter.toNativeName(element.enclosingElement) == 'DOMType') {
+ DartString jsCode = new DartString.literal(
+ '${nativeEmitter.typeNameOfName}(\$0)');
+ List<HInstruction> inputs =
+ <HInstruction>[builder.localsHandler.readThis()];
+ builder.push(new HForeign(
+ jsCode, const LiteralDartString('String'), inputs));
+ return;
+ }
+
if (node.arguments.isEmpty()) {
List<String> arguments = <String>[];
List<HInstruction> inputs = <HInstruction>[];
- FunctionElement element = builder.work.element;
FunctionParameters parameters = element.computeParameters(builder.compiler);
int i = 0;
String receiver = '';
« client/tests/client/client-leg.status ('K') | « frog/leg/elements/elements.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698