diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/base.moon | 8 | ||||
| -rw-r--r-- | core/const.moon | 3 | ||||
| -rw-r--r-- | core/init.moon | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/core/base.moon b/core/base.moon index 1805bea..05f7590 100644 --- a/core/base.moon +++ b/core/base.moon @@ -66,4 +66,10 @@ class Action __tostring: => "<action: #{@@__name}>" __inherited: (cls) => cls.__base.__tostring = @__tostring -:Op, :Action +class FnDef + new: (@params, @body, @scope) => + + __tostring: => + table.concat [p\stringify! for p in *@params], ' ' + +:Op, :Action, :FnDef diff --git a/core/const.moon b/core/const.moon index e1d19d9..b356f49 100644 --- a/core/const.moon +++ b/core/const.moon @@ -1,4 +1,4 @@ -import Op, Action from require 'core.base' +import Op, Action, FnDef from require 'core.base' local Scope load_ = -> @@ -93,6 +93,7 @@ class Const switch ancestor val.__class when Op then 'op' when Scope then 'scope' + when FnDef then 'fndef' when Const return val else diff --git a/core/init.moon b/core/init.moon index ed385fe..f0456c2 100644 --- a/core/init.moon +++ b/core/init.moon @@ -1,6 +1,6 @@ L or= setmetatable {}, __index: => -> -import Op, Action from require 'core.base' +import Op, Action, FnDef from require 'core.base' import Const, load_ from require 'core.const' import Scope from require 'core.scope' @@ -10,6 +10,6 @@ import Cell, RootCell from require 'core.cell' { :Const, :Cell, :RootCell - :Op, :Action + :Op, :Action, :FnDef :Scope } |
