From 832a9361b632331e82a64c07baa560487ca8abde Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 29 Dec 2020 00:38:21 -0400 Subject: Moved "lux/data/number" to "lux/math/number". --- .../luxc/lang/translation/jvm/extension/host.lux | 400 ++++++++++----------- 1 file changed, 200 insertions(+), 200 deletions(-) (limited to 'lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux') diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux index 77f421703..d83a6d841 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -74,11 +74,11 @@ [return Return parser.return] ) -(exception: #export (not-an-object-array {arrayJT (Type Array)}) +(exception: #export (not_an_object_array {arrayJT (Type Array)}) (exception.report ["JVM Type" (|> arrayJT type.signature signature.signature)])) -(def: #export object-array +(def: #export object_array (Parser (Type Object)) (do <>.monad [arrayJT (.embed parser.array .text)] @@ -89,7 +89,7 @@ (wrap elementJT) #.None - (<>.fail (exception.construct ..not-an-object-array arrayJT))) + (<>.fail (exception.construct ..not_an_object_array arrayJT))) #.None (undefined)))) @@ -112,60 +112,60 @@ (|>> inputI )))] - [_.D2F conversion::double-to-float] - [_.D2I conversion::double-to-int] - [_.D2L conversion::double-to-long] - [_.F2D conversion::float-to-double] - [_.F2I conversion::float-to-int] - [_.F2L conversion::float-to-long] - [_.I2B conversion::int-to-byte] - [_.I2C conversion::int-to-char] - [_.I2D conversion::int-to-double] - [_.I2F conversion::int-to-float] - [_.I2L conversion::int-to-long] - [_.I2S conversion::int-to-short] - [_.L2D conversion::long-to-double] - [_.L2F conversion::long-to-float] - [_.L2I conversion::long-to-int] - [..L2S conversion::long-to-short] - [..L2B conversion::long-to-byte] - [..L2C conversion::long-to-char] - [_.I2B conversion::char-to-byte] - [_.I2S conversion::char-to-short] - [_.NOP conversion::char-to-int] - [_.I2L conversion::char-to-long] - [_.I2L conversion::byte-to-long] - [_.I2L conversion::short-to-long] + [_.D2F conversion::double_to_float] + [_.D2I conversion::double_to_int] + [_.D2L conversion::double_to_long] + [_.F2D conversion::float_to_double] + [_.F2I conversion::float_to_int] + [_.F2L conversion::float_to_long] + [_.I2B conversion::int_to_byte] + [_.I2C conversion::int_to_char] + [_.I2D conversion::int_to_double] + [_.I2F conversion::int_to_float] + [_.I2L conversion::int_to_long] + [_.I2S conversion::int_to_short] + [_.L2D conversion::long_to_double] + [_.L2F conversion::long_to_float] + [_.L2I conversion::long_to_int] + [..L2S conversion::long_to_short] + [..L2B conversion::long_to_byte] + [..L2C conversion::long_to_char] + [_.I2B conversion::char_to_byte] + [_.I2S conversion::char_to_short] + [_.NOP conversion::char_to_int] + [_.I2L conversion::char_to_long] + [_.I2L conversion::byte_to_long] + [_.I2L conversion::short_to_long] ) (def: conversion Bundle (<| (bundle.prefix "conversion") (|> (: Bundle bundle.empty) - (bundle.install "double-to-float" (unary conversion::double-to-float)) - (bundle.install "double-to-int" (unary conversion::double-to-int)) - (bundle.install "double-to-long" (unary conversion::double-to-long)) - (bundle.install "float-to-double" (unary conversion::float-to-double)) - (bundle.install "float-to-int" (unary conversion::float-to-int)) - (bundle.install "float-to-long" (unary conversion::float-to-long)) - (bundle.install "int-to-byte" (unary conversion::int-to-byte)) - (bundle.install "int-to-char" (unary conversion::int-to-char)) - (bundle.install "int-to-double" (unary conversion::int-to-double)) - (bundle.install "int-to-float" (unary conversion::int-to-float)) - (bundle.install "int-to-long" (unary conversion::int-to-long)) - (bundle.install "int-to-short" (unary conversion::int-to-short)) - (bundle.install "long-to-double" (unary conversion::long-to-double)) - (bundle.install "long-to-float" (unary conversion::long-to-float)) - (bundle.install "long-to-int" (unary conversion::long-to-int)) - (bundle.install "long-to-short" (unary conversion::long-to-short)) - (bundle.install "long-to-byte" (unary conversion::long-to-byte)) - (bundle.install "long-to-char" (unary conversion::long-to-char)) - (bundle.install "char-to-byte" (unary conversion::char-to-byte)) - (bundle.install "char-to-short" (unary conversion::char-to-short)) - (bundle.install "char-to-int" (unary conversion::char-to-int)) - (bundle.install "char-to-long" (unary conversion::char-to-long)) - (bundle.install "byte-to-long" (unary conversion::byte-to-long)) - (bundle.install "short-to-long" (unary conversion::short-to-long)) + (bundle.install "double-to-float" (unary conversion::double_to_float)) + (bundle.install "double-to-int" (unary conversion::double_to_int)) + (bundle.install "double-to-long" (unary conversion::double_to_long)) + (bundle.install "float-to-double" (unary conversion::float_to_double)) + (bundle.install "float-to-int" (unary conversion::float_to_int)) + (bundle.install "float-to-long" (unary conversion::float_to_long)) + (bundle.install "int-to-byte" (unary conversion::int_to_byte)) + (bundle.install "int-to-char" (unary conversion::int_to_char)) + (bundle.install "int-to-double" (unary conversion::int_to_double)) + (bundle.install "int-to-float" (unary conversion::int_to_float)) + (bundle.install "int-to-long" (unary conversion::int_to_long)) + (bundle.install "int-to-short" (unary conversion::int_to_short)) + (bundle.install "long-to-double" (unary conversion::long_to_double)) + (bundle.install "long-to-float" (unary conversion::long_to_float)) + (bundle.install "long-to-int" (unary conversion::long_to_int)) + (bundle.install "long-to-short" (unary conversion::long_to_short)) + (bundle.install "long-to-byte" (unary conversion::long_to_byte)) + (bundle.install "long-to-char" (unary conversion::long_to_char)) + (bundle.install "char-to-byte" (unary conversion::char_to_byte)) + (bundle.install "char-to-short" (unary conversion::char_to_short)) + (bundle.install "char-to-int" (unary conversion::char_to_int)) + (bundle.install "char-to-long" (unary conversion::char_to_long)) + (bundle.install "byte-to-long" (unary conversion::byte_to_long)) + (bundle.install "short-to-long" (unary conversion::short_to_long)) ))) (template [ ] @@ -219,8 +219,8 @@ (template [ ] [(def: ( [referenceI subjectI]) (Binary Inst) - (<| _.with-label (function (_ @then)) - _.with-label (function (_ @end)) + (<| _.with_label (function (_ @then)) + _.with_label (function (_ @end)) (|>> subjectI referenceI ( @then) @@ -240,8 +240,8 @@ (template [ ] [(def: ( [referenceI subjectI]) (Binary Inst) - (<| _.with-label (function (_ @then)) - _.with-label (function (_ @end)) + (<| _.with_label (function (_ @then)) + _.with_label (function (_ @end)) (|>> subjectI referenceI @@ -335,72 +335,72 @@ (bundle.install "<" (binary char::<)) ))) -(def: (primitive-array-length-handler jvm-primitive) +(def: (primitive_array_length_handler jvm_primitive) (-> (Type Primitive) Handler) (..custom [.any - (function (_ extension-name generate archive arrayS) + (function (_ extension_name generate archive arrayS) (do phase.monad [arrayI (generate archive arrayS)] (wrap (|>> arrayI - (_.CHECKCAST (type.array jvm-primitive)) + (_.CHECKCAST (type.array jvm_primitive)) _.ARRAYLENGTH))))])) (def: array::length::object Handler (..custom - [($_ <>.and ..object-array .any) - (function (_ extension-name generate archive [elementJT arrayS]) + [($_ <>.and ..object_array .any) + (function (_ extension_name generate archive [elementJT arrayS]) (do phase.monad [arrayI (generate archive arrayS)] (wrap (|>> arrayI (_.CHECKCAST (type.array elementJT)) _.ARRAYLENGTH))))])) -(def: (new-primitive-array-handler jvm-primitive) +(def: (new_primitive_array_handler jvm_primitive) (-> (Type Primitive) Handler) - (function (_ extension-name generate archive inputs) + (function (_ extension_name generate archive inputs) (case inputs (^ (list lengthS)) (do phase.monad [lengthI (generate archive lengthS)] (wrap (|>> lengthI - (_.array jvm-primitive)))) + (_.array jvm_primitive)))) _ - (phase.throw extension.invalid-syntax [extension-name %synthesis inputs])))) + (phase.throw extension.invalid_syntax [extension_name %synthesis inputs])))) (def: array::new::object Handler (..custom [($_ <>.and ..object .any) - (function (_ extension-name generate archive [objectJT lengthS]) + (function (_ extension_name generate archive [objectJT lengthS]) (do phase.monad [lengthI (generate archive lengthS)] (wrap (|>> lengthI (_.ANEWARRAY objectJT)))))])) -(def: (read-primitive-array-handler jvm-primitive loadI) +(def: (read_primitive_array_handler jvm_primitive loadI) (-> (Type Primitive) Inst Handler) - (function (_ extension-name generate archive inputs) + (function (_ extension_name generate archive inputs) (case inputs (^ (list idxS arrayS)) (do phase.monad [arrayI (generate archive arrayS) idxI (generate archive idxS)] (wrap (|>> arrayI - (_.CHECKCAST (type.array jvm-primitive)) + (_.CHECKCAST (type.array jvm_primitive)) idxI loadI))) _ - (phase.throw extension.invalid-syntax [extension-name %synthesis inputs])))) + (phase.throw extension.invalid_syntax [extension_name %synthesis inputs])))) (def: array::read::object Handler (..custom - [($_ <>.and ..object-array .any .any) - (function (_ extension-name generate archive [elementJT idxS arrayS]) + [($_ <>.and ..object_array .any .any) + (function (_ extension_name generate archive [elementJT idxS arrayS]) (do phase.monad [arrayI (generate archive arrayS) idxI (generate archive idxS)] @@ -409,9 +409,9 @@ idxI _.AALOAD))))])) -(def: (write-primitive-array-handler jvm-primitive storeI) +(def: (write_primitive_array_handler jvm_primitive storeI) (-> (Type Primitive) Inst Handler) - (function (_ extension-name generate archive inputs) + (function (_ extension_name generate archive inputs) (case inputs (^ (list idxS valueS arrayS)) (do phase.monad @@ -419,20 +419,20 @@ idxI (generate archive idxS) valueI (generate archive valueS)] (wrap (|>> arrayI - (_.CHECKCAST (type.array jvm-primitive)) + (_.CHECKCAST (type.array jvm_primitive)) _.DUP idxI valueI storeI))) _ - (phase.throw extension.invalid-syntax [extension-name %synthesis inputs])))) + (phase.throw extension.invalid_syntax [extension_name %synthesis inputs])))) (def: array::write::object Handler (..custom - [($_ <>.and ..object-array .any .any .any) - (function (_ extension-name generate archive [elementJT idxS valueS arrayS]) + [($_ <>.and ..object_array .any .any .any) + (function (_ extension_name generate archive [elementJT idxS valueS arrayS]) (do phase.monad [arrayI (generate archive arrayS) idxI (generate archive idxS) @@ -450,47 +450,47 @@ (|> bundle.empty (dictionary.merge (<| (bundle.prefix "length") (|> bundle.empty - (bundle.install (reflection.reflection reflection.boolean) (primitive-array-length-handler type.boolean)) - (bundle.install (reflection.reflection reflection.byte) (primitive-array-length-handler type.byte)) - (bundle.install (reflection.reflection reflection.short) (primitive-array-length-handler type.short)) - (bundle.install (reflection.reflection reflection.int) (primitive-array-length-handler type.int)) - (bundle.install (reflection.reflection reflection.long) (primitive-array-length-handler type.long)) - (bundle.install (reflection.reflection reflection.float) (primitive-array-length-handler type.float)) - (bundle.install (reflection.reflection reflection.double) (primitive-array-length-handler type.double)) - (bundle.install (reflection.reflection reflection.char) (primitive-array-length-handler type.char)) + (bundle.install (reflection.reflection reflection.boolean) (primitive_array_length_handler type.boolean)) + (bundle.install (reflection.reflection reflection.byte) (primitive_array_length_handler type.byte)) + (bundle.install (reflection.reflection reflection.short) (primitive_array_length_handler type.short)) + (bundle.install (reflection.reflection reflection.int) (primitive_array_length_handler type.int)) + (bundle.install (reflection.reflection reflection.long) (primitive_array_length_handler type.long)) + (bundle.install (reflection.reflection reflection.float) (primitive_array_length_handler type.float)) + (bundle.install (reflection.reflection reflection.double) (primitive_array_length_handler type.double)) + (bundle.install (reflection.reflection reflection.char) (primitive_array_length_handler type.char)) (bundle.install "object" array::length::object)))) (dictionary.merge (<| (bundle.prefix "new") (|> bundle.empty - (bundle.install (reflection.reflection reflection.boolean) (new-primitive-array-handler type.boolean)) - (bundle.install (reflection.reflection reflection.byte) (new-primitive-array-handler type.byte)) - (bundle.install (reflection.reflection reflection.short) (new-primitive-array-handler type.short)) - (bundle.install (reflection.reflection reflection.int) (new-primitive-array-handler type.int)) - (bundle.install (reflection.reflection reflection.long) (new-primitive-array-handler type.long)) - (bundle.install (reflection.reflection reflection.float) (new-primitive-array-handler type.float)) - (bundle.install (reflection.reflection reflection.double) (new-primitive-array-handler type.double)) - (bundle.install (reflection.reflection reflection.char) (new-primitive-array-handler type.char)) + (bundle.install (reflection.reflection reflection.boolean) (new_primitive_array_handler type.boolean)) + (bundle.install (reflection.reflection reflection.byte) (new_primitive_array_handler type.byte)) + (bundle.install (reflection.reflection reflection.short) (new_primitive_array_handler type.short)) + (bundle.install (reflection.reflection reflection.int) (new_primitive_array_handler type.int)) + (bundle.install (reflection.reflection reflection.long) (new_primitive_array_handler type.long)) + (bundle.install (reflection.reflection reflection.float) (new_primitive_array_handler type.float)) + (bundle.install (reflection.reflection reflection.double) (new_primitive_array_handler type.double)) + (bundle.install (reflection.reflection reflection.char) (new_primitive_array_handler type.char)) (bundle.install "object" array::new::object)))) (dictionary.merge (<| (bundle.prefix "read") (|> bundle.empty - (bundle.install (reflection.reflection reflection.boolean) (read-primitive-array-handler type.boolean _.BALOAD)) - (bundle.install (reflection.reflection reflection.byte) (read-primitive-array-handler type.byte _.BALOAD)) - (bundle.install (reflection.reflection reflection.short) (read-primitive-array-handler type.short _.SALOAD)) - (bundle.install (reflection.reflection reflection.int) (read-primitive-array-handler type.int _.IALOAD)) - (bundle.install (reflection.reflection reflection.long) (read-primitive-array-handler type.long _.LALOAD)) - (bundle.install (reflection.reflection reflection.float) (read-primitive-array-handler type.float _.FALOAD)) - (bundle.install (reflection.reflection reflection.double) (read-primitive-array-handler type.double _.DALOAD)) - (bundle.install (reflection.reflection reflection.char) (read-primitive-array-handler type.char _.CALOAD)) + (bundle.install (reflection.reflection reflection.boolean) (read_primitive_array_handler type.boolean _.BALOAD)) + (bundle.install (reflection.reflection reflection.byte) (read_primitive_array_handler type.byte _.BALOAD)) + (bundle.install (reflection.reflection reflection.short) (read_primitive_array_handler type.short _.SALOAD)) + (bundle.install (reflection.reflection reflection.int) (read_primitive_array_handler type.int _.IALOAD)) + (bundle.install (reflection.reflection reflection.long) (read_primitive_array_handler type.long _.LALOAD)) + (bundle.install (reflection.reflection reflection.float) (read_primitive_array_handler type.float _.FALOAD)) + (bundle.install (reflection.reflection reflection.double) (read_primitive_array_handler type.double _.DALOAD)) + (bundle.install (reflection.reflection reflection.char) (read_primitive_array_handler type.char _.CALOAD)) (bundle.install "object" array::read::object)))) (dictionary.merge (<| (bundle.prefix "write") (|> bundle.empty - (bundle.install (reflection.reflection reflection.boolean) (write-primitive-array-handler type.boolean _.BASTORE)) - (bundle.install (reflection.reflection reflection.byte) (write-primitive-array-handler type.byte _.BASTORE)) - (bundle.install (reflection.reflection reflection.short) (write-primitive-array-handler type.short _.SASTORE)) - (bundle.install (reflection.reflection reflection.int) (write-primitive-array-handler type.int _.IASTORE)) - (bundle.install (reflection.reflection reflection.long) (write-primitive-array-handler type.long _.LASTORE)) - (bundle.install (reflection.reflection reflection.float) (write-primitive-array-handler type.float _.FASTORE)) - (bundle.install (reflection.reflection reflection.double) (write-primitive-array-handler type.double _.DASTORE)) - (bundle.install (reflection.reflection reflection.char) (write-primitive-array-handler type.char _.CASTORE)) + (bundle.install (reflection.reflection reflection.boolean) (write_primitive_array_handler type.boolean _.BASTORE)) + (bundle.install (reflection.reflection reflection.byte) (write_primitive_array_handler type.byte _.BASTORE)) + (bundle.install (reflection.reflection reflection.short) (write_primitive_array_handler type.short _.SASTORE)) + (bundle.install (reflection.reflection reflection.int) (write_primitive_array_handler type.int _.IASTORE)) + (bundle.install (reflection.reflection reflection.long) (write_primitive_array_handler type.long _.LASTORE)) + (bundle.install (reflection.reflection reflection.float) (write_primitive_array_handler type.float _.FASTORE)) + (bundle.install (reflection.reflection reflection.double) (write_primitive_array_handler type.double _.DASTORE)) + (bundle.install (reflection.reflection reflection.char) (write_primitive_array_handler type.char _.CASTORE)) (bundle.install "object" array::write::object)))) ))) @@ -500,8 +500,8 @@ (def: (object::null? objectI) (Unary Inst) - (<| _.with-label (function (_ @then)) - _.with-label (function (_ @end)) + (<| _.with_label (function (_ @then)) + _.with_label (function (_ @end)) (|>> objectI (_.IFNULL @then) falseI @@ -526,7 +526,7 @@ (def: $Class (type.class "java.lang.Class" (list))) -(def: (object::class extension-name generate archive inputs) +(def: (object::class extension_name generate archive inputs) Handler (case inputs (^ (list (synthesis.text class))) @@ -536,20 +536,20 @@ (_.INVOKESTATIC $Class "forName" (type.method [(list (type.class "java.lang.String" (list))) $Class (list)]))))) _ - (phase.throw extension.invalid-syntax [extension-name %synthesis inputs]))) + (phase.throw extension.invalid_syntax [extension_name %synthesis inputs]))) (def: object::instance? Handler (..custom [($_ <>.and .text .any) - (function (_ extension-name generate archive [class objectS]) + (function (_ extension_name generate archive [class objectS]) (do phase.monad [objectI (generate archive objectS)] (wrap (|>> objectI (_.INSTANCEOF (type.class class (list))) (_.wrap type.boolean)))))])) -(def: (object::cast extension-name generate archive inputs) +(def: (object::cast extension_name generate archive inputs) Handler (case inputs (^ (list (synthesis.text from) (synthesis.text to) valueS)) @@ -580,9 +580,9 @@ (wrap valueI)))) _ - (phase.throw extension.invalid-syntax [extension-name %synthesis inputs]))) + (phase.throw extension.invalid_syntax [extension_name %synthesis inputs]))) -(def: object-bundle +(def: object_bundle Bundle (<| (bundle.prefix "object") (|> (: Bundle bundle.empty) @@ -605,13 +605,13 @@ [(reflection.reflection reflection.float) type.float] [(reflection.reflection reflection.double) type.double] [(reflection.reflection reflection.char) type.char]) - (dictionary.from-list text.hash))) + (dictionary.from_list text.hash))) (def: get::static Handler (..custom [($_ <>.and .text .text .text) - (function (_ extension-name generate archive [class field unboxed]) + (function (_ extension_name generate archive [class field unboxed]) (do phase.monad [] (case (dictionary.get unboxed ..primitives) @@ -625,7 +625,7 @@ Handler (..custom [($_ <>.and .text .text .text .any) - (function (_ extension-name generate archive [class field unboxed valueS]) + (function (_ extension_name generate archive [class field unboxed valueS]) (do phase.monad [valueI (generate archive valueS) #let [$class (type.class class (list))]] @@ -645,7 +645,7 @@ Handler (..custom [($_ <>.and .text .text .text .any) - (function (_ extension-name generate archive [class field unboxed objectS]) + (function (_ extension_name generate archive [class field unboxed objectS]) (do phase.monad [objectI (generate archive objectS) #let [$class (type.class class (list)) @@ -663,7 +663,7 @@ Handler (..custom [($_ <>.and .text .text .text .any .any) - (function (_ extension-name generate archive [class field unboxed valueS objectS]) + (function (_ extension_name generate archive [class field unboxed valueS objectS]) (do phase.monad [valueI (generate archive valueS) objectI (generate archive objectS) @@ -688,7 +688,7 @@ (Parser Input) (.tuple (<>.and ..value .any))) -(def: (generate-input generate archive [valueT valueS]) +(def: (generate_input generate archive [valueT valueS]) (-> Phase Archive Input (Operation (Typed Inst))) (do phase.monad @@ -703,7 +703,7 @@ (def: voidI (_.string synthesis.unit)) -(def: (prepare-output outputT) +(def: (prepare_output outputT) (-> (Type Return) Inst) (case (type.void? outputT) (#.Right outputT) @@ -716,22 +716,22 @@ Handler (..custom [($_ <>.and ..class .text ..return (<>.some ..input)) - (function (_ extension-name generate archive [class method outputT inputsTS]) + (function (_ extension_name generate archive [class method outputT inputsTS]) (do {@ phase.monad} - [inputsTI (monad.map @ (generate-input generate archive) inputsTS)] + [inputsTI (monad.map @ (generate_input generate archive) inputsTS)] (wrap (|>> (_.fuse (list@map product.right inputsTI)) (_.INVOKESTATIC class method (type.method [(list@map product.left inputsTI) outputT (list)])) - (prepare-output outputT)))))])) + (prepare_output outputT)))))])) (template [ ] [(def: Handler (..custom [($_ <>.and ..class .text ..return .any (<>.some ..input)) - (function (_ extension-name generate archive [class method outputT objectS inputsTS]) + (function (_ extension_name generate archive [class method outputT objectS inputsTS]) (do {@ phase.monad} [objectI (generate archive objectS) - inputsTI (monad.map @ (generate-input generate archive) inputsTS)] + inputsTI (monad.map @ (generate_input generate archive) inputsTS)] (wrap (|>> objectI (_.CHECKCAST class) (_.fuse (list@map product.right inputsTI)) @@ -739,7 +739,7 @@ (type.method [(list@map product.left inputsTI) outputT (list)])) - (prepare-output outputT)))))]))] + (prepare_output outputT)))))]))] [invoke::virtual _.INVOKEVIRTUAL] [invoke::special _.INVOKESPECIAL] @@ -750,9 +750,9 @@ Handler (..custom [($_ <>.and ..class (<>.some ..input)) - (function (_ extension-name generate archive [class inputsTS]) + (function (_ extension_name generate archive [class inputsTS]) (do {@ phase.monad} - [inputsTI (monad.map @ (generate-input generate archive) inputsTS)] + [inputsTI (monad.map @ (generate_input generate archive) inputsTS)] (wrap (|>> (_.NEW class) _.DUP (_.fuse (list@map product.right inputsTI)) @@ -779,28 +779,28 @@ (bundle.install "constructor" invoke::constructor)))) ))) -(def: annotation-parameter - (Parser (/.Annotation-Parameter Synthesis)) +(def: annotation_parameter + (Parser (/.Annotation_Parameter Synthesis)) (.tuple (<>.and .text .any))) (def: annotation (Parser (/.Annotation Synthesis)) - (.tuple (<>.and .text (<>.some ..annotation-parameter)))) + (.tuple (<>.and .text (<>.some ..annotation_parameter)))) (def: argument (Parser Argument) (.tuple (<>.and .text ..value))) -(def: overriden-method-definition - (Parser [(Environment Synthesis) (/.Overriden-Method Synthesis)]) +(def: overriden_method_definition + (Parser [(Environment Synthesis) (/.Overriden_Method Synthesis)]) (.tuple (do <>.monad - [_ (.text! /.overriden-tag) + [_ (.text! /.overriden_tag) ownerT ..class name .text - strict-fp? .bit + strict_fp? .bit annotations (.tuple (<>.some ..annotation)) vars (.tuple (<>.some ..var)) - self-name .text + self_name .text arguments (.tuple (<>.some ..argument)) returnT ..return exceptionsT (.tuple (<>.some ..class)) @@ -809,11 +809,11 @@ (.tuple .any)))] (wrap [environment [ownerT name - strict-fp? annotations vars - self-name arguments returnT exceptionsT + strict_fp? annotations vars + self_name arguments returnT exceptionsT body]])))) -(def: (normalize-path normalize) +(def: (normalize_path normalize) (-> (-> Synthesis Synthesis) (-> Path Path)) (function (recur path) @@ -834,21 +834,21 @@ [#synthesis.Bind] [#synthesis.Access]) - (#synthesis.Bit-Fork when then else) - (#synthesis.Bit-Fork when (recur then) (maybe@map recur else)) + (#synthesis.Bit_Fork when then else) + (#synthesis.Bit_Fork when (recur then) (maybe@map recur else)) (^template [] [( [[test then] elses]) ( [[test (recur then)] - (list@map (function (_ [else-test else-then]) - [else-test (recur else-then)]) + (list@map (function (_ [else_test else_then]) + [else_test (recur else_then)]) elses)])]) - ([#synthesis.I64-Fork] - [#synthesis.F64-Fork] - [#synthesis.Text-Fork]) + ([#synthesis.I64_Fork] + [#synthesis.F64_Fork] + [#synthesis.Text_Fork]) ))) -(def: (normalize-method-body mapping) +(def: (normalize_method_body mapping) (-> (Dictionary Synthesis Variable) Synthesis Synthesis) (function (recur body) (case body @@ -871,7 +871,7 @@ synthesis.variable) (^ (synthesis.branch/case [inputS pathS])) - (synthesis.branch/case [(recur inputS) (normalize-path recur pathS)]) + (synthesis.branch/case [(recur inputS) (normalize_path recur pathS)]) (^ (synthesis.branch/let [inputS register outputS])) (synthesis.branch/let [(recur inputS) register (recur outputS)]) @@ -911,37 +911,37 @@ (def: $Object (type.class "java.lang.Object" (list))) -(def: (anonymous-init-method env) +(def: (anonymous_init_method env) (-> (Environment Synthesis) (Type Method)) (type.method [(list.repeat (list.size env) $Object) type.void (list)])) -(def: (with-anonymous-init class env super-class inputsTI) +(def: (with_anonymous_init class env super_class inputsTI) (-> (Type Class) (Environment Synthesis) (Type Class) (List (Typed Inst)) Def) - (let [store-capturedI (|> env + (let [store_capturedI (|> env list.size list.indices (list@map (.function (_ register) (|>> (_.ALOAD 0) (_.ALOAD (inc register)) - (_.PUTFIELD class (///reference.foreign-name register) $Object)))) + (_.PUTFIELD class (///reference.foreign_name register) $Object)))) _.fuse)] - (_def.method #$.Public $.noneM "" (anonymous-init-method env) + (_def.method #$.Public $.noneM "" (anonymous_init_method env) (|>> (_.ALOAD 0) ((_.fuse (list@map product.right inputsTI))) - (_.INVOKESPECIAL super-class "" (type.method [(list@map product.left inputsTI) type.void (list)])) - store-capturedI + (_.INVOKESPECIAL super_class "" (type.method [(list@map product.left inputsTI) type.void (list)])) + store_capturedI _.RETURN)))) -(def: (anonymous-instance generate archive class env) +(def: (anonymous_instance generate archive class env) (-> Phase Archive (Type Class) (Environment Synthesis) (Operation Inst)) (do {@ phase.monad} [captureI+ (monad.map @ (generate archive) env)] (wrap (|>> (_.NEW class) _.DUP (_.fuse captureI+) - (_.INVOKESPECIAL class "" (anonymous-init-method env)))))) + (_.INVOKESPECIAL class "" (anonymous_init_method env)))))) (def: (returnI returnT) (-> (Type Return) Inst) @@ -979,58 +979,58 @@ ..class (.tuple (<>.some ..class)) (.tuple (<>.some ..input)) - (.tuple (<>.some ..overriden-method-definition))) - (function (_ extension-name generate archive [super-class super-interfaces + (.tuple (<>.some ..overriden_method_definition))) + (function (_ extension_name generate archive [super_class super_interfaces inputsTS - overriden-methods]) + overriden_methods]) (do {@ phase.monad} - [[context _] (generation.with-new-context archive (wrap [])) - #let [[module-id artifact-id] context - anonymous-class-name (///.class-name context) - class (type.class anonymous-class-name (list)) - total-environment (|> overriden-methods + [[context _] (generation.with_new_context archive (wrap [])) + #let [[module_id artifact_id] context + anonymous_class_name (///.class_name context) + class (type.class anonymous_class_name (list)) + total_environment (|> overriden_methods ## Get all the environments. (list@map product.left) ## Combine them. list@join ## Remove duplicates. - (set.from-list synthesis.hash) - set.to-list) - global-mapping (|> total-environment + (set.from_list synthesis.hash) + set.to_list) + global_mapping (|> total_environment ## Give them names as "foreign" variables. list.enumeration (list@map (function (_ [id capture]) [capture (#variable.Foreign id)])) - (dictionary.from-list synthesis.hash)) - normalized-methods (list@map (function (_ [environment + (dictionary.from_list synthesis.hash)) + normalized_methods (list@map (function (_ [environment [ownerT name - strict-fp? annotations vars - self-name arguments returnT exceptionsT + strict_fp? annotations vars + self_name arguments returnT exceptionsT body]]) - (let [local-mapping (|> environment + (let [local_mapping (|> environment list.enumeration - (list@map (function (_ [foreign-id capture]) - [(synthesis.variable/foreign foreign-id) - (|> global-mapping + (list@map (function (_ [foreign_id capture]) + [(synthesis.variable/foreign foreign_id) + (|> global_mapping (dictionary.get capture) maybe.assume)])) - (dictionary.from-list synthesis.hash))] + (dictionary.from_list synthesis.hash))] [ownerT name - strict-fp? annotations vars - self-name arguments returnT exceptionsT - (normalize-method-body local-mapping body)])) - overriden-methods)] - inputsTI (monad.map @ (generate-input generate archive) inputsTS) - method-definitions (|> normalized-methods + strict_fp? annotations vars + self_name arguments returnT exceptionsT + (normalize_method_body local_mapping body)])) + overriden_methods)] + inputsTI (monad.map @ (generate_input generate archive) inputsTS) + method_definitions (|> normalized_methods (monad.map @ (function (_ [ownerT name - strict-fp? annotations vars - self-name arguments returnT exceptionsT + strict_fp? annotations vars + self_name arguments returnT exceptionsT bodyS]) (do @ - [bodyG (generation.with-context artifact-id + [bodyG (generation.with_context artifact_id (generate archive bodyS))] (wrap (_def.method #$.Public - (if strict-fp? + (if strict_fp? ($_ $.++M $.finalM $.strictM) $.finalM) name @@ -1039,16 +1039,16 @@ exceptionsT]) (|>> bodyG (returnI returnT))))))) (\ @ map _def.fuse)) - #let [directive [anonymous-class-name + #let [directive [anonymous_class_name (_def.class #$.V1_6 #$.Public $.finalC - anonymous-class-name (list) - super-class super-interfaces - (|>> (///function.with-environment total-environment) - (..with-anonymous-init class total-environment super-class inputsTI) - method-definitions))]] + anonymous_class_name (list) + super_class super_interfaces + (|>> (///function.with_environment total_environment) + (..with_anonymous_init class total_environment super_class inputsTI) + method_definitions))]] _ (generation.execute! directive) - _ (generation.save! (%.nat artifact-id) directive)] - (..anonymous-instance generate archive class total-environment)))])) + _ (generation.save! (%.nat artifact_id) directive)] + (..anonymous_instance generate archive class total_environment)))])) (def: bundle::class Bundle @@ -1067,7 +1067,7 @@ (dictionary.merge ..double) (dictionary.merge ..char) (dictionary.merge ..array) - (dictionary.merge ..object-bundle) + (dictionary.merge ..object_bundle) (dictionary.merge ..member) (dictionary.merge ..bundle::class) ))) -- cgit v1.2.3