Skip to content

Commit

Permalink
Ensure property values are always overridden by extendors/behaviors
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Orvell committed Nov 14, 2018
1 parent 50ad018 commit 2b35a74
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/legacy/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,19 @@ function flattenBehaviors(behaviors, list, exclude) {
}

function mergePropertyInfo(a, b) {
if ('value' in b) {
a.value = b.value;
// ensure property value is always overridden.
} else if ('value' in a) {
delete a.value;
}
if (typeof b === 'function') {
a.type = b;
return;
}
if ('type' in b) {
a.type = b.type;
}
if ('value' in b) {
a.value = b.value;
}
// readOnly: cannot become false and takes on `computed` value
a.readOnly = a.readOnly || Boolean(a.computed) || b.readOnly || Boolean(b.computed);
// computed: first in wins
Expand Down

0 comments on commit 2b35a74

Please sign in to comment.