Skip to content

Commit bfc3974

Browse files
committed
Fix object and array inputs on custom blocks
1 parent c65a385 commit bfc3974

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/compiler/irgen.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ class ScriptTreeGenerator {
150150
createConstantInput (constant, preserveStrings = false) {
151151
if (constant === null) throw new Error('IR: Constant cannot have a null value.');
152152

153+
if (typeof constant === 'object') {
154+
if (Array.isArray(constant)) {
155+
return new IntermediateInput(InputOpcode.CONSTANT, InputType.ARRAY, {value: constant});
156+
} else {
157+
return new IntermediateInput(InputOpcode.CONSTANT, InputType.OBJECT, {value: constant});
158+
}
159+
}
160+
153161
constant += '';
154162
const numConstant = +constant;
155163
const preserve = preserveStrings && this.namesOfCostumesAndSounds.has(constant);

0 commit comments

Comments
 (0)