diff options
author | Eduardo Julian | 2019-12-29 22:41:46 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-12-29 22:41:46 -0400 |
commit | 55219078698866155d7d3879f1378f75ba2ba3ee (patch) | |
tree | 47db4442c7063d2e234a4cc4f0f49d9792097af4 /new-luxc/source/luxc/lang/translation | |
parent | 84ea12c2960cc7460de81087a6e53bcc6d37a3d6 (diff) |
FIX the names of function classes are now prefixed with their originating module.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/jvm.lux | 24 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/translation/jvm/function.lux | 1 |
2 files changed, 20 insertions, 5 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm.lux b/new-luxc/source/luxc/lang/translation/jvm.lux index fccbd14bf..cf04d2a1a 100644 --- a/new-luxc/source/luxc/lang/translation/jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm.lux @@ -87,9 +87,25 @@ (def: class-path-separator ".") +(def: #export bytecode-name + (-> Text Text) + (text.replace-all ..class-path-separator .module-separator)) + +## TODO: This is a hackish solution to the issue I have. +## It should be cleaned up ASAP. +(def: #export class-name' + (-> Text Text) + (text.replace-all .module-separator ..class-path-separator)) + +(def: #export (class-name [module name]) + (-> Name Text) + (format (text.replace-all .module-separator ..class-path-separator module) + ..class-path-separator (name.normalize name) + "___" (%.nat (text@hash name)))) + (def: (evaluate! library loader eval-class valueI) (-> Library ClassLoader Text Inst (Try [Any Definition])) - (let [bytecode-name (text.replace-all class-path-separator .module-separator eval-class) + (let [bytecode-name (..bytecode-name eval-class) bytecode (def.class #jvm.V1_6 #jvm.Public jvm.noneC bytecode-name @@ -122,11 +138,9 @@ (loader.store class-name class-bytecode library))] (loader.load class-name loader)))) -(def: (define! library loader [module name] valueI) +(def: (define! library loader definition-name valueI) (-> Library ClassLoader Name Inst (Try [Text Any Definition])) - (let [class-name (format (text.replace-all .module-separator class-path-separator module) - class-path-separator (name.normalize name) - "___" (%.nat (text@hash name)))] + (let [class-name (..class-name definition-name)] (do try.monad [[value definition] (evaluate! library loader class-name valueI)] (wrap [class-name value definition])))) diff --git a/new-luxc/source/luxc/lang/translation/jvm/function.lux b/new-luxc/source/luxc/lang/translation/jvm/function.lux index 7a4bbef4e..d141b2392 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/function.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/function.lux @@ -298,6 +298,7 @@ [function-class bodyI] (generation.with-context (generation.with-anchor [@begin 1] (generate bodyS))) + #let [function-class (//.class-name' function-class)] [functionD instanceI] (with-function @begin function-class env arity bodyI) _ (generation.save! true ["" function-class] [function-class |