| Index: sdk/lib/_internal/lib/js_rti.dart
|
| diff --git a/sdk/lib/_internal/lib/js_rti.dart b/sdk/lib/_internal/lib/js_rti.dart
|
| index aea2fc30d2ab498754937cc20582f9bba5d7ad6f..de0aedff9c99998800db11d7c610b99edadbe5e9 100644
|
| --- a/sdk/lib/_internal/lib/js_rti.dart
|
| +++ b/sdk/lib/_internal/lib/js_rti.dart
|
| @@ -134,10 +134,11 @@ String getClassName(var object) {
|
| * of type 4, the JavaScript array, where the first element represents the class
|
| * and the remaining elements represent the type arguments.
|
| */
|
| -String getRuntimeTypeAsString(var runtimeType) {
|
| +String getRuntimeTypeAsString(var runtimeType, {String onTypeVariable(int)}) {
|
| assert(isJsArray(runtimeType));
|
| String className = getConstructorName(getIndex(runtimeType, 0));
|
| - return '$className${joinArguments(runtimeType, 1)}';
|
| + return '$className'
|
| + '${joinArguments(runtimeType, 1, onTypeVariable: onTypeVariable)}';
|
| }
|
|
|
| /**
|
| @@ -149,17 +150,21 @@ String getConstructorName(var type) => JS('String', r'#.builtin$cls', type);
|
| /**
|
| * Returns a human-readable representation of the type representation [type].
|
| */
|
| -String runtimeTypeToString(var type) {
|
| +String runtimeTypeToString(var type , {String onTypeVariable(int)}) {
|
| if (isNull(type)) {
|
| return 'dynamic';
|
| } else if (isJsArray(type)) {
|
| // A list representing a type with arguments.
|
| - return getRuntimeTypeAsString(type);
|
| + return getRuntimeTypeAsString(type, onTypeVariable: onTypeVariable);
|
| } else if (isJsFunction(type)) {
|
| // A reference to the constructor.
|
| return getConstructorName(type);
|
| } else if (type is int) {
|
| - return type.toString();
|
| + if (onTypeVariable == null) {
|
| + return type.toString();
|
| + } else {
|
| + return onTypeVariable(type);
|
| + }
|
| } else {
|
| return null;
|
| }
|
| @@ -170,7 +175,7 @@ String runtimeTypeToString(var type) {
|
| * type representations in the JavaScript array [types] starting at index
|
| * [startIndex].
|
| */
|
| -String joinArguments(var types, int startIndex) {
|
| +String joinArguments(var types, int startIndex, {String onTypeVariable(int)}) {
|
| if (isNull(types)) return '';
|
| assert(isJsArray(types));
|
| bool firstArgument = true;
|
| @@ -186,7 +191,7 @@ String joinArguments(var types, int startIndex) {
|
| if (argument != null) {
|
| allDynamic = false;
|
| }
|
| - buffer.write(runtimeTypeToString(argument));
|
| + buffer.write(runtimeTypeToString(argument, onTypeVariable: onTypeVariable));
|
| }
|
| return allDynamic ? '' : '<$buffer>';
|
| }
|
|
|