add implicit function call syntax
This commit is contained in:
parent
53f4dc5b13
commit
a9d744d278
27
compile.phi
27
compile.phi
@ -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 "))")
|
||||
)))))))))))))))))))))))))
|
||||
))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user