diff options
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/js/reference.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/reference.jvm.lux | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/js/reference.jvm.lux index 33cf3ed7d..66d340949 100644 --- a/new-luxc/source/luxc/lang/translation/js/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/reference.jvm.lux @@ -3,25 +3,32 @@ (lux [macro] (data [text] text/format)) - (luxc ["&" lang]) + (luxc ["&" lang] + (lang [".L" variable #+ Variable Register])) [//] (// [".T" runtime])) (do-template [<register> <translation> <prefix>] [(def: #export (<register> register) - (-> Nat //.Expression) + (-> Register //.Expression) (format <prefix> (%n register))) (def: #export (<translation> register) - (-> Nat (Meta //.Expression)) + (-> Register (Meta //.Expression)) (:: macro.Monad<Meta> wrap (<register> register)))] - [closure translate-local "c"] - [variable translate-captured "v"]) + [closure translate-captured "c"] + [variable translate-local "v"]) -(def: #export (global [module name]) +(def: #export (translate-variable var) + (-> Variable (Meta //.Expression)) + (if (variableL.captured? var) + (translate-captured (int-to-nat var)) + (translate-local (int-to-nat var)))) + +(def: #export global (-> Ident //.Expression) - (format (text.replace-all "/" "_" module) "$" (&.normalize-name name))) + //.definition-name) (def: #export (translate-definition name) (-> Ident (Meta //.Expression)) |