Skip to content

language/runtime: align global object, declaration instantiation, and var hoisting semantics #3575

@andrewtdiz

Description

@andrewtdiz

Summary

Global this, duplicate function declarations, global property updates, and var hoisting initialize and mutate values according to ECMAScript.

Affected Test262 rows

Perry actual behavior from report

  • 1 x compile-fail: Error compiling module 'case.js' (case.js) with --backend llvm: clang -c failed (status=exit status: 1).
  • 1 x runtime-fail: TypeError: Cannot read properties of undefined (reading 'nan')
  • 1 x runtime-fail: Uncaught exception: #0 x !== undefined, but actual is 0
  • 1 x runtime-fail: Uncaught exception: Support custom menu bar items #1: The this value associated with an executioncontext is immutable. Actual: this was deleted

Node / ECMAScript expected behavior

Global this, duplicate function declarations, global property updates, and var hoisting initialize and mutate values according to ECMAScript.

Likely subsystem

global environment record / codegen globals / unary/update expression lowering

Acceptance criteria

  • delete this and global this.nan update rows match Node/Test262.
  • Duplicate global function declarations leave the last declaration callable.
  • var declarations are hoisted to undefined, not initialized as numeric zero.

Validation

Run the Test262 differential against the affected area and confirm these rows leave the gap report:

scripts/test262_subset.py --root vendor/test262 --dir language/global-code language/punctuators language/types/boolean --sample-cap 99999 --report /tmp/SCOPE_GLOBALS.json

This is Perry language/runtime semantics triage, not a Node core API compatibility issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions