lua: method-call binds obj to temp (no more double-eval); chaining works +1 test
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

This commit is contained in:
2026-04-24 22:25:51 +00:00
parent 27425a3173
commit e105edee01
5 changed files with 56 additions and 38 deletions

View File

@@ -954,6 +954,10 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 1863)
(eval "(lua-eval-ast \"local i = 0 repeat i = i + 1 if i >= 3 then break end until false return i\")")
;; ── Method-call chaining (obj evaluated once) ────────────────
(epoch 1870)
(eval "(lua-eval-ast \"local a = {x=0} function a:add(x) self.x = self.x+x return self end return a:add(10):add(20):add(30).x\")")
EPOCHS
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
@@ -1443,6 +1447,9 @@ check 1861 "break in for-num" '55'
check 1862 "break in for-in" '30'
check 1863 "break in repeat" '3'
# ── Method-call chaining ─────────────────────────────────────
check 1870 "a:add():add():add().x chain" '60'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"