add implicit function call syntax

This commit is contained in:
sfja 2025-09-23 17:03:10 +02:00
parent 53f4dc5b13
commit a9d744d278
2 changed files with 552 additions and 530 deletions

View File

@ -111,15 +111,11 @@
(fn emit_list (expr) (do
(let (ty line s) expr)
(if (== (call len s) 0) (do
(call emit "({ type: \"list\", values: [] })")
(call println "warning: deprecated list syntax on line %" line)
(return)
(call panic "illegal function call on line %" line)
))
(let ((id_ty _ id)) s)
(if (!= id_ty "ident") (do
(call emit_list_literal s)
(call println "warning: deprecated list syntax on line %" line)
(return)
(call panic "illegal function call on line %" line)
))
(if (== id "fn") (do
(let (_ (_ _ ident) (_ _ params) body) s)
@ -277,8 +273,23 @@
(call emit_expr expr)
(call emit ")")
) (do
(call emit_list_literal s)
(call println "warning: deprecated list syntax on line %" line)
(let (callee) s)
(let args (call slice s 1))
(call emit (call format "(runtime.setLine(%), " line))
(call emit_expr callee)
(call emit "(")
(let first true)
(for arg args (do
(if (not first) (do
(call emit ", ")
))
(= first false)
(call emit_expr arg)
))
(call emit "))")
)))))))))))))))))))))))))
))

1055
stage2.js

File diff suppressed because it is too large Load Diff