Skip to content

Commit

Permalink
enable templates read a property from a function
Browse files Browse the repository at this point in the history
  • Loading branch information
bekzod committed Aug 18, 2017
1 parent 8f68cf0 commit 326dc3d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
16 changes: 8 additions & 8 deletions packages/ember-glimmer/tests/integration/content-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,17 +495,17 @@ class DynamicContentTest extends RenderingTest {

this.assertStableRerender();

// this.runTask(() => set(func, 'aProp', 'still a property on a function'));
// this.assertContent('still a property on a function');
// this.assertInvariants();
this.runTask(() => set(func, 'aProp', 'still a property on a function'));
this.assertContent('still a property on a function');
this.assertInvariants();

// func = () => {};
// func.aProp = 'a prop on a new function';
func = () => {};
func.aProp = 'a prop on a new function';

// this.runTask(() => set(this.context, 'func', func));
this.runTask(() => set(this.context, 'func', func));

// this.assertContent('a prop on a new function');
// this.assertInvariants();
this.assertContent('a prop on a new function');
this.assertInvariants();
}
}

Expand Down
1 change: 0 additions & 1 deletion packages/ember-metal/lib/property_set.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export function set(obj, keyName, value, tolerant) {

propertyDidChange(obj, keyName, meta);
}

return value;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-metal/lib/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function makeTag() {
}

export function tagForProperty(object, propertyKey, _meta) {
if (typeof object !== 'object' || object === null) { return CONSTANT_TAG; }
if ((typeof object !== 'object' && typeof object !== 'function') || object === null) { return CONSTANT_TAG; }

let meta = _meta || metaFor(object);
if (meta.isProxy()) {
Expand Down
7 changes: 3 additions & 4 deletions packages/ember-metal/lib/watch_key.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
let handleMandatorySetter;

export function watchKey(obj, keyName, meta) {
if (typeof obj !== 'object' || obj === null) { return; }
if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) { return; }

let m = meta || metaFor(obj);
let count = m.peekWatching(keyName) || 0;
Expand Down Expand Up @@ -81,9 +81,8 @@ if (MANDATORY_SETTER) {
}

export function unwatchKey(obj, keyName, _meta) {
if (typeof obj !== 'object' || obj === null) {
return;
}
if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) { return; }

let meta = _meta || peekMeta(obj);

// do nothing of this object has already been destroyed
Expand Down

0 comments on commit 326dc3d

Please sign in to comment.