summaryrefslogtreecommitdiff
path: root/libstd/chartype.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-02-10 23:26:32 -0500
committerOri Bernstein <ori@eigenstate.org>2014-02-10 23:26:32 -0500
commit68b18a7fba8313ad5b1d8b4c6be61e3b8b126304 (patch)
treea30c41e3637cd99fd50eefbff36cc617718fdb30 /libstd/chartype.myr
parentc158da43321893956e4be405ed04af37f86259fa (diff)
downloadmc-68b18a7fba8313ad5b1d8b4c6be61e3b8b126304.tar.gz
Do some sanitization on traits.
- Remove tctest: all tests now take a boolean. - Rename traits to more sensible names: tcnum => numeric tcint => integral tcfloat => floating tcidx => indexable tcslice => sliceable - Remove duplicate trait setting. We were setting traits twice in some places, adding ones that didn't belong, which was making pointers look indexable.
Diffstat (limited to 'libstd/chartype.myr')
-rw-r--r--libstd/chartype.myr12
1 files changed, 6 insertions, 6 deletions
diff --git a/libstd/chartype.myr b/libstd/chartype.myr
index 13cb59b..c62fcf1 100644
--- a/libstd/chartype.myr
+++ b/libstd/chartype.myr
@@ -22,7 +22,7 @@ pkg std =
const toupper : (c : char -> char)
const totitle : (c : char -> char)
- generic charval : (c : char, base : int -> @a::(tcint,tcnum,tctest))
+ generic charval : (c : char, base : int -> @a::(integral,numeric))
;;
/*
@@ -1209,18 +1209,18 @@ const totitle = {c
-> c
}
-generic charval = {c, base -> @a::(tcnum,tcint,tctest)
+generic charval = {c, base -> @a::(numeric,integral)
var v = -1
if c >= '0' && c <= '9'
- v = (c - '0') castto(@a::(tcint,tcnum,tctest))
+ v = (c - '0') castto(@a::(integral,numeric))
elif c >= 'a' && c <= 'z'
- v = (c - 'a' + 10) castto(@a::(tcint,tcnum,tctest))
+ v = (c - 'a' + 10) castto(@a::(integral,numeric))
elif c >= 'A' && c <= 'Z'
- v = (c - 'A' + 10) castto(@a::(tcint,tcnum,tctest))
+ v = (c - 'A' + 10) castto(@a::(integral,numeric))
;;
- if v < 0 || v > (base castto(@a::(tcint,tcnum,tctest)))
+ if v < 0 || v > (base castto(@a::(integral,numeric)))
-> -1
;;
-> v