Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLEANUP beta] Remove {chainWatchers: null} from Meta.prototype #11815

Merged
merged 1 commit into from
Jul 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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