Skip to content

Commit

Permalink
Proper implementation
Browse files Browse the repository at this point in the history
Replace ad hoc hack with a proper implementation.
  • Loading branch information
kaste committed Feb 12, 2016
1 parent 3f1bc4e commit 3c12178
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/standard/annotations.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,8 @@
if (!p.literal) {
var signature = this._parseMethod(p.value);
if (signature) {
var method = signature.method;
if (this.properties[method]) {
var args = signature.args || [];
args.push(this._parseArg(method));
signature.args = args;
if (this.properties[signature.method]) {
signature.dynamicFn = true;
signature.static = false;
}
p.signature = signature;
Expand Down
8 changes: 8 additions & 0 deletions src/standard/effectBuilder.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@
arg);
}
}
if (sig.dynamicFn) {
// trigger=null is sufficient as long as we don't allow paths to be
// used. If we change our mind, we must first implement this in the
// effects anyway where we basically do a `fn = this[methodName]` at
// the moment.
this.__addAnnotatedComputationEffect(
sig.method, index, note, part, null);
}
}
},

Expand Down
4 changes: 2 additions & 2 deletions test/unit/bind.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@

<script>

suite('computed properties', function() {
suite('computed bindings with dynamic functions', function() {

var el;

Expand All @@ -297,7 +297,7 @@
document.body.removeChild(el);
});

test('x', function() {
test('annotated computation with dynamic function', function() {
el = document.createElement('x-bind-computed-property');
document.body.appendChild(el);

Expand Down

0 comments on commit 3c12178

Please sign in to comment.