Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
givanse committed Mar 27, 2017
1 parent 6edfda7 commit 402b5aa
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 47 deletions.
57 changes: 10 additions & 47 deletions packages/ember-glimmer/lib/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ const Component = CoreView.extend(
readDOMAttr(name) {
let element = getViewElement(this);
return readDOMAttr(element, name);
}
},

/**
The WAI-ARIA role of the control represented by this view. For example, a
Expand Down Expand Up @@ -717,24 +717,7 @@ const Component = CoreView.extend(
@public
@since 1.13.0
*/

/**
Called when the attributes passed into the component have been updated.
Called both during the initial render of a container and during a rerender.
Can be used in place of an observer; code placed here will be executed
every time any attribute updates.
@event didReceiveAttrs
@public
@since 1.13.0
*/

/**
Called after a component has been rendered, both on initial render and
in subsequent rerenders.
@method didRender
@public
@since 1.13.0
*/
didReceiveAttrs() {},

/**
Called after a component has been rendered, both on initial render and
Expand All @@ -743,14 +726,7 @@ const Component = CoreView.extend(
@public
@since 1.13.0
*/

/**
Called before a component has been rendered, both on initial render and
in subsequent rerenders.
@method willRender
@public
@since 1.13.0
*/
didRender() {},

/**
Called before a component has been rendered, both on initial render and
Expand All @@ -759,6 +735,7 @@ const Component = CoreView.extend(
@public
@since 1.13.0
*/
willRender() {},

/**
Called when the attributes passed into the component have been changed.
Expand All @@ -767,14 +744,7 @@ const Component = CoreView.extend(
@public
@since 1.13.0
*/

/**
Called when the attributes passed into the component have been changed.
Called only during a rerender, not during an initial render.
@event didUpdateAttrs
@public
@since 1.13.0
*/
didUpdateAttrs() {},

/**
Called when the component is about to update and rerender itself.
Expand All @@ -783,14 +753,7 @@ const Component = CoreView.extend(
@public
@since 1.13.0
*/

/**
Called when the component is about to update and rerender itself.
Called only during a rerender, not during an initial render.
@event willUpdate
@public
@since 1.13.0
*/
willUpdate() {},

/**
Called when the component has updated and rerendered itself.
Expand All @@ -799,14 +762,14 @@ const Component = CoreView.extend(
@public
@since 1.13.0
*/
didUpdate() {},

/**
Called when the component has updated and rerendered itself.
Called only during a rerender, not during an initial render.
@event didUpdate
@event didDestroyElement
@public
@since 1.13.0
@since 2.13.0
*/
didDestroyElement() {}

/**
A component may contain a layout. A layout is a regular template but
Expand Down
12 changes: 12 additions & 0 deletions packages/ember-metal/tests/mixin/method_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ QUnit.test('_super from a first-of-two mixins with no superclass function does n
ok(true);
});

QUnit.test('calling _super when there is no method on parent class is deprecated', function() {
expectDeprecation('Calling `_super` when there is no method on the parent class is deprecated.');

let MixinA = Mixin.create({});

let MixinB = Mixin.create(MixinA, {
foo() {
this._super(...arguments);
}
});
});

// ..........................................................
// CONFLICTS
//
Expand Down
9 changes: 9 additions & 0 deletions packages/ember-utils/lib/super.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import {
deprecate,
} from 'ember-debug';
const HAS_SUPER_PATTERN = /\.(_super|call\(this|apply\(this)/;
const fnToString = Function.prototype.toString;

Expand Down Expand Up @@ -41,6 +44,12 @@ function hasSuper(func) {
*/
export function wrap(func, superFunc) {
if (!hasSuper(func)) {
//console.info('super::wrap deprecate here');
deprecate(
'Calling `_super` when there is no method on the parent class is deprecated.',
false,
{ id: 'ember-metal.missing-super', until: '3.0.0' }
);
return func;
}
// ensure an unwrapped super that calls _super is wrapped with a terminal _super
Expand Down

0 comments on commit 402b5aa

Please sign in to comment.