|
|
@ -169,14 +169,15 @@ export default function dom(
|
|
|
|
scope = scope.parent;
|
|
|
|
scope = scope.parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (node.type === 'AssignmentExpression') {
|
|
|
|
if (node.type === 'AssignmentExpression' || node.type === 'UpdateExpression') {
|
|
|
|
|
|
|
|
const assignee = node.type === 'AssignmentExpression' ? node.left : node.argument;
|
|
|
|
let names = [];
|
|
|
|
let names = [];
|
|
|
|
|
|
|
|
|
|
|
|
if (node.left.type === 'MemberExpression') {
|
|
|
|
if (assignee.type === 'MemberExpression') {
|
|
|
|
const left_object_name = get_object(node.left).name;
|
|
|
|
const left_object_name = get_object(assignee).name;
|
|
|
|
left_object_name && (names = [left_object_name]);
|
|
|
|
left_object_name && (names = [left_object_name]);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
names = extract_names(node.left);
|
|
|
|
names = extract_names(assignee);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (node.operator === '=' && nodes_match(node.left, node.right)) {
|
|
|
|
if (node.operator === '=' && nodes_match(node.left, node.right)) {
|
|
|
@ -189,9 +190,10 @@ export default function dom(
|
|
|
|
code.overwrite(node.start, node.end, dirty.map(n => component.invalidate(n)).join('; '));
|
|
|
|
code.overwrite(node.start, node.end, dirty.map(n => component.invalidate(n)).join('; '));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const single = (
|
|
|
|
const single = (
|
|
|
|
node.left.type === 'Identifier' &&
|
|
|
|
node.type === 'AssignmentExpression' &&
|
|
|
|
|
|
|
|
assignee.type === 'Identifier' &&
|
|
|
|
parent.type === 'ExpressionStatement' &&
|
|
|
|
parent.type === 'ExpressionStatement' &&
|
|
|
|
node.left.name[0] !== '$'
|
|
|
|
assignee.name[0] !== '$'
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
names.forEach(name => {
|
|
|
|
names.forEach(name => {
|
|
|
@ -213,18 +215,6 @@ export default function dom(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else if (node.type === 'UpdateExpression') {
|
|
|
|
|
|
|
|
const { name } = get_object(node.argument);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (scope.find_owner(name) !== component.instance_scope) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const variable = component.var_lookup.get(name);
|
|
|
|
|
|
|
|
if (variable && variable.hoistable) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pending_assignments.add(name);
|
|
|
|
|
|
|
|
component.has_reactive_assignments = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pending_assignments.size > 0) {
|
|
|
|
if (pending_assignments.size > 0) {
|
|
|
|
if (node.type === 'ArrowFunctionExpression') {
|
|
|
|
if (node.type === 'ArrowFunctionExpression') {
|
|
|
|
const insert = Array.from(pending_assignments).map(name => component.invalidate(name)).join('; ');
|
|
|
|
const insert = Array.from(pending_assignments).map(name => component.invalidate(name)).join('; ');
|
|
|
|