Proper implementation

Replace ad hoc hack with a proper implementation.
This commit is contained in:
herr kaste 2016-02-02 23:45:28 +01:00
parent 3f1bc4e33a
commit 3c12178f79
3 changed files with 12 additions and 7 deletions

View File

@ -147,11 +147,8 @@ TODO(sjmiles): this module should produce either syntactic metadata
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;

View File

@ -171,6 +171,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
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);
}
}
},

View File

@ -285,7 +285,7 @@ suite('single-element binding effects', function() {
<script>
suite('computed properties', function() {
suite('computed bindings with dynamic functions', function() {
var el;
@ -297,7 +297,7 @@ suite('computed properties', function() {
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);