aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm.lux24
1 files changed, 19 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]))))