From bae39f32cddb816a6123697269c20dbf4a65ac19 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 9 Oct 2020 01:16:47 -0400 Subject: Also using BIPUSH and SIPUSH during JVM generation. --- luxc/src/lux/base.clj | 4 ++-- luxc/src/lux/type/host.clj | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'luxc') diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 6ee111724..cc109b0f7 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -1182,7 +1182,7 @@ ;; Based on the LuxRT.decode_rev method (defn decode-rev [^String input] (if (and (.startsWith input ".") - (< (.length input) (inc rev-bits))) + (<= (.length input) (inc rev-bits))) (loop [digits-left (-> input (.substring 1) clean-separators @@ -1199,7 +1199,7 @@ (inc index) ouput))) ouput)) - (throw (str "Bad format for Rev number: " input)))) + (throw (new java.lang.Exception (str "Bad format for Rev number: " input))))) ) (defn show-ast [ast] diff --git a/luxc/src/lux/type/host.clj b/luxc/src/lux/type/host.clj index bddc6829b..36e969046 100644 --- a/luxc/src/lux/type/host.clj +++ b/luxc/src/lux/type/host.clj @@ -282,11 +282,16 @@ (&/fold% (partial raise* existential) (&/T [class params]) lineage)) ;; [Exports] +(defn find-class! [class class-loader] + (try (return (Class/forName class true class-loader)) + (catch java.lang.ClassNotFoundException ex + (&/fail-with-loc (str "[Host Error] Cannot find class: " (pr-str class)))))) + (defn ->super-type "(-> Text Text (List Type) (Lux Type))" [existential class-loader super-class sub-class sub-params] - (let [super-class+ (Class/forName super-class true class-loader) - sub-class+ (Class/forName sub-class true class-loader)] + (|do [^Class super-class+ (find-class! super-class class-loader) + ^Class sub-class+ (find-class! sub-class class-loader)] (if (.isAssignableFrom super-class+ sub-class+) (let [lineage (trace-lineage sub-class+ super-class+)] (|do [[^Class sub-class* sub-params*] (raise existential lineage sub-class+ sub-params)] -- cgit v1.2.3