Skip to content

Commit 636e4cb

Browse files
committed
Final JSON fixes
1 parent bcbbb9d commit 636e4cb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/blocks/scratch3_looks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class Scratch3LooksBlocks {
256256
}
257257

258258
// Limit the length of the string.
259-
text = String(text).substr(0, Scratch3LooksBlocks.SAY_BUBBLE_LIMIT);
259+
text = Cast.toString(text).substr(0, Scratch3LooksBlocks.SAY_BUBBLE_LIMIT);
260260

261261
return text;
262262
}
@@ -395,7 +395,7 @@ class Scratch3LooksBlocks {
395395
target.setCostume(optZeroIndex ? requestedCostume : requestedCostume - 1);
396396
} else {
397397
// Strings should be treated as costume names, where possible
398-
const costumeIndex = target.getCostumeIndexByName(requestedCostume.toString());
398+
const costumeIndex = target.getCostumeIndexByName(Cast.toString(requestedCostume));
399399

400400
if (costumeIndex !== -1) {
401401
target.setCostume(costumeIndex);
@@ -429,7 +429,7 @@ class Scratch3LooksBlocks {
429429
stage.setCostume(optZeroIndex ? requestedBackdrop : requestedBackdrop - 1);
430430
} else {
431431
// Strings should be treated as backdrop names where possible
432-
const costumeIndex = stage.getCostumeIndexByName(requestedBackdrop.toString());
432+
const costumeIndex = stage.getCostumeIndexByName(Cast.toString(requestedBackdrop));
433433

434434
if (costumeIndex !== -1) {
435435
stage.setCostume(costumeIndex);

src/compiler/jsgen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class ConstantInput {
177177
}
178178

179179
asString () {
180-
return `"${sanitize('' + this.constantValue)}"`;
180+
return `"${sanitize('' + this.constantValue)}"`; // Should this be updated to use "Cast.toString"?
181181
}
182182

183183
asBoolean () {

0 commit comments

Comments
 (0)