ladybird/Userland/Libraries/LibJS/Tests/operators
davidot 830ea0414c LibJS: Make scoping follow the spec
Before this we used an ad-hoc combination of references and 'variables'
stored in a hashmap. This worked in most cases but is not spec like.
Additionally hoisting, dynamically naming functions and scope analysis
was not done properly.

This patch fixes all of that by:
  - Implement BindingInitialization for destructuring assignment.
  - Implementing a new ScopePusher which tracks the lexical and var
    scoped declarations. This hoists functions to the top level if no
    lexical declaration name overlaps. Furthermore we do checking of
    redeclarations in the ScopePusher now requiring less checks all over
    the place.
  - Add methods for parsing the directives and statement lists instead
    of having that code duplicated in multiple places. This allows
    declarations to pushed to the appropriate scope more easily.
  - Remove the non spec way of storing 'variables' in
    DeclarativeEnvironment and make Reference follow the spec instead of
    checking both the bindings and 'variables'.
  - Remove all scoping related things from the Interpreter. And instead
    use environments as specified by the spec. This also includes fixing
    that NativeFunctions did not produce a valid FunctionEnvironment
    which could cause issues with callbacks and eval. All
    FunctionObjects now have a valid NewFunctionEnvironment
    implementation.
  - Remove execute_statements from Interpreter and instead use
    ASTNode::execute everywhere this simplifies AST.cpp as you no longer
    need to worry about which method to call.
  - Make ScopeNodes setup their own environment. This uses four
    different methods specified by the spec
    {Block, Function, Eval, Global}DeclarationInstantiation with the
    annexB extensions.
  - Implement and use NamedEvaluation where specified.

Additionally there are fixes to things exposed by these changes to eval,
{for, for-in, for-of} loops and assignment.

Finally it also fixes some tests in test-js which where passing before
but not now that we have correct behavior :^).
2021-09-30 08:16:32 +01:00
..
assignment-operators.js LibJS: Fix variable scoping issues in two tests 2021-07-06 00:15:37 +01:00
binary-bitwise-and.js LibJS: Improve correctness of rounding and bitwise operations 2021-02-05 09:38:45 +01:00
binary-bitwise-left-shift.js LibJS: Improve correctness of rounding and bitwise operations 2021-02-05 09:38:45 +01:00
binary-bitwise-or.js LibJS: Improve correctness of rounding and bitwise operations 2021-02-05 09:38:45 +01:00
binary-bitwise-right-shift.js LibJS: Improve correctness of rounding and bitwise operations 2021-02-05 09:38:45 +01:00
binary-bitwise-unsigned-right-shift.js LibJS: Improve correctness of rounding and bitwise operations 2021-02-05 09:38:45 +01:00
binary-bitwise-xor.js LibJS: Improve correctness of rounding and bitwise operations 2021-02-05 09:38:45 +01:00
binary-relational.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
bitwise-not.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
comma-operator.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
delete-basic.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
delete-global-variable.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
delete-globalThis-property-crash.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
delete-local-variable.js LibJS: Make scoping follow the spec 2021-09-30 08:16:32 +01:00
in-operator-basic.js LibJS: Accept symbol property in the in operator 2021-04-17 00:59:36 +02:00
instanceof-basic.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
logical-and.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
logical-expressions-short-circuit.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
logical-nullish-coalescing.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
logical-or.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
modulo-basic.js LibJS: Handle +Infinity, -Infinity, +0 and -0 in modulo operator 2021-09-02 18:26:42 +01:00
ternary-basic.js LibJS/Tests: Use eval() for toEvalTo(), not Function() 2021-06-18 20:35:23 +01:00
typeof-basic.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
void-basic.js Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00