Fix int of string #85

Merged
merged 3 commits into from Sep 26, 2012
View
9 lib/plugins/opabsl/nodejsbsl/bslNumber.nodejs
@@ -40,7 +40,7 @@ function qNaNarray(le) { return (le) ? qNaNarray_le : qNaNarray_be; }
/** @module Int */
// Note: for bitwise ops you only get 32 bits - and they're sign extended
-/** @register { int} max_int max_int */
+/** @register {int} max_int max_int */
var max_int = Math.pow(2, 53);
/**
@@ -73,7 +73,12 @@ function int_of_string(str) {
*/
function int_of_string_opt(str) {
try {
- js_some(BslNumber_Int_of_string(str));
+ var res = int_of_string(str);
+ if (isNaN(res)) {
+ return js_none;
+ } else {
+ return js_some(res);
+ }
} catch(e) {
return js_none;
}