Commit Graph

2 Commits

Author SHA1 Message Date
Bob Nystrom
f809e4a1f1 refactor: extract shared makeNumber helper and fix OBJ_VAL wrapping in num_fromString
Extract the duplicated number parsing logic from readHexNumber and readNumber into a single makeNumber function that accepts an isHex flag. Also fix a missing OBJ_VAL wrapper in the num_fromString primitive's ERANGE error path and normalize trailing newlines in three test files.
2015-03-03 15:17:56 +00:00
Gavin Schulz
3dcffddbd5 feat: add ERANGE error handling for oversized number literals in lexer and Num.fromString
Replace TODO stubs with actual errno checks in readHexNumber, readNumber, and num_fromString to emit a "Number literal is too large." error when strtol/strtod overflow. Add three test files (literal_too_large.wren, hex_too_large.wren, from_string_too_large.wren) verifying compile-time and runtime error behavior for out-of-range numeric inputs.
2015-03-03 08:06:34 +00:00