Skip to content

Commit 3ff9024

Browse files
authored
Update jsgen.js
1 parent 8a503a7 commit 3ff9024

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/compiler/jsgen.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,11 +547,11 @@ class JSGenerator {
547547
case 'json.newArray':
548548
return new TypedInput('new Array()', TYPE_ARRAY);
549549
case 'json.toArray_':
550-
return new TypedInput(`${this.descendInput(node.string).asArray()}`, TYPE_ARRAY);
550+
return new TypedInput(`(${this.descendInput(node.string).asArray()})`, TYPE_ARRAY);
551551
case 'json.valueOfIndex':
552-
return new TypedInput(`${this.descendInput(node.array).asArray()}[${this.descendInput(node.index).asNumber()}] ?? ""`, TYPE_STRING);
552+
return new TypedInput(`(${this.descendInput(node.array).asArray()}[${this.descendInput(node.index).asNumber()}] ?? "")`, TYPE_STRING);
553553
case 'json.indexOfValue':
554-
return new TypedInput(`${this.descendInput(node.array).asArray()}.indexOf(${this.descendInput(node.value).asString()}) !== -1 ? ${this.descendInput(node.array).asArray()}.indexOf(${this.descendInput(node.value).asString()}) : ""`, TYPE_STRING);
554+
return new TypedInput(`(${this.descendInput(node.array).asArray()}.indexOf(${this.descendInput(node.value).asString()}) !== -1 ? ${this.descendInput(node.array).asArray()}.indexOf(${this.descendInput(node.value).asString()}) : "")`, TYPE_STRING);
555555
case 'json.addItem':
556556
return new TypedInput(`(array = ${this.descendInput(node.array).asArray()}, array.push(${this.descendInput(node.item).asString()}), array)`, TYPE_ARRAY);
557557
case 'json.replaceIndex':

0 commit comments

Comments
 (0)