From 005fa8c09fa469233736912f772022f1dfacf352 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 28 Jul 2018 20:31:40 -0400 Subject: Now providing labels/names for any intermediate definitions that might be necessary when doing evaluate/execute on a host platform. --- stdlib/source/lux/compiler/default/phase/translation.lux | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'stdlib') diff --git a/stdlib/source/lux/compiler/default/phase/translation.lux b/stdlib/source/lux/compiler/default/phase/translation.lux index f9d61c4af..c0242bd38 100644 --- a/stdlib/source/lux/compiler/default/phase/translation.lux +++ b/stdlib/source/lux/compiler/default/phase/translation.lux @@ -42,9 +42,9 @@ #inner-functions Nat}) (signature: #export (Host expression statement) - (: (-> expression (Error Any)) + (: (-> Text expression (Error Any)) evaluate!) - (: (-> statement (Error Any)) + (: (-> Text statement (Error Any)) execute!)) (type: #export (Buffer statement) (Row [Name statement])) @@ -157,12 +157,17 @@ [_ (extension.update (update@ #counter inc))] (extension.read (get@ #counter)))) +(def: (temp-label state) + (All [anchor expression statement] + (-> (State anchor expression statement) Text)) + (format (get@ [#context #scope-name] state) " " (%n (get@ #counter state)))) + (do-template [ ] [(def: #export ( code) (All [anchor expression statement] (-> (Operation anchor expression statement Any))) (function (_ (^@ stateE [bundle state])) - (case (:: (get@ #host state) code) + (case (:: (get@ #host state) (temp-label state) code) (#error.Error error) (ex.throw cannot-interpret error) -- cgit v1.2.3