Make the various from_str functions return options

So that they can be used with user input without causing task
failures.

Closes #1335
This commit is contained in:
Marijn Haverbeke
2012-02-22 13:18:15 +01:00
parent 72373438d2
commit ffd50b9cdf
26 changed files with 196 additions and 308 deletions

View File

@@ -301,7 +301,7 @@ fn lit_to_const(lit: @lit) -> const_val {
lit_str(s) { const_str(s) }
lit_int(n, _) { const_int(n) }
lit_uint(n, _) { const_uint(n) }
lit_float(n, _) { const_float(float::from_str(n)) }
lit_float(n, _) { const_float(option::get(float::from_str(n))) }
lit_nil { const_int(0i64) }
lit_bool(b) { const_int(b as i64) }
}