Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Should we throw if static block directly contains Argument? #14

@JLHwung

Description

@JLHwung
class C {
  static {
    this.foo = arguments;
  }
}

In Class Fields Proposal, it is a syntax error if the initializer contains arguments.

class C {
  static foo = arguments; // throws
}

The spec currently does not throw for arguments. However, to align with fields initializer, I think it makes sense to disallow arguments directly inside static block.

Note that it is still valid if arguments is inside a function declared in the static block:

class C {
  static {
    this.foo = function() { arguments };
  }
}

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