diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-02-03 10:59:10 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-02-03 11:00:32 +0000 |
| commit | 1b6da2babfc65c4b8f6f7ac8644c0498e094bab7 (patch) | |
| tree | 61ef0fc20c511cd8936e6af2d889a2ffddab9211 /lib | |
| parent | fix error handling again (diff) | |
| download | alive-1b6da2babfc65c4b8f6f7ac8644c0498e094bab7.tar.gz alive-1b6da2babfc65c4b8f6f7ac8644c0498e094bab7.zip | |
Forward references
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/builtin.moon | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/builtin.moon b/lib/builtin.moon index 369c3b3..8615afa 100644 --- a/lib/builtin.moon +++ b/lib/builtin.moon @@ -1,4 +1,4 @@ -import Macro, Const from require 'base' +import Macro, Const, Forward from require 'base' import Scope from require 'scope' class def extends Macro @@ -12,8 +12,13 @@ class def extends Macro name, val = @node[i], @node[i+1] assert name.atom_type == 'sym', "'def's argument ##{i} has to be a symbol" val\expand @node.scope - scope\set name.raw, val.value + if val.value + -- expand-time constant + scope\set name.raw, val.value + else + -- patch-time expression + scope\set name.raw, Forward val nil class _require extends Macro |
