Change all ternary ops to if/then/else
All the files below had at least one instance of the ternary operator present in the source. All have been changed to the equivalent if/then/else expression.
This commit is contained in:
parent
e1f15a71e3
commit
e1251f7b00
18 changed files with 183 additions and 68 deletions
|
@ -305,10 +305,42 @@ fn lit_to_const(lit: @lit) -> const_val {
|
|||
|
||||
fn compare_const_vals(a: const_val, b: const_val) -> int {
|
||||
alt (a, b) {
|
||||
(const_int(a), const_int(b)) { a == b ? 0 : a < b ? -1 : 1 }
|
||||
(const_uint(a), const_uint(b)) { a == b ? 0 : a < b ? -1 : 1 }
|
||||
(const_float(a), const_float(b)) { a == b ? 0 : a < b ? -1 : 1 }
|
||||
(const_str(a), const_str(b)) { a == b ? 0 : a < b ? -1 : 1 }
|
||||
(const_int(a), const_int(b)) {
|
||||
if a == b {
|
||||
0
|
||||
} else if a < b {
|
||||
-1
|
||||
} else {
|
||||
1
|
||||
}
|
||||
}
|
||||
(const_uint(a), const_uint(b)) {
|
||||
if a == b {
|
||||
0
|
||||
} else if a < b {
|
||||
-1
|
||||
} else {
|
||||
1
|
||||
}
|
||||
}
|
||||
(const_float(a), const_float(b)) {
|
||||
if a == b {
|
||||
0
|
||||
} else if a < b {
|
||||
-1
|
||||
} else {
|
||||
1
|
||||
}
|
||||
}
|
||||
(const_str(a), const_str(b)) {
|
||||
if a == b {
|
||||
0
|
||||
} else if a < b {
|
||||
-1
|
||||
} else {
|
||||
1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue