Skip to content

Commit

Permalink
[rti] Adding quick int to string util.
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Markzipan authored and Commit Queue committed Dec 19, 2024
1 parent 6494efb commit 3f5316d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sdk/lib/_internal/js_shared/lib/rti.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2528,7 +2528,10 @@ class _Universe {
_recipeJoin(Rti._getCanonicalRecipe(baseType), Recipe.wrapFutureOrString);

static String _canonicalRecipeOfGenericFunctionParameter(int index) =>
_recipeJoin('$index', Recipe.genericFunctionTypeParameterIndexString);
_recipeJoin(
_Utils.intToString(index),
Recipe.genericFunctionTypeParameterIndexString,
);

static Rti _lookupErasedRti(Object? universe) {
return _lookupTerminalRti(
Expand Down Expand Up @@ -4345,6 +4348,7 @@ class _Utils {
static int asInt(Object? o) => JS('int', '#', o);
static num asNum(Object? o) => JS('num', '#', o);
static String asString(Object? o) => JS('String', '#', o);
static String intToString(Object? o) => JS('String', '"" + #', o);
static Rti asRti(Object? s) => JS('Rti', '#', s);
static Rti? asRtiOrNull(Object? s) => JS('Rti|Null', '#', s);
static _Type as_Type(Object? o) => JS('_Type', '#', o);
Expand Down

0 comments on commit 3f5316d

Please sign in to comment.