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 Jul 22, 2017
1 parent 37f6af1 commit e915f22
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 34 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
2 changes: 1 addition & 1 deletion packages/ember-metal/lib/watching.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function watch(obj, _keyPath, m) {
}

export function isWatching(obj, key) {
if (typeof obj !== 'object' || obj === null) {
if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) {
return false;
}
let meta = peekMeta(obj);
Expand Down
21 changes: 2 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,6 @@ ast-types@0.8.12:
version "0.8.12"
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.8.12.tgz#a0d90e4351bb887716c83fd637ebf818af4adfcc"

ast-types@0.8.15:
version "0.8.15"
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.8.15.tgz#8eef0827f04dff0ec8857ba925abe3fea6194e52"

ast-types@0.9.11:
version "0.9.11"
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.11.tgz#371177bb59232ff5ceaa1d09ee5cad705b1a5aa9"
Expand Down Expand Up @@ -3311,11 +3307,7 @@ homedir-polyfill@^1.0.0:
dependencies:
parse-passwd "^1.0.0"

hosted-git-info@^2.1.4, hosted-git-info@^2.1.5:
version "2.5.0"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c"

hosted-git-info@~2.1.5:
hosted-git-info@^2.1.4, hosted-git-info@^2.1.5, hosted-git-info@~2.1.5:
version "2.1.5"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.1.5.tgz#0ba81d90da2e25ab34a332e6ec77936e1598118b"

Expand Down Expand Up @@ -5048,7 +5040,7 @@ realize-package-specifier@~3.0.3:
dezalgo "^1.0.1"
npm-package-arg "^4.1.1"

recast@0.10.33:
recast@0.10.33, recast@^0.10.10:
version "0.10.33"
resolved "https://registry.yarnpkg.com/recast/-/recast-0.10.33.tgz#942808f7aa016f1fa7142c461d7e5704aaa8d697"
dependencies:
Expand All @@ -5057,15 +5049,6 @@ recast@0.10.33:
private "~0.1.5"
source-map "~0.5.0"

recast@^0.10.10:
version "0.10.43"
resolved "https://registry.yarnpkg.com/recast/-/recast-0.10.43.tgz#b95d50f6d60761a5f6252e15d80678168491ce7f"
dependencies:
ast-types "0.8.15"
esprima-fb "~15001.1001.0-dev-harmony-fb"
private "~0.1.5"
source-map "~0.5.0"

recast@^0.11.17, recast@^0.11.3:
version "0.11.23"
resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.23.tgz#451fd3004ab1e4df9b4e4b66376b2a21912462d3"
Expand Down

0 comments on commit e915f22

Please sign in to comment.