OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 // Function signatures used in the generation of runtime type information. | 7 // Function signatures used in the generation of runtime type information. |
8 typedef void FunctionTypeSignatureEmitter(Element method, | 8 typedef void FunctionTypeSignatureEmitter(Element method, |
9 FunctionType methodType); | 9 FunctionType methodType); |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 assert(invariant(classElement, classElement.isDeclaration)); | 61 assert(invariant(classElement, classElement.isDeclaration)); |
62 | 62 |
63 TypeTestProperties result = new TypeTestProperties(); | 63 TypeTestProperties result = new TypeTestProperties(); |
64 | 64 |
65 /// Generates an is-test if the test is not inherited from a superclass | 65 /// Generates an is-test if the test is not inherited from a superclass |
66 /// This assumes that for every class an is-tests is generated | 66 /// This assumes that for every class an is-tests is generated |
67 /// dynamically at runtime. We also always generate tests against | 67 /// dynamically at runtime. We also always generate tests against |
68 /// native classes. | 68 /// native classes. |
69 /// TODO(herhut): Generate tests for native classes dynamically, as well. | 69 /// TODO(herhut): Generate tests for native classes dynamically, as well. |
70 void generateIsTest(Element other) { | 70 void generateIsTest(Element other) { |
71 if (classElement.isNative || | 71 if (classElement.isJsInterop || classElement.isNative || |
72 !classElement.isSubclassOf(other)) { | 72 !classElement.isSubclassOf(other)) { |
73 result.properties[namer.operatorIs(other)] = js('1'); | 73 result.properties[namer.operatorIs(other)] = js('1'); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 void generateFunctionTypeSignature(FunctionElement method, | 77 void generateFunctionTypeSignature(FunctionElement method, |
78 FunctionType type) { | 78 FunctionType type) { |
79 assert(method.isImplementation); | 79 assert(method.isImplementation); |
80 jsAst.Expression thisAccess = new jsAst.This(); | 80 jsAst.Expression thisAccess = new jsAst.This(); |
81 ClosureClassMap closureData = | 81 ClosureClassMap closureData = |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 js.number(index)); | 313 js.number(index)); |
314 } | 314 } |
315 jsAst.Expression convertRtiToRuntimeType = backend.emitter | 315 jsAst.Expression convertRtiToRuntimeType = backend.emitter |
316 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); | 316 .staticFunctionAccess(backend.findHelper('convertRtiToRuntimeType')); |
317 | 317 |
318 return new StubMethod(name, | 318 return new StubMethod(name, |
319 js('function () { return #(#) }', | 319 js('function () { return #(#) }', |
320 [convertRtiToRuntimeType, computeTypeVariable])); | 320 [convertRtiToRuntimeType, computeTypeVariable])); |
321 } | 321 } |
322 } | 322 } |
OLD | NEW |