Category talk:Wren-check: Difference between revisions
→Source code: Fixed bug in Check.char method.
(→Source code: Doh, bug fixes already!) |
(→Source code: Fixed bug in Check.char method.) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1:
===Source code===
<syntaxhighlight lang="
/*
Line 15:
if (name == "" || name == null) name = "Value"
Fiber.abort("'%(name)' must be %(desc), have '%(value)'.")
}
static isSafeInt_(value) {
return (value is Num) && value.isInteger && value.abs <= Num.maxSafeInteger
}
Line 102 ⟶ 106:
}
static posInt(name, value)
static nonNegInt(name, value)
static safeInt(name, value) { int(name, value, "a 'safe' integer") }▼
static
}
static posSafeInt(name, value) {
if (!(isSafeInt_(value) && value > 0)) {
}
}
static nonNegSafeInt(name, value) {
if (!(isSafeInt_(value) && value >= 0)) {
abort_(name, value, "a non-negative 'safe' integer")
}
}
static nonZeroSafeInt(name, value) {
if (!(
abort_(name, value, "a non-zero 'safe' integer")
}
}
Line 153 ⟶ 172:
int("max", max, min)
char(name, value)
if (value.codePoints[0] < min
abort_(name, value, "a character between '%(min)' and '%(max)'")
}
|