@@ -11,7 +11,12 @@ import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
1111import '../closure.dart' ;
1212import '../common.dart' ;
1313import '../common/backend_api.dart'
14- show Backend, ImpactTransformer, ForeignResolver, NativeRegistry;
14+ show
15+ Backend,
16+ BackendClasses,
17+ ImpactTransformer,
18+ ForeignResolver,
19+ NativeRegistry;
1520import '../common/codegen.dart' show CodegenImpact, CodegenWorkItem;
1621import '../common/names.dart' show Identifiers, Selectors, Uris;
1722import '../common/registry.dart' show Registry;
@@ -591,6 +596,7 @@ class JavaScriptBackend extends Backend {
591596
592597 final BackendHelpers helpers;
593598 final BackendImpacts impacts;
599+ BackendClasses backendClasses;
594600
595601 final JSFrontendAccess frontend;
596602
@@ -630,6 +636,7 @@ class JavaScriptBackend extends Backend {
630636 functionCompiler =
631637 new SsaFunctionCompiler (this , sourceInformationStrategy, useKernel);
632638 serialization = new JavaScriptBackendSerialization (this );
639+ backendClasses = new JavaScriptBackendClasses (helpers);
633640 }
634641
635642 ConstantSystem get constantSystem => constants.constantSystem;
@@ -925,7 +932,7 @@ class JavaScriptBackend extends Backend {
925932 if (elements == null ) return false ;
926933 if (elements.isEmpty) return false ;
927934 return elements.any ((element) {
928- return selector.applies (element, this ) &&
935+ return selector.applies (element) &&
929936 (mask == null ||
930937 mask.canHit (element, selector, compiler.closedWorld));
931938 });
@@ -1121,7 +1128,7 @@ class JavaScriptBackend extends Backend {
11211128 registerBackendUse (helpers.createRuntimeType);
11221129 }
11231130 impactBuilder.registerTypeUse (
1124- new TypeUse .instantiation (typeImplementation.rawType));
1131+ new TypeUse .instantiation (backendClasses. typeImplementation.rawType));
11251132 }
11261133 lookupMapAnalysis.registerConstantKey (constant);
11271134 }
@@ -1139,7 +1146,7 @@ class JavaScriptBackend extends Backend {
11391146 helpers.setRuntimeTypeInfo,
11401147 null ));
11411148 }
1142- if (type.element == typeImplementation) {
1149+ if (type.element == backendClasses. typeImplementation) {
11431150 // If we use a type literal in a constant, the compile time
11441151 // constant emitter will generate a call to the createRuntimeType
11451152 // helper so we register a use of that.
@@ -1897,30 +1904,6 @@ class JavaScriptBackend extends Backend {
18971904 return compiler.closedWorld.hasOnlySubclasses (classElement);
18981905 }
18991906
1900- bool isNullImplementation (ClassElement cls) {
1901- return cls == helpers.jsNullClass;
1902- }
1903-
1904- ClassElement get intImplementation => helpers.jsIntClass;
1905- ClassElement get uint32Implementation => helpers.jsUInt32Class;
1906- ClassElement get uint31Implementation => helpers.jsUInt31Class;
1907- ClassElement get positiveIntImplementation => helpers.jsPositiveIntClass;
1908- ClassElement get doubleImplementation => helpers.jsDoubleClass;
1909- ClassElement get numImplementation => helpers.jsNumberClass;
1910- ClassElement get stringImplementation => helpers.jsStringClass;
1911- ClassElement get listImplementation => helpers.jsArrayClass;
1912- ClassElement get constListImplementation => helpers.jsUnmodifiableArrayClass;
1913- ClassElement get fixedListImplementation => helpers.jsFixedArrayClass;
1914- ClassElement get growableListImplementation => helpers.jsExtendableArrayClass;
1915- ClassElement get mapImplementation => helpers.mapLiteralClass;
1916- ClassElement get constMapImplementation => helpers.constMapLiteralClass;
1917- ClassElement get typeImplementation => helpers.typeLiteralClass;
1918- ClassElement get boolImplementation => helpers.jsBoolClass;
1919- ClassElement get nullImplementation => helpers.jsNullClass;
1920- ClassElement get syncStarIterableImplementation => helpers.syncStarIterable;
1921- ClassElement get asyncFutureImplementation => helpers.futureImplementation;
1922- ClassElement get asyncStarStreamImplementation => helpers.controllerStream;
1923-
19241907 void registerStaticUse (Element element, Enqueuer enqueuer) {
19251908 if (element == helpers.disableTreeShakingMarker) {
19261909 isTreeShakingDisabled = true ;
@@ -3257,3 +3240,30 @@ class JavaScriptImpactStrategy extends ImpactStrategy {
32573240 }
32583241 }
32593242}
3243+
3244+ class JavaScriptBackendClasses implements BackendClasses {
3245+ final BackendHelpers helpers;
3246+
3247+ JavaScriptBackendClasses (this .helpers);
3248+
3249+ ClassElement get intImplementation => helpers.jsIntClass;
3250+ ClassElement get uint32Implementation => helpers.jsUInt32Class;
3251+ ClassElement get uint31Implementation => helpers.jsUInt31Class;
3252+ ClassElement get positiveIntImplementation => helpers.jsPositiveIntClass;
3253+ ClassElement get doubleImplementation => helpers.jsDoubleClass;
3254+ ClassElement get numImplementation => helpers.jsNumberClass;
3255+ ClassElement get stringImplementation => helpers.jsStringClass;
3256+ ClassElement get listImplementation => helpers.jsArrayClass;
3257+ ClassElement get constListImplementation => helpers.jsUnmodifiableArrayClass;
3258+ ClassElement get fixedListImplementation => helpers.jsFixedArrayClass;
3259+ ClassElement get growableListImplementation => helpers.jsExtendableArrayClass;
3260+ ClassElement get mapImplementation => helpers.mapLiteralClass;
3261+ ClassElement get constMapImplementation => helpers.constMapLiteralClass;
3262+ ClassElement get typeImplementation => helpers.typeLiteralClass;
3263+ ClassElement get boolImplementation => helpers.jsBoolClass;
3264+ ClassElement get nullImplementation => helpers.jsNullClass;
3265+ ClassElement get syncStarIterableImplementation => helpers.syncStarIterable;
3266+ ClassElement get asyncFutureImplementation => helpers.futureImplementation;
3267+ ClassElement get asyncStarStreamImplementation => helpers.controllerStream;
3268+ ClassElement get functionImplementation => helpers.coreClasses.functionClass;
3269+ }
0 commit comments