diff options
Diffstat (limited to 'new-luxc/source/luxc/scope.lux')
-rw-r--r-- | new-luxc/source/luxc/scope.lux | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/new-luxc/source/luxc/scope.lux b/new-luxc/source/luxc/scope.lux index 1dc5b932d..bd9a3233f 100644 --- a/new-luxc/source/luxc/scope.lux +++ b/new-luxc/source/luxc/scope.lux @@ -5,9 +5,9 @@ text/format [maybe "maybe/" Monad<Maybe>] [product] - ["R" result] + ["e" error] (coll [list "list/" Fold<List> Monoid<List>])) - [macro]) + [meta]) (luxc ["&" base])) (type: Locals (Bindings Text [Type Nat])) @@ -47,7 +47,7 @@ (get-captured name scope))) (def: #export (find name) - (-> Text (Lux (Maybe [Type Ref]))) + (-> Text (Meta (Maybe [Type Ref]))) (function [compiler] (let [[inner outer] (|> compiler (get@ #;scopes) @@ -76,7 +76,7 @@ )))) (def: #export (with-local [name type] action) - (All [a] (-> [Text Type] (Lux a) (Lux a))) + (All [a] (-> [Text Type] (Meta a) (Meta a))) (function [compiler] (case (get@ #;scopes compiler) (#;Cons head tail) @@ -87,24 +87,24 @@ (|>. (update@ #;counter n.inc) (update@ #;mappings (&;pl-put name [type new-var-id])))) head)] - (case (macro;run' (set@ #;scopes (#;Cons new-head tail) compiler) - action) - (#R;Success [compiler' output]) + (case (meta;run' (set@ #;scopes (#;Cons new-head tail) compiler) + action) + (#e;Success [compiler' output]) (case (get@ #;scopes compiler') (#;Cons head' tail') (let [scopes' (#;Cons (set@ #;locals (get@ #;locals head) head') tail')] - (#R;Success [(set@ #;scopes scopes' compiler') + (#e;Success [(set@ #;scopes scopes' compiler') output])) _ (error! "Invalid scope alteration.")) - (#R;Error error) - (#R;Error error))) + (#e;Error error) + (#e;Error error))) _ - (#R;Error "Cannot create local binding without a scope.")) + (#e;Error "Cannot create local binding without a scope.")) )) (do-template [<name> <val-type>] @@ -125,7 +125,7 @@ #;captured init-captured}) (def: #export (with-scope name action) - (All [a] (-> Text (Lux a) (Lux a))) + (All [a] (-> Text (Meta a) (Meta a))) (function [compiler] (let [parent-name (case (get@ #;scopes compiler) #;Nil @@ -136,11 +136,11 @@ (case (action (update@ #;scopes (|>. (#;Cons (scope parent-name name))) compiler)) - (#R;Error error) - (#R;Error error) + (#e;Error error) + (#e;Error error) - (#R;Success [compiler' output]) - (#R;Success [(update@ #;scopes + (#e;Success [compiler' output]) + (#e;Success [(update@ #;scopes (|>. list;tail (maybe;default (list))) compiler') output]) @@ -148,11 +148,11 @@ )) (def: #export next-local - (Lux Nat) + (Meta Nat) (function [compiler] (case (get@ #;scopes compiler) #;Nil - (#R;Error "Cannot get next reference when there is no scope.") + (#e;Error "Cannot get next reference when there is no scope.") (#;Cons top _) - (#R;Success [compiler (get@ [#;locals #;counter] top)])))) + (#e;Success [compiler (get@ [#;locals #;counter] top)])))) |