Skip to content

Commit 3f5316d

Browse files
MarkzipanCommit Queue
authored andcommitted
[rti] Adding quick int to string util.
This is safe, as the stringified values in the RTI are either string literals or integers. Also avoids DDC having to call post-interceptor toString methods. Change-Id: I8e04644837e7a058ac2d0465cc0ea31488f5681c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401741 Commit-Queue: Mark Zhou <[email protected]> Reviewed-by: Stephen Adams <[email protected]> Reviewed-by: Mayank Patke <[email protected]>
1 parent 6494efb commit 3f5316d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sdk/lib/_internal/js_shared/lib/rti.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2528,7 +2528,10 @@ class _Universe {
25282528
_recipeJoin(Rti._getCanonicalRecipe(baseType), Recipe.wrapFutureOrString);
25292529

25302530
static String _canonicalRecipeOfGenericFunctionParameter(int index) =>
2531-
_recipeJoin('$index', Recipe.genericFunctionTypeParameterIndexString);
2531+
_recipeJoin(
2532+
_Utils.intToString(index),
2533+
Recipe.genericFunctionTypeParameterIndexString,
2534+
);
25322535

25332536
static Rti _lookupErasedRti(Object? universe) {
25342537
return _lookupTerminalRti(
@@ -4345,6 +4348,7 @@ class _Utils {
43454348
static int asInt(Object? o) => JS('int', '#', o);
43464349
static num asNum(Object? o) => JS('num', '#', o);
43474350
static String asString(Object? o) => JS('String', '#', o);
4351+
static String intToString(Object? o) => JS('String', '"" + #', o);
43484352
static Rti asRti(Object? s) => JS('Rti', '#', s);
43494353
static Rti? asRtiOrNull(Object? s) => JS('Rti|Null', '#', s);
43504354
static _Type as_Type(Object? o) => JS('_Type', '#', o);

0 commit comments

Comments
 (0)