question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deprecate calling `this._super` when there is no method on parent class.

See original GitHub issue

We should not support calling _super when the parent class does not have a method defined (aka when there is no _super). This likely means adding a deprecation for now, and converting that to an error in 3.0.0.

Examples:

let A = Ember.Object.extend({
  foo() { return 'A - Foo'; },

  qux: Ember.computed(function() {
    return 'A - qux';
  })
});

let B = A.extend({
  bar() {
    // should trigger deprecation
    return this._super(...arguments) + '| B - Bar';
  },

  foo() {
    // should not trigger deprecation
    return this._super(...arguments) + ' | B - Foo | ' + this.bar();
  },

  qux: Ember.computed(function() {
    // should not trigger deprecation
    return this._super(...arguments) + ' | B - qux';
  }),

  baz: Ember.computed(function() {
    // should trigger deprecation
    return this._super(...arguments) + ' | B - baz';
  })
});

See original context

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

2reactions
lockscommented, Jan 4, 2017

I have to regularly audit the code for all addons to be sure I’m not breaking anything.

This is a thing you’re supposed to do.

1reaction
rwjbluecommented, Sep 17, 2020

This is still an issue, and we should issue an error…

Read more comments on GitHub >

github_iconTop Results From Across the Web

In JavaScript, why super keyword is not calling always parent ...
super does always call the "parent" class methods. But your log "Message 2 from Child class" is caused by this.msg2() in the parent...
Read more >
super - JavaScript - MDN Web Docs - Mozilla
The super keyword is used to access properties on an object literal or class's [[Prototype]], or invoke a superclass's constructor.
Read more >
11.9. Using Super to call an Overridden Method
Sometimes you want the child class to do more than what a parent method is doing. You want to still execute the parent...
Read more >
That's why you can't remove parent methods in Python - Medium
It just saves parent class(es) into __base__ and __bases__ variables. Inheritance magic happens at the call time. When inherited method is ...
Read more >
JavaScript Class super keyword - W3Schools
The super keyword is used to call the constructor of its parent class to access the parent's properties and methods. Tip: To understand...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found