From 529afd465fbbfbf923831d8a33fc3ce349dc703f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 8 Oct 2017 15:06:05 -0700 Subject: Fixed permissions to work better with aliases. --- nomsu.moon | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'nomsu.moon') 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) -- cgit v1.2.3