* Added the initial implementation for Array.prototype.map
* Removed unneccessary .to_string()
* Fixed clippy errors
* Fixed old array being modified by `map`
* rustfmt
* Refactored `map` to use iter().map()
* Refactored array.prototype.map
* Feature(Number): Tests for the Test Driven Development!
refs #34
* Feature: Skeleton code for Number
refs #34
* Feature: Most of Number() is complete
Includes:
- make_number()
- call_number()
- Number().toExponential()
- Number().toFixed()
- Number().toLocaleString() (ish)
- Number().toString()
- Number().valueOf()
- create_constructor()
- init()
Missing:
- Number().toPrecision()
refs #34
* Feature(Number): test compatability with const -> var
I don't have all the context on _why_ but all of the tests for `Number` started failing.
Upon investigation it was becuase `const` stopped acting the way I expected.
Switching my test cases from using `const` to using `var` variable declarations
made everything work again. I don't know enough about JS to know if this is a
bug or expected behavior. Based on changes to other tests, it is know
behavior.
Refs #34
* Changelog: Number() object.
Includes some clippy fixes.
Fixes#34
* Array.prototype.fill method implementation
* Added types
* Fmt changes
* Fill tests fixed - let to var change
* Added support for string arguments
* Formatting
* Replaced set_field_slice with set_field
* Parse args to int change
* More tests and bug fixes
* Removed print
* Removed unnecessary else block
* Calling function to get ValueData::Undefined in GC
* Fmt update
* Function length prop, variable name change, and one more test
* Removed duplicated test case
* Implement block scoped variable declarations
`const` and `let` are now scoped to the block, while `var` is scoped to
the surronding function (or global).
Another bigger change is that all tests have been changed to use `var`
instead of `let` or `const`. This is because every time `forward` is
called with some new Javascript to evaluate, we parse it as a block,
hence variables can only persist across calls to `forward` if they are
defined using `var`. I assume it is intentional to parse each call as a
separate block, because a block is the only `ExprDef` which can contain
multiple statements.
Closes#39
* Prefer environment parent over environment_stack
Instead of iterating over the `environment_stack` we rather use
`get_outer_environment` as it will be a better fit when asyncronous
functions are implemented.
* Ensure variable from outer scope is assigned
Variables that are defined outside a block should be changeable within
the scope. Just because variable is undefined does not mean it is not
initialized.
* Fixed clippy warnings option_unwrap_used and result_unwrap_used.
* Fixed float_cmp clippy error and the option_unwrap_used it was hiding.
* Fixed shadowing issues.
* Disabled some clippy lints in tests.
* Fixed clippy string_add issues.
* Added allow else_if_without_else since an else-block would not make sense.
* Fixed integer arithmetic issues.
* Fixed all clippy get_unwrap issues.
* Fixed usage of unimplemented and an occurrence of variable name shadowing.
* Fixed indexing may panic issues.
* Fixed a slicing may panic issue.
* Changed some unnecessary uses of match that I introduced for expect.