diff options
author | Eduardo Julian | 2017-11-14 01:14:26 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-11-14 01:14:26 -0400 |
commit | 290c2389bc762dfaf625d72a76a675ce15119985 (patch) | |
tree | c0eba13fc1de598b629752d2d7ab9760568fd059 /new-luxc/source/luxc/lang/analysis/case | |
parent | 530a14bfe7714f94babdb34c237b88321408a685 (diff) |
- Yet more refactoring.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/analysis/case.lux | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/new-luxc/source/luxc/lang/analysis/case.lux b/new-luxc/source/luxc/lang/analysis/case.lux index 5bf2e8ed1..ee4d4fcfa 100644 --- a/new-luxc/source/luxc/lang/analysis/case.lux +++ b/new-luxc/source/luxc/lang/analysis/case.lux @@ -47,13 +47,13 @@ (case caseT (#;Var id) (do meta;Monad<Meta> - [? (&;with-type-env - (tc;concrete? id))] - (if ? - (do @ - [caseT' (&;with-type-env - (tc;read id))] - (simplify-case-type caseT')) + [?caseT' (&;with-type-env + (tc;read id))] + (case ?caseT' + (#;Some caseT') + (simplify-case-type caseT') + + _ (&;throw Cannot-Simplify-Type-For-Pattern-Matching (%type caseT)))) (#;Named name unnamedT) @@ -71,9 +71,12 @@ (do meta;Monad<Meta> [funcT' (&;with-type-env (do tc;Monad<Check> - [? (tc;concrete? funcT-id)] - (if ? - (tc;read funcT-id) + [?funct' (tc;read funcT-id)] + (case ?funct' + (#;Some funct') + (wrap funct') + + _ (tc;throw Cannot-Simplify-Type-For-Pattern-Matching (%type caseT)))))] (simplify-case-type (#;Apply inputT funcT'))) |