From 55219078698866155d7d3879f1378f75ba2ba3ee Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 29 Dec 2019 22:41:46 -0400 Subject: FIX the names of function classes are now prefixed with their originating module. --- new-luxc/source/luxc/lang/translation/jvm.lux | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/jvm.lux') 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])))) -- cgit v1.2.3