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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/glue.dart

Issue 968843003: Implement type argument access and reification of runtime types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
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 0c8310c2a8959e7a149cd5509bc0cfedf9f74658..f5bb4f1c25c68f10836be87b22711a041a5f74e3 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/glue.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/glue.dart
@@ -11,6 +11,7 @@ import '../../js/js.dart' as js;
import '../../constants/values.dart';
import '../../elements/elements.dart';
import '../../constants/expressions.dart';
+import '../../dart_types.dart';
/// Encapsulates the dependencies of the function-compiler to the compiler,
/// backend and emitter.
@@ -117,4 +118,38 @@ class Glue {
return new js.VariableUse(
_backend.namer.globalObjectFor(_backend.interceptorsLibrary));
}
+
+ FunctionElement getCreateRuntimeType() {
+ return _backend.getCreateRuntimeType();
+ }
+
+ FunctionElement getRuntimeTypeToString() {
+ return _backend.getRuntimeTypeToString();
+ }
+
+ FunctionElement getTypeArgumentWithSubstitution() {
+ return _backend.getGetRuntimeTypeArgument();
+ }
+
+ FunctionElement getTypeArgumentByIndex() {
+ return _backend.getGetTypeArgumentByIndex();
+ }
+
+ js.Expression getSubstitutionName(ClassElement cls) {
+ return js.string(_namer.substitutionName(cls));
+ }
+
+ int getTypeVariableIndex(TypeVariableType variable) {
+ return RuntimeTypes.getTypeVariableIndex(variable.element);
+ }
+
+ bool needsSubstitutionForTypeVariableAccess(ClassElement cls) {
+ ClassWorld classWorld = _compiler.world;
+ if (classWorld.isUsedAsMixin(cls)) return true;
+
+ Iterable<ClassElement> subclasses = _compiler.world.strictSubclassesOf(cls);
+ return subclasses.any((ClassElement subclass) {
+ return !_backend.rti.isTrivialSubstitution(subclass, cls);
+ });
+ }
}

Powered by Google App Engine
This is Rietveld 408576698