Skip to content

Commit 3c12178

Browse files
committed
Proper implementation
Replace ad hoc hack with a proper implementation.
1 parent 3f1bc4e commit 3c12178

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/standard/annotations.html

+2-5
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,8 @@
147147
if (!p.literal) {
148148
var signature = this._parseMethod(p.value);
149149
if (signature) {
150-
var method = signature.method;
151-
if (this.properties[method]) {
152-
var args = signature.args || [];
153-
args.push(this._parseArg(method));
154-
signature.args = args;
150+
if (this.properties[signature.method]) {
151+
signature.dynamicFn = true;
155152
signature.static = false;
156153
}
157154
p.signature = signature;

src/standard/effectBuilder.html

+8
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@
171171
arg);
172172
}
173173
}
174+
if (sig.dynamicFn) {
175+
// trigger=null is sufficient as long as we don't allow paths to be
176+
// used. If we change our mind, we must first implement this in the
177+
// effects anyway where we basically do a `fn = this[methodName]` at
178+
// the moment.
179+
this.__addAnnotatedComputationEffect(
180+
sig.method, index, note, part, null);
181+
}
174182
}
175183
},
176184

test/unit/bind.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@
285285

286286
<script>
287287

288-
suite('computed properties', function() {
288+
suite('computed bindings with dynamic functions', function() {
289289

290290
var el;
291291

@@ -297,7 +297,7 @@
297297
document.body.removeChild(el);
298298
});
299299

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

0 commit comments

Comments
 (0)