* added builtin globalThis
* forgot to initialize globalThis in the builtin mod.rs file
* changed to to match naming conventions and fixed issue with suggested edits to globalThis' initial value
* updated the test for the property as suggested
* remove From<JSONValue> for Value. Going from JSONValue to Value will soon need the interpreter
* pass interpreter to from_json
* move from_json to Value impl
* move to_json to Value impl alongside from_json
* add prototype to objects created from json
* consume the object and don't clone
* if it fits into i32, use integer; otherwise, use a rational
* WIP: throwing type error
* address most of the error cases
* cargo fmt
* address the rest of the error cases
* return null when JSONNumber::from_f64() returns None
* cargo fmt
* Update boa/src/builtins/value/mod.rs
* use JSONValue and use Result
* Update boa/src/builtins/json/mod.rs
Use and_then to avoid flatten
Co-authored-by: HalidOdat <halidodat@gmail.com>
Co-authored-by: Iban Eguia <razican@protonmail.ch>
Co-authored-by: HalidOdat <halidodat@gmail.com>
* Added documentation to make_builtin_fn
* Simple impl of parseInt()
* Impl rest of parse_int
* Fixed handling of strings starting 0x
* Made NaN return as per js spec
* Rework to improve clarity
* parseFloat impl, added tests
* Addressed comments to PR
* Removed f64 import
* Fixed handling of too many/few arguments to parseInt/Float
Co-authored-by: HalidOdat <halidodat@gmail.com>
- Maded arrow functions non-constructable
- Simplified Function object and removed FunctionKind
- Rnamed create_ordinary -> ordinary, create_builtin -> builtin
- Added name and length properties in global objects
* Fix for 0 length field when constructing a new String.
* String.length uses character count not byte count. Also, corresponding test
* Made tests more succinct per suggestion.
* implement this
* remove construct/call from Object instead set func
* get_this_binding() was wrong, fixed
* BindingStatus is now properly set
* `this` now works on dynamic functions
* Migrates all builtins to use a single constructor/call fucntion to match the spec
* Ensure new object has an existing prototype
* create_function utility
* needing to clone before passing through
* Fix catch parsing - move the cursor to next token
* Refactor catch and finally parsing into separate modules
* Refactor catchparam parsing into separate module and add more tests
* Refactoring - use ? instead of match
* Implement optional parameter `radix` for `Number.prototype.toString( [radix] )
Implement the radix paramet for the `toString`. This implementation is
converted from the V8's c++ implementation.
* Use a reversed iterator instead of cursors in the integer part.
Initial version for getting rid of direct slice accesses. Currently
converted integer part to iterators. Fraction part is a lot harder since
there are two passes to the fraction part (for carry over) and it is
hard to express that using iterators.
* Format tests