Deprecate calling `this._super` when there is no method on parent class.
See original GitHub issueWe 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:
- Created 7 years ago
- Comments:17 (17 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is a thing you’re supposed to do.
This is still an issue, and we should issue an error…