Chromium Code Reviews| Index: frog/leg/native_handler.dart |
| =================================================================== |
| --- frog/leg/native_handler.dart (revision 4793) |
| +++ frog/leg/native_handler.dart (working copy) |
| @@ -161,8 +161,16 @@ |
| builder.add(thenInstruction); |
| } |
| - if (!element.isInstanceMember()) { |
| - // If the method is a non-instance method, we just generate a direct |
| + bool isNativeLiteral; |
|
kasperl
2012/03/02 13:11:33
Initialize to false?
ngeoffray
2012/03/05 08:28:00
Thanks for spotting this. I was convinced it would
|
| + if (element.enclosingElement.kind == ElementKind.CLASS) { |
| + ClassElement classElement = element.enclosingElement; |
| + String nativeName = classElement.nativeName.slowToString(); |
| + isNativeLiteral = |
| + builder.compiler.emitter.nativeEmitter.isNativeLiteral(nativeName); |
| + } |
| + if (!element.isInstanceMember() || isNativeLiteral) { |
| + // If the method is a non-instance method, or is a member of a native |
| + // class that represents a literal, we just generate a direct |
| // call to the native method. |
| visitThen(); |
| builder.stack.add(thenInstruction); |