Skip to content

Accepts invalid Class syntax #10

@ghost

Description

This one:

  • It is a Syntax Error if PropName of MethodDefinition is not "constructor" and HasDirectSuper of MethodDefinition is true.
class A {
    foo() {
        super()  // Invalid 'super()'.
    }
}

http://www.ecma-international.org/ecma-262/6.0/#sec-class-definitions-static-semantics-early-errors

And also this one

class A {
    static foo() {
        super()  // Invalid 'super()'.
    }

    static prototype() {  // Invalid method.
    }
}

For this bugs

  • It is a Syntax Error if FormalParameters Contains SuperProperty is true.
  • It is a Syntax Error if FunctionBody Contains SuperProperty is true.
  • It is a Syntax Error if FormalParameters Contains SuperCall is true.
  • It is a Syntax Error if FunctionBody Contains SuperCall is true.
//-
function foo() {
    super()  // Invalid `super`.
    super.foo()  // Invalid `super`.
}
var foo = function() {
    super()  // Invalid `super`.
    super.foo()  // Invalid `super`.
}

function wrap() {
    function foo(a = super(), b = super.foo()) {  // Invalid 'super'.
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions