diff options
author | Eduardo Julian | 2017-05-01 00:07:09 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-05-01 00:07:09 -0400 |
commit | 94cca1d49c0d3f6d328a81eaf6ce9660a6f149c1 (patch) | |
tree | ae87be56f16bba552c2a50c69125db725347b4b4 /stdlib/source/lux.lux | |
parent | f77acc12df0076c65122385846caf46e75b575de (diff) |
- Changed the way Scope works, to make it independent from the notion of Analysis, and make it easier to port to the new re-written compiler.
- Fixed a type-bug when asserting whether a def is being re-defined.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux.lux | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 1632e6eab..fe9958d56 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -351,11 +351,25 @@ (#Cons [["lux" "type-args"] (#ListA (#Cons (#TextA "m") (#Cons (#TextA "v") #;Nil)))] default-def-meta-exported)))) +## (type: #export Ref +## (#Local Nat) +## (#Captured Nat)) +(_lux_def Ref + (#NamedT ["lux" "Ref"] + (#SumT ## Local + Nat + ## Captured + Nat)) + (#Cons [["lux" "tags"] (#ListA (#Cons (#TextA "Local") + (#Cons (#TextA "Captured") + #Nil)))] + default-def-meta-exported)) + ## (type: Scope ## {#name (List Text) ## #inner Nat -## #locals (Bindings Text Void) -## #captured (Bindings Text Void)}) +## #locals (Bindings Text [Type Nat]) +## #captured (Bindings Text [Type Ref])}) (_lux_def Scope (#NamedT ["lux" "Scope"] (#ProdT ## name @@ -363,9 +377,9 @@ (#ProdT ## inner Nat (#ProdT ## locals - (#AppT (#AppT Bindings Text) Void) + (#AppT (#AppT Bindings Text) (#ProdT Type Nat)) ## captured - (#AppT (#AppT Bindings Text) Void))))) + (#AppT (#AppT Bindings Text) (#ProdT Type Ref)))))) (#Cons [["lux" "tags"] (#ListA (#Cons (#TextA "name") (#Cons (#TextA "inner") (#Cons (#TextA "locals") @@ -4130,16 +4144,17 @@ (find (: (-> Scope (Maybe Type)) (function [env] (case env - {#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) - analysis)] - (if (Text/= name bname) - (#Some type) - #None))))) - locals - closure)))) + {#name _ + #inner _ + #locals {#counter _ #mappings locals} + #captured {#counter _ #mappings closure}} + (try-both (find (: (-> [Text [Type Top]] (Maybe Type)) + (function [[bname [type _]]] + (if (Text/= name bname) + (#Some type) + #None)))) + (: (List [Text [Type Top]]) locals) + (: (List [Text [Type Top]]) closure))))) scopes))) (def: (find-def-type name state) |