erlang: gen_server behaviour (+10 tests)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -486,10 +486,10 @@
|
||||
(er-apply-fun (get env name) vs)
|
||||
:else (er-apply-bif name vs)))
|
||||
(= (get fun-node :type) "remote")
|
||||
(er-apply-remote-bif
|
||||
(get (get fun-node :mod) :value)
|
||||
(get (get fun-node :fun) :value)
|
||||
(er-eval-args args env))
|
||||
(let
|
||||
((mod-name (er-resolve-call-name (get fun-node :mod) env "module"))
|
||||
(fn-name (er-resolve-call-name (get fun-node :fun) env "function")))
|
||||
(er-apply-remote-bif mod-name fn-name (er-eval-args args env)))
|
||||
:else
|
||||
(let
|
||||
((fv (er-eval-expr fun-node env)))
|
||||
@@ -509,6 +509,24 @@
|
||||
(range 0 (len args)))
|
||||
out)))
|
||||
|
||||
;; Resolve a remote call's module/function reference into a string.
|
||||
;; Atom AST nodes use their `:value` directly. For any other shape
|
||||
;; (typically a var or another expression), evaluate it and require
|
||||
;; the result to be an atom.
|
||||
(define
|
||||
er-resolve-call-name
|
||||
(fn
|
||||
(node env kind)
|
||||
(cond
|
||||
(= (get node :type) "atom") (get node :value)
|
||||
:else (let
|
||||
((v (er-eval-expr node env)))
|
||||
(if
|
||||
(er-atom? v)
|
||||
(get v :name)
|
||||
(error
|
||||
(str "Erlang: call " kind " must be an atom, got " (er-format-value v))))))))
|
||||
|
||||
;; ── fun values ───────────────────────────────────────────────────
|
||||
(define
|
||||
er-mk-fun
|
||||
|
||||
Reference in New Issue
Block a user