From f77acc12df0076c65122385846caf46e75b575de Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 30 Apr 2017 23:14:10 -0400 Subject: - Renamed fields of scopes. --- luxc/src/lux/analyser/env.clj | 2 +- luxc/src/lux/analyser/function.clj | 8 ++++---- luxc/src/lux/analyser/lux.clj | 4 ++-- luxc/src/lux/base.clj | 16 ++++++++-------- stdlib/source/lux.lux | 26 +++++++++++++------------- stdlib/source/lux/macro.lux | 4 ++-- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/luxc/src/lux/analyser/env.clj b/luxc/src/lux/analyser/env.clj index b8027a048..6f6e9f986 100644 --- a/luxc/src/lux/analyser/env.clj +++ b/luxc/src/lux/analyser/env.clj @@ -66,5 +66,5 @@ state) (&/$Cons env _) - (return* state (->> env (&/get$ &/$closure) (&/get$ &/$mappings)))) + (return* state (->> env (&/get$ &/$captured) (&/get$ &/$mappings)))) )) diff --git a/luxc/src/lux/analyser/function.clj b/luxc/src/lux/analyser/function.clj index aaaaed9f9..7d199ba30 100644 --- a/luxc/src/lux/analyser/function.clj +++ b/luxc/src/lux/analyser/function.clj @@ -20,9 +20,9 @@ (|let [[[register-type register-cursor] _] register register* (&&/|meta register-type register-cursor (&&/$captured (&/T [scope - (->> frame (&/get$ &/$closure) (&/get$ &/$counter)) + (->> frame (&/get$ &/$captured) (&/get$ &/$counter)) register])))] - (&/T [register* (&/update$ &/$closure #(->> % - (&/update$ &/$counter inc) - (&/update$ &/$mappings (fn [mps] (&/|put name register* mps)))) + (&/T [register* (&/update$ &/$captured #(->> % + (&/update$ &/$counter inc) + (&/update$ &/$mappings (fn [mps] (&/|put name register* mps)))) frame)]))) diff --git a/luxc/src/lux/analyser/lux.clj b/luxc/src/lux/analyser/lux.clj index e10810475..6649628c7 100644 --- a/luxc/src/lux/analyser/lux.clj +++ b/luxc/src/lux/analyser/lux.clj @@ -277,7 +277,7 @@ (fn [state] (|let [stack (&/get$ &/$scopes state) no-binding? #(and (->> % (&/get$ &/$locals) (&/get$ &/$mappings) (&/|contains? name) not) - (->> % (&/get$ &/$closure) (&/get$ &/$mappings) (&/|contains? name) not)) + (->> % (&/get$ &/$captured) (&/get$ &/$mappings) (&/|contains? name) not)) [inner outer] (&/|split-with no-binding? stack)] (|case outer (&/$Nil) @@ -292,7 +292,7 @@ [register* frame*] (&&function/close-over in-scope name register frame)] (&/T [register* (&/$Cons frame* new-inner)]))) (&/T [(or (->> bottom-outer (&/get$ &/$locals) (&/get$ &/$mappings) (&/|get name)) - (->> bottom-outer (&/get$ &/$closure) (&/get$ &/$mappings) (&/|get name))) + (->> bottom-outer (&/get$ &/$captured) (&/get$ &/$mappings) (&/|get name))) &/$Nil]) (&/|reverse inner) scopes)] ((|do [_ (&type/check exo-type (&&/expr-type* =local))] diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 95c78bc02..536009a39 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -119,9 +119,9 @@ ;; Env (deftuple ["name" - "inner-closures" + "inner" "locals" - "closure"]) + "captured"]) ;; Host (deftuple @@ -726,13 +726,13 @@ (|table)])) (defn env [name old-name] - (T [;; "lux;name" + (T [;; name ($Cons name old-name) - ;; "lux;inner-closures" + ;; inner 0 - ;; "lux;locals" + ;; locals +init-bindings+ - ;; "lux;closure" + ;; captured +init-bindings+] )) @@ -959,10 +959,10 @@ (defn with-closure [body] (|do [closure-name (|do [top get-top-local-env] - (return (->> top (get$ $inner-closures) str)))] + (return (->> top (get$ $inner) str)))] (fn [state] (let [body* (with-scope closure-name body)] - (run-state body* (update$ $scopes #($Cons (update$ $inner-closures inc (|head %)) + (run-state body* (update$ $scopes #($Cons (update$ $inner inc (|head %)) (|tail %)) state)))))) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index e1244d970..1632e6eab 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -352,24 +352,24 @@ default-def-meta-exported)))) ## (type: Scope -## {#name (List Text) -## #inner-closures Int -## #locals (Bindings Text Void) -## #closure (Bindings Text Void)}) +## {#name (List Text) +## #inner Nat +## #locals (Bindings Text Void) +## #captured (Bindings Text Void)}) (_lux_def Scope (#NamedT ["lux" "Scope"] - (#ProdT ## "lux;name" + (#ProdT ## name (#AppT List Text) - (#ProdT ## "lux;inner-closures" - Int - (#ProdT ## "lux;locals" + (#ProdT ## inner + Nat + (#ProdT ## locals (#AppT (#AppT Bindings Text) Void) - ## "lux;closure" + ## captured (#AppT (#AppT Bindings Text) Void))))) (#Cons [["lux" "tags"] (#ListA (#Cons (#TextA "name") - (#Cons (#TextA "inner-closures") + (#Cons (#TextA "inner") (#Cons (#TextA "locals") - (#Cons (#TextA "closure") + (#Cons (#TextA "captured") #Nil)))))] default-def-meta-exported)) @@ -1878,7 +1878,7 @@ #seed seed #expected expected #cursor cursor #scope-type-vars scope-type-vars} (_lux_case (reverse scopes) - (#Cons {#name (#;Cons module-name #Nil) #inner-closures _ #locals _ #closure _} _) + (#Cons {#name (#;Cons module-name #Nil) #inner _ #locals _ #captured _} _) (#Right [state module-name]) _ @@ -4130,7 +4130,7 @@ (find (: (-> Scope (Maybe Type)) (function [env] (case env - {#name _ #inner-closures _ #locals {#counter _ #mappings locals} #closure {#counter _ #mappings closure}} + {#name _ #inner _ #locals {#counter _ #mappings locals} #captured {#counter _ #mappings closure}} (try-both (find (: (-> [Text Void] (Maybe Type)) (function [[bname analysis]] (let [[[type _] _] (:! (Meta [Type Cursor] Void) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 93920c67b..77902ba1a 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -431,13 +431,13 @@ (or (any? test (:! (List [Text (Meta [Type Cursor] Void)]) (get@ [#;locals #;mappings] env))) (any? test (:! (List [Text (Meta [Type Cursor] Void)]) - (get@ [#;closure #;mappings] env))))) + (get@ [#;captured #;mappings] env))))) (get@ #;scopes state)) [_ [[type _] _]] (try-both (find test) (:! (List [Text (Meta [Type Cursor] Void)]) (get@ [#;locals #;mappings] scope)) (:! (List [Text (Meta [Type Cursor] Void)]) - (get@ [#;closure #;mappings] scope)))] + (get@ [#;captured #;mappings] scope)))] (wrap type)) (#;Some var-type) (#;Right [state var-type]) -- cgit v1.2.3