diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-02-23 22:16:25 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-02-28 12:22:25 +0000 |
| commit | 0b284ac60916142cadb8b65fa5ca9f9cffcfc200 (patch) | |
| tree | 07fc75330d813d54751f42a2f55b979398929814 /core | |
| parent | merge Const and Stream into Value; Dataflow logic (diff) | |
| download | alive-0b284ac60916142cadb8b65fa5ca9f9cffcfc200.tar.gz alive-0b284ac60916142cadb8b65fa5ca9f9cffcfc200.zip | |
lots of fixes
Diffstat (limited to 'core')
| -rw-r--r-- | core/base.moon | 4 | ||||
| -rw-r--r-- | core/builtin.moon | 4 | ||||
| -rw-r--r-- | core/invoke.moon | 4 | ||||
| -rw-r--r-- | core/parsing.moon | 2 | ||||
| -rw-r--r-- | core/value.moon | 1 |
5 files changed, 11 insertions, 4 deletions
diff --git a/core/base.moon b/core/base.moon index 60ee460..422e631 100644 --- a/core/base.moon +++ b/core/base.moon @@ -34,6 +34,10 @@ class Op assert_types: (...) => num = select '#', ... assert #@inputs >= num, "argument count mismatch" + @assert_first_types ... + + assert_first_types: (...) => + num = select '#', ... for i = 1, num expect = select i, ... assert @inputs[i].type == expect, "expected argument #{i} of #{@} to be of type #{expect} but found #{@inputs[i]}" diff --git a/core/builtin.moon b/core/builtin.moon index 6abcbd9..5dd296a 100644 --- a/core/builtin.moon +++ b/core/builtin.moon @@ -12,9 +12,9 @@ prints the docstring for sym in the console" eval: (scope, tail) => assert #tail == 1, "'doc' takes exactly one parameter" - def = L\push tail[1]\eval, scope + result = L\push tail[1]\eval, scope with Result children: { def } - def = def.value\const!\unwrap! + def = result\const!\unwrap! L\print "(doc #{tail[1]\stringify!}):\n#{def.doc}\n" class def extends Action diff --git a/core/invoke.moon b/core/invoke.moon index a3932f8..da82d00 100644 --- a/core/invoke.moon +++ b/core/invoke.moon @@ -10,13 +10,15 @@ class op_invoke extends Action def = head\unwrap 'opdef', "cant op-invoke #{@head}" @head, @op = head, def! + @first = true true eval: (scope, tail) => children = L\push -> [L\push expr\eval, scope for expr in *tail] @op\setup [child.value for child in *children] - @op\tick true + @op\tick @first + @first = nil Result :children, value: @op.out, op: @op diff --git a/core/parsing.moon b/core/parsing.moon index 03ef85c..0123469 100644 --- a/core/parsing.moon +++ b/core/parsing.moon @@ -24,7 +24,7 @@ str = strd + strq int = digit^1 float = (digit^1 * '.' * digit^0) + (digit^0 * '.' * digit^1) -num = (float + int) / Value\parse 'num' +num = ((P '-')^-1 * (float + int)) / Value\parse 'num' atom = num + sym + str diff --git a/core/value.moon b/core/value.moon index 986c846..6fbda65 100644 --- a/core/value.moon +++ b/core/value.moon @@ -98,6 +98,7 @@ class Value -- @value - Lua value - access through :unwrap() new: (@type, @value, @raw) => @updated = 0 + pcall @\set, @value dirty: => @updated == Registry.active!.tick |
