Skip to content

super relies on name of base class #259

Open
@kumavis

Description

class Base { xyz () {} }
const Enhanced = enhance(Base)
const inst = new Enhanced()

inst.xyz()

function enhance (Klass) {
  Klass = class extends Klass {
    xyz () {
      super.xyz()
    }
  }
  return Klass
}
$ cat abc.js | node

$ npx buble abc.js | node
[stdin]:20
    Klass.prototype.xyz = function xyz () {
                                       ^

RangeError: Maximum call stack size exceeded
    at Klass.xyz ([stdin]:20:40)
    at Klass.xyz ([stdin]:21:27)
    at Klass.xyz ([stdin]:21:27)
    at Klass.xyz ([stdin]:21:27)
    at Klass.xyz ([stdin]:21:27)
    at Klass.xyz ([stdin]:21:27)
    at Klass.xyz ([stdin]:21:27)
    at Klass.xyz ([stdin]:21:27)
    at Klass.xyz ([stdin]:21:27)
    at Klass.xyz ([stdin]:21:27)

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions