Skip to content

Commit 1a77136

Browse files
fix bug with list splicing when subexpression returns a list
1 parent ab50f10 commit 1a77136

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

json_runner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,11 @@ def expr(self, string):
171171
filter(bool, parse(
172172
string, " ", singletons=text_ops, split_at_parens=True)))
173173
for i, t in enumerate(tokens):
174+
if not isinstance(t, str):
175+
continue
174176
if t[0] == "(":
175177
val = self.expr(t[1:-1])
176-
tokens[i:i+len(val)] = val
178+
tokens[i:i+1] = val
177179
elif t[0] == "[":
178180
tokens[i] = self.eval(t[1:-1])
179181
elif t[0] in "{'\"":

json_runner.test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
then: return $cache.$key
8686
else: return [setsub $cache $key [call $func @($args)]]
8787
- set fib [memoize $fib]
88-
- say ([fib $times])
88+
# - say ([fib $times])
8989
- set globalvar helloiamglobal
9090
- function: closure-vars-test
9191
params: []
@@ -96,4 +96,5 @@
9696
do:
9797
- say ($globalvar)
9898
- say ([call [call [closure-vars-test]]])
99+
- say ((1 2 3) foo bar)
99100
"""))

0 commit comments

Comments
 (0)