commit 3ed4fa80d02aa05a0e571cf8ed26652dbb99909c
parent da8980ffc9d6ae0b0462fadc6442d2b7228e8a68
Author: Byron Torres <b@torresjrjr.com>
Date: Wed, 2 Feb 2022 00:26:32 +0000
update "case let" syntax
Diffstat:
M | dc.ha | | | 14 | +++++++------- |
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dc.ha b/dc.ha
@@ -34,9 +34,9 @@ export fn main() void = {
};
const file = match (os::open(filename)) {
- case f: io::file =>
+ case let f: io::file =>
yield f;
- case err: fs::error =>
+ case let err: fs::error =>
fmt::fatal("dc: {} '{}'", fs::strerror(err), filename);
};
defer io::close(file);
@@ -57,7 +57,7 @@ fn dc(in: io::handle) void = {
fmt::fatal("dc: IO error");
case io::EOF =>
break;
- case r: rune =>
+ case let r: rune =>
yield r;
};
@@ -87,12 +87,12 @@ fn dc(in: io::handle) void = {
case io::EOF =>
fmt::errorln("dc: no shell command given")?;
continue;
- case input: []u8 =>
+ case let input: []u8 =>
yield match (strings::try_fromutf8(input)) {
case utf8::invalid =>
fmt::errorln("dc: invalid shell command input")?;
continue;
- case c: str =>
+ case let c: str =>
yield c;
};
};
@@ -239,7 +239,7 @@ fn scan_number(in: io::handle) f64 = {
fmt::fatal("dc: IO error");
case io::EOF =>
yield ' ';
- case r: rune =>
+ case let r: rune =>
yield r;
};
if (ascii::isdigit(r) || (!seen_decimal && r == '.')) {
@@ -252,7 +252,7 @@ fn scan_number(in: io::handle) f64 = {
match (strconv::stof64(strings::fromutf8(num))) {
case (strconv::invalid | strconv::overflow) =>
abort("dc: invalid numerical input");
- case n: f64 =>
+ case let n: f64 =>
return n;
};
};