Skip to content

calling super in methods defined on namespaced classes #1392

@michaelficarra

Description

@michaelficarra

C::m = -> super compiles correctly into

C.prototype.m = function() {
  return C.__super__.m.apply(this, arguments);
};

namespaced.C::m = -> super" compiles incorrectly into

namespaced.C.prototype.m = function() {
  return m.__super__.constructor.apply(this, arguments);
};

Proper compilation would have been

var _ref;
_ref = namespaced.C;
_ref.prototype.m = function() {
  return _ref.__super__.constructor.apply(this, arguments);
};

The error originates from the METHOD_DEF regex being used by Assign::compileNode matching only identifiers. Call::superReference is then compiling incorrectly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions