Skip to content

Commit

Permalink
Merge pull request #11815 from emberjs/cleanup-meta-chainwatchers
Browse files Browse the repository at this point in the history
[CLEANUP beta] Remove {chainWatchers: null} from Meta.prototype
  • Loading branch information
stefanpenner committed Jul 20, 2015
2 parents ed526d0 + af82cd4 commit e12bb2f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
3 changes: 2 additions & 1 deletion packages/ember-metal/lib/chains.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ function addChainWatcher(obj, keyName, node) {
var m = metaFor(obj);
var nodes = m.chainWatchers;

if (!m.hasOwnProperty('chainWatchers')) { // FIXME?!
// TODO remove hasOwnProperty check
if (nodes === undefined || !m.hasOwnProperty('chainWatchers')) {
nodes = m.chainWatchers = new Chains();
}

Expand Down
16 changes: 10 additions & 6 deletions packages/ember-metal/lib/property_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,14 @@ function iterDeps(method, obj, deps, depKey, seen, meta) {
}

function chainsWillChange(obj, keyName, m) {
if (!(m.hasOwnProperty('chainWatchers') &&
m.chainWatchers[keyName])) {
if (m.chainWatchers === undefined ||
!m.hasOwnProperty('chainWatchers')) {
return;
}

var nodes = m.chainWatchers[keyName];
if (nodes === undefined) {
return;
}
var events = [];
var i, l;

Expand All @@ -210,12 +212,14 @@ function chainsWillChange(obj, keyName, m) {
}

function chainsDidChange(obj, keyName, m, suppressEvents) {
if (!(m && m.hasOwnProperty('chainWatchers') &&
m.chainWatchers[keyName])) {
if (m.chainWatchers === undefined ||
!m.hasOwnProperty('chainWatchers')) {
return;
}

var nodes = m.chainWatchers[keyName];
if (nodes === undefined) {
return;
}
var events = suppressEvents ? null : [];
var i, l;

Expand Down
7 changes: 1 addition & 6 deletions packages/ember-metal/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,21 +286,17 @@ export function guidFor(obj) {
function Meta(obj) {
this.watching = {};
this.cache = undefined;
this.cacheMeta = undefined;
this.source = obj;
this.deps = undefined;
this.listeners = undefined;
this.mixins = undefined;
this.bindings = undefined;
this.chains = undefined;
this.chainWatchers = undefined;
this.values = undefined;
this.proto = undefined;
}

Meta.prototype = {
chainWatchers: null // FIXME
};

// Placeholder for non-writable metas.
var EMPTY_META = new Meta(null);

Expand Down Expand Up @@ -356,7 +352,6 @@ function meta(obj, writable) {
ret = Object.create(ret);
ret.watching = Object.create(ret.watching);
ret.cache = undefined;
ret.cacheMeta = undefined;
ret.source = obj;

if (isEnabled('mandatory-setter')) {
Expand Down

0 comments on commit e12bb2f

Please sign in to comment.