diff options
author | Eduardo Julian | 2017-10-26 21:41:41 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-26 21:41:41 -0400 |
commit | 3439602c2b356eaef3359b6496a0237f1af55e33 (patch) | |
tree | 90c3c1d0f97fc30b1a991de50977d8a075564724 /new-luxc/source/luxc/base.lux | |
parent | e2621632653ad1252744eecff6da143faaf90787 (diff) |
- Added a new piece of compiler state, just for storing the current-module.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/base.lux | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/new-luxc/source/luxc/base.lux b/new-luxc/source/luxc/base.lux index 28b5437e9..bac16fd79 100644 --- a/new-luxc/source/luxc/base.lux +++ b/new-luxc/source/luxc/base.lux @@ -145,7 +145,7 @@ (def: fresh-scope Scope - {#;name (list "lux") + {#;name (list) #;inner +0 #;locals fresh-bindings #;captured fresh-bindings}) @@ -166,6 +166,19 @@ (#e;Error error) (#e;Error error)))) +(def: #export (with-current-module name action) + (All [a] (-> Text (Meta a) (Meta a))) + (function [compiler] + (case (action (set@ #;current-module (#;Some name) compiler)) + (#e;Success [compiler' output]) + (#e;Success [(set@ #;current-module + (get@ #;current-module compiler) + compiler') + output]) + + (#e;Error error) + (#e;Error error)))) + (def: #export (with-cursor cursor action) (All [a] (-> Cursor (Meta a) (Meta a))) (if (text/= "" (product;left cursor)) |