aboutsummaryrefslogtreecommitdiff
path: root/nomsu.moon
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-10-08 15:06:05 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2017-10-08 15:06:05 -0700
commit529afd465fbbfbf923831d8a33fc3ce349dc703f (patch)
treeb87f31c1e2e2832c80acd7baa60656c45420ac87 /nomsu.moon
parent6a429d79558f70578ba30565f5ae299f0fe42da1 (diff)
Fixed permissions to work better with aliases.
Diffstat (limited to 'nomsu.moon')
-rwxr-xr-xnomsu.moon7
1 files changed, 5 insertions, 2 deletions
diff --git a/nomsu.moon b/nomsu.moon
index 4254ad2..cfe9aa3 100755
--- a/nomsu.moon
+++ b/nomsu.moon
@@ -191,7 +191,8 @@ class NomsuCompiler
@utils = utils
@repr = (...)=> repr(...)
@loaded_files = {}
- @initialize_core!
+ if not parent
+ @initialize_core!
writeln:(...)=>
@write(...)
@@ -200,6 +201,7 @@ class NomsuCompiler
def: (signature, thunk, src, is_macro=false)=>
assert type(thunk) == 'function', "Bad thunk: #{repr thunk}"
canonical_args = nil
+ aliases = {}
for {stub, arg_names} in *@get_stubs(signature)
assert stub, "NO STUB FOUND: #{repr signature}"
if @debug then @writeln "#{colored.bright "DEFINING RULE:"} #{colored.underscore colored.magenta repr(stub)} #{colored.bright "WITH ARGS"} #{colored.dim repr(arg_names)}"
@@ -208,7 +210,8 @@ class NomsuCompiler
if canonical_args
assert utils.equivalent(utils.set(arg_names), canonical_args), "Mismatched args"
else canonical_args = utils.set(arg_names)
- @defs[stub] = {:thunk, :stub, :arg_names, :src, :is_macro}
+ insert aliases, stub
+ @defs[stub] = {:thunk, :stub, :arg_names, :src, :is_macro, :aliases}
defmacro: (signature, thunk, src)=>
@def(signature, thunk, src, true)