aboutsummaryrefslogtreecommitdiffstats
path: root/alv/module.moon
diff options
context:
space:
mode:
Diffstat (limited to 'alv/module.moon')
-rw-r--r--alv/module.moon9
1 files changed, 2 insertions, 7 deletions
diff --git a/alv/module.moon b/alv/module.moon
index 356bcf5..8fc3ba7 100644
--- a/alv/module.moon
+++ b/alv/module.moon
@@ -26,7 +26,6 @@ class Module
-- @classmethod
new: (@file) =>
@registry = Registry!
- @last_modification = 0
--- members
-- @section members
@@ -36,23 +35,19 @@ class Module
poll: =>
{ :mode, :modification } = (lfs.attributes @file) or {}
assert mode == 'file', Error 'io', "not a file: '#{file}'"
-
- if @last_modification < modification
- true
+ modification
--- start an evaluation cycle.
--
-- If the module has already been evaluated this tick, this is a noop.
-- Otherwise, register the module with the `Copilot`. Updates `root`.
eval: =>
- @last_modification = os.time!
+ @registry\begin_eval!
@ast = Error.wrap "parsing '#{@file}'", -> program\match slurp @file
assert @ast, Error 'syntax', "failed to parse"
scope = Scope builtin
- @registry\begin_eval!
@root = Error.wrap "evaluating '#{@file}'", @ast\eval, scope, @registry
- @registry\release!
--- rollback the last evaluation cycle.
rollback: => @registry\rollback_eval!