Skip to content

annexB block-decl-func-skip-arguments contradicts staging/sm block-scoped-functions-annex-b-arguments #5113

Description

@lahma

Two tests in this suite assert opposite results for the identical shape, and no engine can pass both.

// annexB/language/function-code/block-decl-func-skip-arguments.js  (2017)
(function() {
  { function arguments() {} }
  assert.sameValue(arguments.toString(), "[object Arguments]");   // expects the arguments object
}());

// staging/sm/lexical-environment/block-scoped-functions-annex-b-arguments.js
(function() {
  { function arguments() {} }
  assert.sameValue(typeof arguments, "function");                 // expects the function
}());

The annexB file is the stale one: its info block quotes "22.f. Append "arguments" to parameterNames", a step the current FunctionDeclarationInstantiation no longer has. Today paramBindings is "the list-concatenation of paramNames and « "arguments" »" (step 22.h) while the web-compat eligibility test consults paramNames, which does not carry the implicit arguments. A block-level function arguments(){} is therefore eligible; the funcName is not \"arguments\" guard skips only the creation of a new var binding, and the funcEnv.SetMutableBinding(funcName, funcObj, false) performed when the declaration is evaluated still runs.

V8 (node 24.19.0) and SpiderMonkey both answer "function", i.e. both fail the annexB file and pass the staging one.

#5112 updates the annexB file to the current algorithm and adds a case for a formal parameter really named arguments (which is in paramNames, so its declaration is not eligible) — the distinction currently has no coverage.

Found while enabling staging/ in Jint (sebastienros/jint#3021).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions