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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart

Issue 1318043005: Support user generated custom native JS classes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: about to land Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart ('k') | pkg/compiler/lib/src/native/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698