diff options
author | Eduardo Julian | 2017-10-26 14:48:05 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-10-26 14:48:05 -0400 |
commit | 1fabe19f7eacb668ef26cccde681dce5e2f98072 (patch) | |
tree | ad2ead4ae5d7f997353e7b8223aa29725df40111 /new-luxc/source/luxc/analyser | |
parent | 40e9eae7468af9b03f6c684171d83a521dd90e82 (diff) |
- WIP: Wiring everything to get the compiler to work fully.
- Fixed a bug when combining field/method/class modifiers.
Diffstat (limited to 'new-luxc/source/luxc/analyser')
-rw-r--r-- | new-luxc/source/luxc/analyser/structure.lux | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/new-luxc/source/luxc/analyser/structure.lux b/new-luxc/source/luxc/analyser/structure.lux index 3bcc04d7e..8c1f7118c 100644 --- a/new-luxc/source/luxc/analyser/structure.lux +++ b/new-luxc/source/luxc/analyser/structure.lux @@ -206,19 +206,25 @@ (&;fail "") )))) -(def: #export (analyse-tagged-sum analyse tag value) +(def: #export (analyse-tagged-sum analyse tag valueC) (-> &;Analyser Ident Code (Meta la;Analysis)) (do meta;Monad<Meta> [tag (meta;normalize tag) [idx group variantT] (meta;resolve-tag tag) - #let [case-size (list;size group)] - inferenceT (&inference;variant-inference-type idx case-size variantT) - [inferredT valueA+] (&inference;apply-function analyse inferenceT (list value)) - expectedT meta;expected-type - _ (&;with-type-env - (tc;check expectedT inferredT)) - temp &scope;next-local] - (wrap (la;sum idx case-size temp (|> valueA+ list;head maybe;assume))))) + expectedT meta;expected-type] + (case expectedT + (#;Var _) + (do @ + [#let [case-size (list;size group)] + inferenceT (&inference;variant-inference-type idx case-size variantT) + [inferredT valueA+] (&inference;apply-function analyse inferenceT (list valueC)) + _ (&;with-type-env + (tc;check expectedT inferredT)) + temp &scope;next-local] + (wrap (la;sum idx case-size temp (|> valueA+ list;head maybe;assume)))) + + _ + (analyse-sum analyse idx valueC)))) ## There cannot be any ambiguity or improper syntax when analysing ## records, so they must be normalized for further analysis. |