diff options
author | Eduardo Julian | 2018-01-28 19:41:01 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-01-28 19:41:01 -0400 |
commit | 6b6901b31bbec9947522a94274cd11c8e7683168 (patch) | |
tree | ac984159a7c23bbdfab8a2fa1ddde1f625d7dae0 /new-luxc/source/luxc/lang/translation/js/reference.jvm.lux | |
parent | 6e829294381d504656d904dc71b7c6729750db5e (diff) |
- Got JS backend to build with the rest of the new-luxc code.
Diffstat (limited to '')
-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)) |