Skip to content

Commit 11fe1bc

Browse files
committed
Modified switch statement syntax.
To be more concise and more like recent languages, the case keyword is dropped, and for one-statement case blocks the => keyword can be used to handle a case on one line.
1 parent 831b485 commit 11fe1bc

26 files changed

+292
-786
lines changed

bootstrap/database/bigint.rn

+6-14
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,16 @@ kMaxBigintWidth = 0x1000000u32
3434
// speculative execution.
3535
func isSecret(value) -> bool {
3636
typeswitch value {
37-
case typeof(reveal(value)) {
38-
return false
39-
}
40-
case typeof(secret(value)) {
41-
return true
42-
}
37+
typeof(reveal(value)) => return false
38+
typeof(secret(value)) => return true
4339
}
4440
}
4541

4642
// Determine if the value is signed or not.
4743
func isSigned(value: Int | Uint) {
4844
typeswitch value {
49-
case Int {
50-
return true
51-
}
52-
case Uint {
53-
return false
54-
}
45+
Int => return true
46+
Uint => return false
5547
}
5648
}
5749

@@ -64,7 +56,7 @@ class Bigint(self, value: Int | Uint | runtime.BigintArray, width: u32 = 0u32) {
6456
self.isSigned = false
6557
self.isSecret = false
6658
typeswitch value {
67-
case Int | Uint {
59+
Int | Uint {
6860
if widthof(value) > kMaxBigintWidth {
6961
throw "Integer width too large. Pass in BigintArray instead."
7062
}
@@ -84,7 +76,7 @@ class Bigint(self, value: Int | Uint | runtime.BigintArray, width: u32 = 0u32) {
8476
self.bigint = runtime.integerToBigint(!<u64>value, self.width,
8577
self.isSigned, self.isSecret)
8678
}
87-
case runtime.BigintArray {
79+
runtime.BigintArray {
8880
if width != 0 {
8981
throw "Can't change bigint width in Bigint constructor. Use cast instead."
9082
}

0 commit comments

Comments
 (0)