diff options
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm/extension/host.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/jvm/extension/host.lux | 154 |
1 files changed, 78 insertions, 76 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/extension/host.lux b/new-luxc/source/luxc/lang/translation/jvm/extension/host.lux index 7569a825e..cf039db68 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/extension/host.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/extension/host.lux @@ -946,87 +946,89 @@ ## (:: type.equivalence = type.double returnT) _.DRETURN)))) -(def: class::anonymous - Handler - (..custom - [($_ <>.and - <s>.text - ..class - (<s>.tuple (<>.some ..class)) - (<s>.tuple (<>.some ..input)) - (<s>.tuple (<>.some ..overriden-method-definition))) - (function (_ extension-name generate archive [class-name - super-class super-interfaces - inputsTS - overriden-methods]) - (do phase.monad - [#let [class (type.class class-name (list)) - total-environment (|> overriden-methods - ## Get all the environments. - (list@map product.left) - ## Combine them. - list@join - ## Remove duplicates. - (set.from-list reference.hash) - set.to-list) - global-mapping (|> total-environment - ## Give them names as "foreign" variables. - list.enumerate - (list@map (function (_ [id capture]) - [capture (#reference.Foreign id)])) - (dictionary.from-list reference.hash)) - normalized-methods (list@map (function (_ [environment - [ownerT name - strict-fp? annotations vars - self-name arguments returnT exceptionsT - body]]) - (let [local-mapping (|> environment - list.enumerate - (list@map (function (_ [foreign-id capture]) - [(#reference.Foreign foreign-id) - (|> global-mapping - (dictionary.get capture) - maybe.assume)])) - (dictionary.from-list reference.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 - (monad.map @ (function (_ [ownerT name - strict-fp? annotations vars - self-name arguments returnT exceptionsT - bodyS]) - (do @ - [bodyG (generation.with-specific-context class-name - (generate archive bodyS))] - (wrap (_def.method #$.Public - (if strict-fp? - ($_ $.++M $.finalM $.strictM) - $.finalM) - name - (type.method [(list@map product.right arguments) - returnT - exceptionsT]) - (|>> bodyG (returnI returnT))))))) - (:: @ map _def.fuse)) - _ (generation.save! true ["" class-name] - [class-name - (_def.class #$.V1_6 #$.Public $.finalC - class-name (list) - super-class super-interfaces - (|>> (///function.with-environment total-environment) - (..with-anonymous-init class total-environment super-class inputsTI) - method-definitions))])] - (anonymous-instance class total-environment)))])) +## TODO: Uncomment ASAP +## (def: class::anonymous +## Handler +## (..custom +## [($_ <>.and +## <s>.text +## ..class +## (<s>.tuple (<>.some ..class)) +## (<s>.tuple (<>.some ..input)) +## (<s>.tuple (<>.some ..overriden-method-definition))) +## (function (_ extension-name generate archive [class-name +## super-class super-interfaces +## inputsTS +## overriden-methods]) +## (do phase.monad +## [#let [class (type.class class-name (list)) +## total-environment (|> overriden-methods +## ## Get all the environments. +## (list@map product.left) +## ## Combine them. +## list@join +## ## Remove duplicates. +## (set.from-list reference.hash) +## set.to-list) +## global-mapping (|> total-environment +## ## Give them names as "foreign" variables. +## list.enumerate +## (list@map (function (_ [id capture]) +## [capture (#reference.Foreign id)])) +## (dictionary.from-list reference.hash)) +## normalized-methods (list@map (function (_ [environment +## [ownerT name +## strict-fp? annotations vars +## self-name arguments returnT exceptionsT +## body]]) +## (let [local-mapping (|> environment +## list.enumerate +## (list@map (function (_ [foreign-id capture]) +## [(#reference.Foreign foreign-id) +## (|> global-mapping +## (dictionary.get capture) +## maybe.assume)])) +## (dictionary.from-list reference.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 +## (monad.map @ (function (_ [ownerT name +## strict-fp? annotations vars +## self-name arguments returnT exceptionsT +## bodyS]) +## (do @ +## [bodyG (generation.with-specific-context class-name +## (generate archive bodyS))] +## (wrap (_def.method #$.Public +## (if strict-fp? +## ($_ $.++M $.finalM $.strictM) +## $.finalM) +## name +## (type.method [(list@map product.right arguments) +## returnT +## exceptionsT]) +## (|>> bodyG (returnI returnT))))))) +## (:: @ map _def.fuse)) +## _ (generation.save! true ["" class-name] +## [class-name +## (_def.class #$.V1_6 #$.Public $.finalC +## class-name (list) +## super-class super-interfaces +## (|>> (///function.with-environment total-environment) +## (..with-anonymous-init class total-environment super-class inputsTI) +## method-definitions))])] +## (anonymous-instance class total-environment)))])) (def: bundle::class Bundle (<| (bundle.prefix "class") (|> (: Bundle bundle.empty) - (bundle.install "anonymous" class::anonymous) + ## TODO: Uncomment ASAP + ## (bundle.install "anonymous" class::anonymous) ))) (def: #export bundle |