Index: sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart b/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart |
index e38cc6e4ec5cdfb227c73e01e26746629a831e3e..f400d3b6818c073f9d0757124b429ff442df34e0 100644 |
--- a/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart |
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/runtime_types.dart |
@@ -207,6 +207,25 @@ class RuntimeTypeInformation { |
} |
} |
+ String getTypeEncoding(DartType type, |
+ {bool alwaysGenerateFunction: false}) { |
+ TypeVariableType typeVariable = type.typeVariableOccurrence; |
+ String onVariable(TypeVariableType v) { |
+ return v.toString(); |
+ }; |
+ String encoding = _getTypeRepresentation(type, onVariable); |
+ if (typeVariable == null && !alwaysGenerateFunction) { |
+ return encoding; |
+ } else { |
+ ClassElement cls = typeVariable != null ? |
+ typeVariable.element.enclosingElement : null; |
+ String parameters = cls != null |
+ ? cls.typeVariables.toList().join(', ') |
+ : ''; |
+ return 'function ($parameters) { return $encoding; }'; |
+ } |
+ } |
+ |
String getTypeRepresentation(DartType type, void onVariable(variable)) { |
// Create a type representation. For type variables call the original |
// callback for side effects and return a template placeholder. |