aboutsummaryrefslogtreecommitdiffstats
path: root/core/invoke.moon
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-04-12 17:45:02 +0000
committers-ol <s-ol@users.noreply.github.com>2020-04-12 17:45:02 +0000
commit98ed2cdbd1bce20d38fda1c830ef68807975ea93 (patch)
tree106881049995b4dc8e5979dc88b7c06ec34f0fdd /core/invoke.moon
parenttime/every: allow specifying event (diff)
downloadalive-98ed2cdbd1bce20d38fda1c830ef68807975ea93.tar.gz
alive-98ed2cdbd1bce20d38fda1c830ef68807975ea93.zip
rename Action to Builtin
Diffstat (limited to 'core/invoke.moon')
-rw-r--r--core/invoke.moon21
1 files changed, 11 insertions, 10 deletions
diff --git a/core/invoke.moon b/core/invoke.moon
index 539a778..8fcb525 100644
--- a/core/invoke.moon
+++ b/core/invoke.moon
@@ -3,7 +3,7 @@
--
-- @module invoke
import Result from require 'core.result'
-import Action from require 'core.base'
+import Builtin from require 'core.base'
import Scope from require 'core.scope'
import Error from require 'core.error'
@@ -21,11 +21,11 @@ get_name = (value, raw) ->
else
"(unnamed)"
---- `Action` implementation that invokes an `Op`.
+--- `Builtin` implementation that invokes an `Op`.
--
-- @type op_invoke
-class op_invoke extends Action
- --- `Action:setup` implementation.
+class op_invoke extends Builtin
+ --- `Builtin:setup` implementation.
--
-- `Op:fork`s the `prev`'s `Op` instance if given. Creates a new instance
-- otherwise.
@@ -36,7 +36,7 @@ class op_invoke extends Action
def = @head\unwrap 'opdef', "cant op-invoke #{@head}"
@op = def!
- --- `Action:destroy` implementation.
+ --- `Builtin:destroy` implementation.
--
-- calls `op`:@{Op:destroy|destroy}.
destroy: => @op\destroy!
@@ -76,17 +76,17 @@ class op_invoke extends Action
--
-- @tfield Op op
---- `Action` implementation that invokes a `FnDef`.
+--- `Builtin` implementation that invokes a `FnDef`.
--
-- @type fn_invoke
-class fn_invoke extends Action
+class fn_invoke extends Builtin
--- evaluate a user-function invocation.
--
-- Creates a new `Scope` that inherits from `FnDef.scope` and has
-- `outer_scope` as an additional parent for dynamic symbol resolution.
-- Then `AST:eval`s the tail in `outer_scope`, and defines the results to the
-- names in `FnDef.params` in the newly created scope. Lastly, `AST:clone`s
- -- `FnDef.body` with the prefix `Action.tag`, and `AST:eval`s it in the newly
+ -- `FnDef.body` with the prefix `Builtin.tag`, and `AST:eval`s it in the newly
-- created `Scope`.
--
-- The `Result` contains the `Stream` from the cloned AST, and its children
@@ -102,8 +102,9 @@ class fn_invoke extends Action
{ :params, :body, :scope } = @head\unwrap 'fndef', "cant fn-invoke #{@head}"
if #params != #tail
- error with Error 'argument', "expected #{#params} arguments, found #{#tail}"
- \add_frame frame
+ err = Error 'argument', "expected #{#params} arguments, found #{#tail}"
+ err\add_frame frame
+ error err
fn_scope = Scope scope, outer_scope