From 7b870a7bd124f35939d9089a2e21f0806a4c6e85 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 29 Oct 2017 22:21:14 -0400 Subject: - Fixed some bugs. - Improved error reporting. - Implemented macro-expansion (for JVM). - Implemented "let" compilation. --- new-luxc/source/luxc/generator/function.jvm.lux | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'new-luxc/source/luxc/generator/function.jvm.lux') diff --git a/new-luxc/source/luxc/generator/function.jvm.lux b/new-luxc/source/luxc/generator/function.jvm.lux index 97d3a7c91..ce92b9010 100644 --- a/new-luxc/source/luxc/generator/function.jvm.lux +++ b/new-luxc/source/luxc/generator/function.jvm.lux @@ -5,6 +5,7 @@ (coll [list "list/" Functor Monoid])) [meta]) (luxc ["&" base] + [";L" host] (lang ["la" analysis] ["ls" synthesis]) ["&;" analyser] @@ -58,7 +59,7 @@ (def: get-amount-of-partialsI $;Inst (|>. ($i;ALOAD +0) - ($i;GETFIELD &runtime;function-class &runtime;partials-field $t;int))) + ($i;GETFIELD hostL;function-class &runtime;partials-field $t;int))) (def: (load-fieldI class field) (-> Text Text $;Inst) @@ -77,9 +78,9 @@ later-applysI (if (n.> &runtime;num-apply-variants amount) (applysI (n.+ &runtime;num-apply-variants start) (n.- &runtime;num-apply-variants amount)) id)] - (|>. ($i;CHECKCAST &runtime;function-class) + (|>. ($i;CHECKCAST hostL;function-class) (inputsI start max-args) - ($i;INVOKEVIRTUAL &runtime;function-class &runtime;apply-method (&runtime;apply-signature max-args) false) + ($i;INVOKEVIRTUAL hostL;function-class &runtime;apply-method (&runtime;apply-signature max-args) false) later-applysI))) (def: (inc-intI by) @@ -167,9 +168,9 @@ (-> ls;Arity Nat $;Inst) (if (n.= +1 arity) (|>. ($i;int 0) - ($i;INVOKESPECIAL &runtime;function-class "" function-init-method false)) + ($i;INVOKESPECIAL hostL;function-class "" function-init-method false)) (|>. ($i;ILOAD (n.inc env-size)) - ($i;INVOKESPECIAL &runtime;function-class "" function-init-method false)))) + ($i;INVOKESPECIAL hostL;function-class "" function-init-method false)))) (def: (with-init class env arity) (-> Text (List ls;Variable) ls;Arity $;Def) @@ -262,7 +263,7 @@ ($i;TABLESWITCH 0 (|> num-partials n.dec nat-to-int) @default @labels) casesI - ($i;INVOKESTATIC &runtime;runtime-class "apply_fail" ($t;method (list) #;None (list)) false) + ($i;INVOKESTATIC hostL;runtime-class "apply_fail" ($t;method (list) #;None (list)) false) $i;NULL $i;ARETURN )))) @@ -306,7 +307,7 @@ _ (&common;store-class function-class ($d;class #$;V1.6 #$;Public $;finalC function-class (list) - ($;simple-class &runtime;function-class) (list) + ($;simple-class hostL;function-class) (list) functionD))] (wrap instanceI))) @@ -326,9 +327,9 @@ argsI (monad;map @ generate argsS) #let [applyI (|> (segment &runtime;num-apply-variants argsI) (list/map (function [chunkI+] - (|>. ($i;CHECKCAST &runtime;function-class) + (|>. ($i;CHECKCAST hostL;function-class) ($i;fuse chunkI+) - ($i;INVOKEVIRTUAL &runtime;function-class &runtime;apply-method (&runtime;apply-signature (list;size chunkI+)) false)))) + ($i;INVOKEVIRTUAL hostL;function-class &runtime;apply-method (&runtime;apply-signature (list;size chunkI+)) false)))) $i;fuse)]] (wrap (|>. functionI applyI)))) -- cgit v1.2.3