From 2a3946e713821880ecc47580e754315349f2fe73 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 13 Nov 2017 20:02:18 -0400 Subject: - Type-vars no longer get deleted. - Fixed some bugs. --- .../source/luxc/lang/translation/reference.jvm.lux | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/reference.jvm.lux') diff --git a/new-luxc/source/luxc/lang/translation/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/reference.jvm.lux index 3e835f8e1..8e229af9c 100644 --- a/new-luxc/source/luxc/lang/translation/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/reference.jvm.lux @@ -11,8 +11,16 @@ ["$i" inst])) (lang ["ls" synthesis] [";L" variable #+ Variable] - (translation [";T" common] - [";T" function])))) + (translation [";T" common])))) + +(do-template [ ] + [(def: #export ( idx) + (-> Nat Text) + (|> idx nat-to-int %i (format )))] + + [captured "c"] + [partial "p"] + ) (def: #export (translate-captured variable) (-> Variable (Meta $;Inst)) @@ -20,13 +28,19 @@ [function-class hostL;context] (wrap (|>. ($i;ALOAD +0) ($i;GETFIELD function-class - (|> variable i.inc (i.* -1) int-to-nat functionT;captured) + (|> variable i.inc (i.* -1) int-to-nat captured) commonT;$Object))))) -(def: #export (translate-variable variable) +(def: #export (translate-local variable) (-> Variable (Meta $;Inst)) (meta/wrap ($i;ALOAD (int-to-nat variable)))) +(def: #export (translate-variable variable) + (-> Variable (Meta $;Inst)) + (if (variableL;captured? variable) + (translate-captured variable) + (translate-local variable))) + (def: #export (translate-definition [def-module def-name]) (-> Ident (Meta $;Inst)) (let [bytecode-name (format def-module "/" (&;normalize-name def-name))] -- cgit v1.2.3