diff options
author | Eduardo Julian | 2018-07-28 20:31:40 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-07-28 20:31:40 -0400 |
commit | 005fa8c09fa469233736912f772022f1dfacf352 (patch) | |
tree | 43a963c64fc1b692a9046dad41b041eaebd95395 /stdlib | |
parent | 1b1aeffd79158bc973018751ea5185a730713bed (diff) |
Now providing labels/names for any intermediate definitions that might be necessary when doing evaluate/execute on a host platform.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/compiler/default/phase/translation.lux | 11 |
1 files changed, 8 insertions, 3 deletions
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 [<name> <inputT>] [(def: #export (<name> code) (All [anchor expression statement] (-> <inputT> (Operation anchor expression statement Any))) (function (_ (^@ stateE [bundle state])) - (case (:: (get@ #host state) <name> code) + (case (:: (get@ #host state) <name> (temp-label state) code) (#error.Error error) (ex.throw cannot-interpret error) |