diff options
author | Eduardo Julian | 2017-11-01 13:36:15 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-11-01 13:36:15 -0400 |
commit | 88006e957373bbd72ec68897474303964885fc68 (patch) | |
tree | a34f88ea0921f56737c8881345245e11e7c8b546 /new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux | |
parent | 012f6bd41e527479dddbccbdab10daa78fd9a0fd (diff) |
- Minor refactorings.
- Fixed some bugs.
- Enabled macro-expansion for statements.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux index c222e42cf..7168514c1 100644 --- a/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux @@ -273,12 +273,12 @@ $i;I2L ($i;wrap #$;Long))) -(def: (array//new proc generate inputs) +(def: (array//new proc translate inputs) (-> Text @;Proc) (case inputs (^ (list [_ (#;Nat level)] [_ (#;Text class)] lengthS)) (do meta;Monad<Meta> - [lengthI (generate lengthS) + [lengthI (translate lengthS) #let [arrayJT ($t;array level (case class "boolean" $t;boolean "byte" $t;byte @@ -297,13 +297,13 @@ _ (&;fail (format "Wrong syntax for '" proc "'.")))) -(def: (array//read proc generate inputs) +(def: (array//read proc translate inputs) (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] idxS arrayS)) (do meta;Monad<Meta> - [arrayI (generate arrayS) - idxI (generate idxS) + [arrayI (translate arrayS) + idxI (translate idxS) #let [loadI (case class "boolean" (|>. $i;BALOAD ($i;wrap #$;Boolean)) "byte" (|>. $i;BALOAD ($i;wrap #$;Byte)) @@ -323,14 +323,14 @@ _ (&;fail (format "Wrong syntax for '" proc "'.")))) -(def: (array//write proc generate inputs) +(def: (array//write proc translate inputs) (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] idxS valueS arrayS)) (do meta;Monad<Meta> - [arrayI (generate arrayS) - idxI (generate idxS) - valueI (generate valueS) + [arrayI (translate arrayS) + idxI (translate idxS) + valueI (translate valueS) #let [storeI (case class "boolean" (|>. ($i;unwrap #$;Boolean) $i;BASTORE) "byte" (|>. ($i;unwrap #$;Byte) $i;BASTORE) @@ -392,7 +392,7 @@ (|>. exceptionI $i;ATHROW)) -(def: (object//class proc generate inputs) +(def: (object//class proc translate inputs) (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)])) @@ -408,12 +408,12 @@ _ (&;fail (format "Wrong syntax for '" proc "'.")))) -(def: (object//instance? proc generate inputs) +(def: (object//instance? proc translate inputs) (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] objectS)) (do meta;Monad<Meta> - [objectI (generate objectS)] + [objectI (translate objectS)] (wrap (|>. objectI ($i;INSTANCEOF class) ($i;wrap #$;Boolean)))) @@ -445,7 +445,7 @@ ["char" #$;Char]) (dict;from-list text;Hash<Text>))) -(def: (static//get proc generate inputs) +(def: (static//get proc translate inputs) (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)])) @@ -472,12 +472,12 @@ _ (&;fail (format "Wrong syntax for '" proc "'.")))) -(def: (static//put proc generate inputs) +(def: (static//put proc translate inputs) (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)] valueS)) (do meta;Monad<Meta> - [valueI (generate valueS)] + [valueI (translate valueS)] (case (dict;get unboxed primitives) (#;Some primitive) (let [primitive (case unboxed @@ -504,12 +504,12 @@ _ (&;fail (format "Wrong syntax for '" proc "'.")))) -(def: (virtual//get proc generate inputs) +(def: (virtual//get proc translate inputs) (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)] objectS)) (do meta;Monad<Meta> - [objectI (generate objectS)] + [objectI (translate objectS)] (case (dict;get unboxed primitives) (#;Some primitive) (let [primitive (case unboxed @@ -535,13 +535,13 @@ _ (&;fail (format "Wrong syntax for '" proc "'.")))) -(def: (virtual//put proc generate inputs) +(def: (virtual//put proc translate inputs) (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)] valueS objectS)) (do meta;Monad<Meta> - [valueI (generate valueS) - objectI (generate objectS)] + [valueI (translate valueS) + objectI (translate objectS)] (case (dict;get unboxed primitives) (#;Some primitive) (let [primitive (case unboxed @@ -597,7 +597,7 @@ nesting (p;some (l;this "[]"))] (wrap ($t;array (list;size nesting) raw)))) -(def: (generate-type argD) +(def: (translate-type argD) (-> Text (Meta $;Type)) (case (l;run argD java-type) (#e;Error error) @@ -623,7 +623,7 @@ _ (|>. inputI ($i;CHECKCAST ($t;descriptor inputT))))) -(def: (generate-args generate argsS) +(def: (translate-args translate argsS) (-> (-> ls;Synthesis (Meta $;Inst)) (List ls;Synthesis) (Meta (List [$;Type $;Inst]))) (case argsS @@ -632,9 +632,9 @@ (^ (list& [_ (#;Tuple (list [_ (#;Text argD)] argS))] tail)) (do meta;Monad<Meta> - [argT (generate-type argD) - argI (:: @ map (prepare-input argT) (generate argS)) - =tail (generate-args generate tail)] + [argT (translate-type argD) + argI (:: @ map (prepare-input argT) (translate argS)) + =tail (translate-args translate tail)] (wrap (list& [argT argI] =tail))) _ @@ -647,7 +647,7 @@ (meta/wrap #;None) _ - (:: meta;Monad<Meta> map (|>. #;Some) (generate-type description)))) + (:: meta;Monad<Meta> map (|>. #;Some) (translate-type description)))) (def: (prepare-return returnT returnI) (-> (Maybe $;Type) $;Inst $;Inst) @@ -664,13 +664,13 @@ _ returnI))) -(def: (invoke//static proc generate inputs) +(def: (invoke//static proc translate inputs) (-> Text @;Proc) (case inputs (^ (list& [_ (#;Text class)] [_ (#;Text method)] [_ (#;Text unboxed)] argsS)) (do meta;Monad<Meta> - [argsTI (generate-args generate argsS) + [argsTI (translate-args translate argsS) returnT (method-return-type unboxed) #let [callI (|>. ($i;fuse (list/map product;right argsTI)) ($i;INVOKESTATIC class method @@ -682,14 +682,14 @@ (&;fail (format "Wrong syntax for '" proc "'.")))) (do-template [<name> <invoke> <interface?>] - [(def: (<name> proc generate inputs) + [(def: (<name> proc translate inputs) (-> Text @;Proc) (case inputs (^ (list& [_ (#;Text class)] [_ (#;Text method)] [_ (#;Text unboxed)] objectS argsS)) (do meta;Monad<Meta> - [objectI (generate objectS) - argsTI (generate-args generate argsS) + [objectI (translate objectS) + argsTI (translate-args translate argsS) returnT (method-return-type unboxed) #let [callI (|>. objectI ($i;CHECKCAST class) @@ -707,12 +707,12 @@ [invoke//interface $i;INVOKEINTERFACE true] ) -(def: (invoke//constructor proc generate inputs) +(def: (invoke//constructor proc translate inputs) (-> Text @;Proc) (case inputs (^ (list& [_ (#;Text class)] argsS)) (do meta;Monad<Meta> - [argsTI (generate-args generate argsS)] + [argsTI (translate-args translate argsS)] (wrap (|>. ($i;NEW class) $i;DUP ($i;fuse (list/map product;right argsTI)) |