| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library native; | 5 library native; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 import 'dart2jslib.dart'; | 8 import 'dart2jslib.dart'; |
| 9 import 'dart_types.dart'; | 9 import 'dart_types.dart'; |
| 10 import 'elements/elements.dart'; | 10 import 'elements/elements.dart'; |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 Node node = listener.nodes.head; | 1038 Node node = listener.nodes.head; |
| 1039 if (node != null | 1039 if (node != null |
| 1040 && node.asIdentifier() != null | 1040 && node.asIdentifier() != null |
| 1041 && node.asIdentifier().source == 'native') { | 1041 && node.asIdentifier().source == 'native') { |
| 1042 nativeTagInfo = node.asIdentifier().token.next.value; | 1042 nativeTagInfo = node.asIdentifier().token.next.value; |
| 1043 listener.popNode(); | 1043 listener.popNode(); |
| 1044 } | 1044 } |
| 1045 return nativeTagInfo; | 1045 return nativeTagInfo; |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 bool isOverriddenMethod(FunctionElement element, | |
| 1049 ClassElement cls, | |
| 1050 NativeEmitter nativeEmitter) { | |
| 1051 List<ClassElement> subtypes = nativeEmitter.subtypes[cls]; | |
| 1052 if (subtypes == null) return false; | |
| 1053 for (ClassElement subtype in subtypes) { | |
| 1054 if (subtype.lookupLocalMember(element.name) != null) return true; | |
| 1055 } | |
| 1056 return false; | |
| 1057 } | |
| 1058 | |
| 1059 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$'); | 1048 final RegExp nativeRedirectionRegExp = new RegExp(r'^[a-zA-Z][a-zA-Z_$0-9]*$'); |
| 1060 | 1049 |
| 1061 void handleSsaNative(SsaBuilder builder, Expression nativeBody) { | 1050 void handleSsaNative(SsaBuilder builder, Expression nativeBody) { |
| 1062 Compiler compiler = builder.compiler; | 1051 Compiler compiler = builder.compiler; |
| 1063 FunctionElement element = builder.work.element; | 1052 FunctionElement element = builder.work.element; |
| 1064 NativeEmitter nativeEmitter = builder.emitter.nativeEmitter; | 1053 NativeEmitter nativeEmitter = builder.emitter.nativeEmitter; |
| 1065 JavaScriptBackend backend = builder.backend; | 1054 JavaScriptBackend backend = builder.backend; |
| 1066 | 1055 |
| 1067 HInstruction convertDartClosure(Element parameter, FunctionType type) { | 1056 HInstruction convertDartClosure(Element parameter, FunctionType type) { |
| 1068 HInstruction local = builder.localsHandler.readLocal(parameter); | 1057 HInstruction local = builder.localsHandler.readLocal(parameter); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 } | 1135 } |
| 1147 LiteralString jsCode = nativeBody.asLiteralString(); | 1136 LiteralString jsCode = nativeBody.asLiteralString(); |
| 1148 builder.push(new HForeign.statement( | 1137 builder.push(new HForeign.statement( |
| 1149 new js.LiteralStatement(jsCode.dartString.slowToString()), | 1138 new js.LiteralStatement(jsCode.dartString.slowToString()), |
| 1150 <HInstruction>[], | 1139 <HInstruction>[], |
| 1151 new SideEffects(), | 1140 new SideEffects(), |
| 1152 null, | 1141 null, |
| 1153 backend.dynamicType)); | 1142 backend.dynamicType)); |
| 1154 } | 1143 } |
| 1155 } | 1144 } |
| OLD | NEW |