| Index: sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
|
| index 8733590ed263b5ee00b7ebc00161ac5db0f8e590..87a5036cdf2112d988a24e26cb6ee01d2ecb8fa7 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
|
| @@ -276,13 +276,18 @@ class TypeTestEmitter extends CodeEmitterHelper {
|
| }
|
| }
|
|
|
| - void emitRuntimeTypeSupport(CodeBuffer buffer) {
|
| + void emitRuntimeTypeSupport(CodeBuffer buffer, OutputUnit outputUnit) {
|
| task.addComment('Runtime type support', buffer);
|
| RuntimeTypes rti = backend.rti;
|
| TypeChecks typeChecks = rti.requiredChecks;
|
|
|
| // Add checks to the constructors of instantiated classes.
|
| + // TODO(sigurdm): We should avoid running through this list for each
|
| + // output unit.
|
| for (ClassElement cls in typeChecks) {
|
| + OutputUnit destination =
|
| + compiler.deferredLoadTask.outputUnitForElement(cls);
|
| + if (destination != outputUnit) continue;
|
| // TODO(9556). The properties added to 'holder' should be generated
|
| // directly as properties of the class object, not added later.
|
| String holder = namer.isolateAccess(backend.getImplementationClass(cls));
|
| @@ -306,12 +311,20 @@ class TypeTestEmitter extends CodeEmitterHelper {
|
| buffer.write(jsAst.prettyPrint(encoding, compiler));
|
| buffer.add('$N');
|
| }
|
| + if (outputUnit == compiler.deferredLoadTask.mainOutputUnit) {
|
| + // TODO(sigurdm): These should also be possibly deferred.
|
| + // They should be handled similarly to constants.
|
| + // They have 3 dependencies:
|
| + // 1. The libraries containing the check.
|
| + // 2. The typedef defining it.
|
| + // 3. The types involved in the typedef.
|
| + // TODO(sigurdm): Actually these seems to never be used. Remove them.
|
| + checkedNonGenericFunctionTypes.forEach(addSignature);
|
| + checkedGenericFunctionTypes.forEach((_, Set<FunctionType> functionTypes) {
|
| + functionTypes.forEach(addSignature);
|
| + });
|
| + }
|
|
|
| - checkedNonGenericFunctionTypes.forEach(addSignature);
|
| -
|
| - checkedGenericFunctionTypes.forEach((_, Set<FunctionType> functionTypes) {
|
| - functionTypes.forEach(addSignature);
|
| - });
|
| }
|
|
|
| /**
|
|
|