Index: pkg/compiler/lib/src/js_backend/codegen/glue.dart |
diff --git a/pkg/compiler/lib/src/js_backend/codegen/glue.dart b/pkg/compiler/lib/src/js_backend/codegen/glue.dart |
index ec9918bf517246742126f737b05a8b8c38d7c0ce..6c75c839988b3ef1f16e3990e9e1df7c0a69145e 100644 |
--- a/pkg/compiler/lib/src/js_backend/codegen/glue.dart |
+++ b/pkg/compiler/lib/src/js_backend/codegen/glue.dart |
@@ -11,7 +11,7 @@ import '../../js/js.dart' as js; |
import '../../constants/values.dart'; |
import '../../elements/elements.dart'; |
import '../../constants/expressions.dart'; |
-import '../../dart_types.dart' show DartType, TypeVariableType; |
+import '../../dart_types.dart' show DartType, TypeVariableType, InterfaceType; |
/// Encapsulates the dependencies of the function-compiler to the compiler, |
/// backend and emitter. |
@@ -20,9 +20,14 @@ import '../../dart_types.dart' show DartType, TypeVariableType; |
class Glue { |
final Compiler _compiler; |
+ CodegenEnqueuer get enqueuer => _compiler.enqueuer.codegen; |
+ |
+ FunctionElement get getInterceptorMethod => _backend.getInterceptorMethod; |
+ |
JavaScriptBackend get _backend => _compiler.backend; |
CodeEmitterTask get _emitter => _backend.emitter; |
+ |
Namer get _namer => _backend.namer; |
Glue(this._compiler); |
@@ -71,10 +76,8 @@ class Glue { |
return _namer.invocationName(selector); |
} |
- FunctionElement get getInterceptorMethod => _backend.getInterceptorMethod; |
- |
void registerUseInterceptorInCodegen() { |
- _backend.registerUseInterceptor(_compiler.enqueuer.codegen); |
+ _backend.registerUseInterceptor(enqueuer); |
} |
bool isInterceptedSelector(Selector selector) { |
@@ -149,6 +152,10 @@ class Glue { |
return _backend.getGetTypeArgumentByIndex(); |
} |
+ FunctionElement getAddRuntimeTypeInformation() { |
+ return _backend.getSetRuntimeTypeInfo(); |
+ } |
+ |
js.Expression getSubstitutionName(ClassElement cls) { |
return js.string(_namer.substitutionName(cls)); |
} |
@@ -167,10 +174,6 @@ class Glue { |
}); |
} |
- FunctionElement getAddRuntimeTypeInformation() { |
- return _backend.getSetRuntimeTypeInfo(); |
- } |
- |
js.Expression generateTypeRepresentation(DartType dartType, |
List<js.Expression> arguments) { |
int variableIndex = 0; |
@@ -180,4 +183,37 @@ class Glue { |
assert(variableIndex == arguments.length); |
return representation; |
} |
+ |
+ bool isNativePrimitiveType(DartType type) { |
+ if (type is! InterfaceType) return false; |
+ ClassElement cls = type.element; |
+ return cls == _compiler.intClass || |
+ cls == _compiler.numClass || |
+ cls == _compiler.doubleClass || |
+ cls == _compiler.boolClass || |
+ cls == _compiler.stringClass; |
+ } |
+ |
+ void registerIsCheck(DartType type, Registry registry) { |
+ enqueuer.registerIsCheck(type, registry); |
+ _backend.registerIsCheckForCodegen(type, enqueuer, registry); |
+ } |
+ |
+ bool isIntClass(ClassElement cls) => cls == _compiler.intClass; |
+ |
+ bool isStringClass(ClassElement cls) => cls == _compiler.stringClass; |
+ |
+ bool isBoolClass(ClassElement cls) => cls == _compiler.boolClass; |
+ |
+ bool isNumClass(ClassElement cls) => cls == _compiler.numClass; |
+ |
+ bool isDoubleClass(ClassElement cls) => cls == _compiler.doubleClass; |
+ |
+ String getTypeTestTag(DartType type) { |
+ return _backend.namer.operatorIsType(type); |
+ } |
+ |
+ bool operatorEqHandlesNullArgument(FunctionElement element) { |
+ return _backend.operatorEqHandlesNullArgument(element); |
+ } |
} |