diff options
author | Eduardo Julian | 2018-01-08 21:40:06 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-01-08 21:40:06 -0400 |
commit | 9eaaaf953ba7ce1eeb805603f4e113aa15f5178f (patch) | |
tree | ef134eecc8a5767a997fce0637cd64e0ebcee6b1 /new-luxc/source/luxc/lang/translation/reference.jvm.lux | |
parent | f523bc14d43286348aeb200bd0554812dc6ef28d (diff) |
- Moved all translation code under the JVM path (in preparation for porting the JS back-end).
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/reference.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/reference.jvm.lux | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/new-luxc/source/luxc/lang/translation/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/reference.jvm.lux deleted file mode 100644 index bfb5856d4..000000000 --- a/new-luxc/source/luxc/lang/translation/reference.jvm.lux +++ /dev/null @@ -1,49 +0,0 @@ -(.module: - lux - (lux (control [monad #+ do]) - (data [text "text/" Hash<Text>] - text/format) - [macro "macro/" Monad<Meta>]) - (luxc ["&" lang] - (lang [".L" host] - (host ["$" jvm] - (jvm ["$t" type] - ["$i" inst])) - ["ls" synthesis] - [".L" variable #+ Variable] - (translation [".T" common])))) - -(do-template [<name> <prefix>] - [(def: #export (<name> idx) - (-> Nat Text) - (|> idx nat-to-int %i (format <prefix>)))] - - [captured "c"] - [partial "p"] - ) - -(def: #export (translate-captured variable) - (-> Variable (Meta $.Inst)) - (do macro.Monad<Meta> - [this-module macro.current-module-name - function-class hostL.context - #let [function-class (format (text.replace-all "/" "." this-module) "." function-class)]] - (wrap (|>> ($i.ALOAD +0) - ($i.GETFIELD function-class - (|> variable i/inc (i/* -1) int-to-nat captured) - commonT.$Object))))) - -(def: #export (translate-local variable) - (-> Variable (Meta $.Inst)) - (macro/wrap ($i.ALOAD (int-to-nat variable)))) - -(def: #export (translate-variable variable) - (-> Variable (Meta $.Inst)) - (if (variableL.captured? variable) - (translate-captured variable) - (translate-local variable))) - -(def: #export (translate-definition [def-module def-name]) - (-> Ident (Meta $.Inst)) - (let [bytecode-name (format def-module "/" (&.normalize-name def-name) (%n (text/hash def-name)))] - (macro/wrap ($i.GETSTATIC bytecode-name commonT.value-field commonT.$Object)))) |