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

Unified Diff: sdk/lib/_internal/lib/js_rti.dart

Issue 51113013: Reapply "Substitute types in generic superclasses and interfaces." . (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 2 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
« no previous file with comments | « sdk/lib/_internal/lib/js_mirrors.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3670841aceae25c64c2b83742af235db742ae9ec..67dd44105b7afcc98e5682867fc43f5a2cca50ae 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 i)}) {
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 i)}) {
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,8 @@ 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 i)}) {
if (isNull(types)) return '';
assert(isJsArray(types));
bool firstArgument = true;
@@ -186,7 +192,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>';
}
« no previous file with comments | « sdk/lib/_internal/lib/js_mirrors.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698