KissInterp2 let list destructuring
Some checks failed
CI / test (push) Failing after 15s
CI / test-core (14, ubuntu-latest, 3.x, nodejs) (push) Failing after 40s
CI / test-core (14, ubuntu-latest, 3.x, interp) (push) Failing after 32s
CI / test-core (14, ubuntu-latest, 3.x, js) (push) Failing after 49s
CI / test-core (14, ubuntu-latest, 3.x, py) (push) Failing after 49s
CI / test-core (14, ubuntu-latest, 3.x, cpp) (push) Failing after 55s
Some checks failed
CI / test (push) Failing after 15s
CI / test-core (14, ubuntu-latest, 3.x, nodejs) (push) Failing after 40s
CI / test-core (14, ubuntu-latest, 3.x, interp) (push) Failing after 32s
CI / test-core (14, ubuntu-latest, 3.x, js) (push) Failing after 49s
CI / test-core (14, ubuntu-latest, 3.x, py) (push) Failing after 49s
CI / test-core (14, ubuntu-latest, 3.x, cpp) (push) Failing after 55s
This commit is contained in:
@@ -136,12 +136,16 @@
|
||||
(nextVar []
|
||||
(if bindings
|
||||
(let [v (bindings.shift)
|
||||
vName (symbolNameValue v)
|
||||
val (bindings.shift)]
|
||||
(evalCC val ->val {
|
||||
(dictSet scope vName val)
|
||||
(nextVar)
|
||||
}))
|
||||
(evalCC val ->val
|
||||
(case v.def
|
||||
((Symbol vName)
|
||||
(dictSet scope vName val))
|
||||
((ListExp names)
|
||||
(doFor [i s] (enumerate names)
|
||||
(dictSet scope (symbolNameValue s) (nth val i))))
|
||||
(never otherwise)))
|
||||
(nextVar))
|
||||
(evalCC (callSymbol "begin" body) ->result {
|
||||
(localScopes.pop)
|
||||
(cc result)
|
||||
|
||||
@@ -49,5 +49,8 @@ class KissInterp2TestCase extends Test {
|
||||
function testDestructive() {
|
||||
_testDestructive();
|
||||
}
|
||||
function testListDestructure() {
|
||||
_testListDestructure();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,3 +63,7 @@
|
||||
(function _testDestructive []
|
||||
(let [interp (new Interp)]
|
||||
(assertEval 5 "(let [i 2] (+= i 3) i)")))
|
||||
|
||||
(function _testListDestructure []
|
||||
(let [interp (new Interp)]
|
||||
(assertEval [5 6 7] "(let [[a b c] [5 6 7]] [a b c])")))
|
||||
|
||||
Reference in New Issue
Block a user