mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Don't create private setter for computed properties. Fixes #2016.
This commit is contained in:
@@ -169,8 +169,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
// ReadOnly properties have a private setter only
|
||||
// TODO(kschaaf): Per current Bind factoring, we shouldn't
|
||||
// be interrogating the prototype here
|
||||
if (model.getPropertyInfo && model.getPropertyInfo(property).readOnly) {
|
||||
model['_set' + this.upper(property)] = setter;
|
||||
var info = model.getPropertyInfo && model.getPropertyInfo(property);
|
||||
if (info.readOnly) {
|
||||
// Computed properties are read-only (no property setter), but also don't
|
||||
// need a private setter since they should not be called by the user
|
||||
if (!info.computed) {
|
||||
model['_set' + this.upper(property)] = setter;
|
||||
}
|
||||
} else {
|
||||
defun.set = setter;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,9 @@
|
||||
computednotifyingvalue: {
|
||||
type: Number,
|
||||
notify: true,
|
||||
computed: 'computeNotifyingValue(notifyingvalue)'
|
||||
// Naming here is to test that a private setter is not created for
|
||||
// computed properties
|
||||
computed: '_setComputednotifyingvalue(notifyingvalue)'
|
||||
},
|
||||
computedFromMultipleValues: {
|
||||
type: Number,
|
||||
@@ -172,7 +174,7 @@
|
||||
notifierWithoutComputingChanged: function() {
|
||||
this.observerCounts.notifierWithoutComputingChanged++;
|
||||
},
|
||||
computeNotifyingValue: function(val) {
|
||||
_setComputednotifyingvalue: function(val) {
|
||||
return val + 2;
|
||||
},
|
||||
computeFromMultipleValues: function(sum1, sum2, divide) {
|
||||
|
||||
Reference in New Issue
Block a user