aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/analyser/common.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-05-30 21:35:37 -0400
committerEduardo Julian2017-05-30 21:35:37 -0400
commitb73f1c909d19d5492d6d9a7dc707a3b817c73619 (patch)
tree369d957687852bb5ca0024e9175072f5c92bf6d1 /new-luxc/source/luxc/analyser/common.lux
parent56b0ca377a30e30bf832d6dfdb789676f67e7ade (diff)
- Documented the analysis phase.
- Some refactoring. - Removed singleton variants.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/analyser/common.lux7
1 files changed, 7 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/analyser/common.lux b/new-luxc/source/luxc/analyser/common.lux
index 7a9e5dbf8..c1246d81c 100644
--- a/new-luxc/source/luxc/analyser/common.lux
+++ b/new-luxc/source/luxc/analyser/common.lux
@@ -30,3 +30,10 @@
output (body [id var])
_ (&;within-type-env (TC;delete-var id))]
(wrap output)))
+
+(def: #export (variant-out-of-bounds-error type size tag)
+ (All [a] (-> Type Nat Nat (Lux a)))
+ (&;fail (format "Trying to create variant with tag beyond type's limitations." "\n"
+ " Tag: " (%i (nat-to-int tag)) "\n"
+ "Size: " (%i (nat-to-int size)) "\n"
+ "Type: " (%type type))))