tidy assignment operator check

pull/3640/head
Conduitry 6 years ago
parent 253615fed5
commit 5f1b3c1b54

@ -46,9 +46,6 @@ childKeys.EachBlock = childKeys.IfBlock = ['children', 'else'];
childKeys.Attribute = ['value']; childKeys.Attribute = ['value'];
childKeys.ExportNamedDeclaration = ['declaration', 'specifiers']; childKeys.ExportNamedDeclaration = ['declaration', 'specifiers'];
// There is no datatype that describes only the compound operators so we create this list here
const compoundAssignmentOperators = ["+=" , "-=" ,"*=", "/=" ,"%=" ,"**=", "<<=" ,">>=", ">>>=", "|=" ,"^=" ,"&="];
function remove_node( function remove_node(
code: MagicString, code: MagicString,
start: number, start: number,
@ -1275,9 +1272,7 @@ export default class Component {
assignees.add(node.name); assignees.add(node.name);
}); });
if (node.operator !== '=') {
if (compoundAssignmentOperators.findIndex(op => op === node.operator) !== -1) {
dependencies.add(left.name); dependencies.add(left.name);
} }
} else if (node.type === 'UpdateExpression') { } else if (node.type === 'UpdateExpression') {

Loading…
Cancel
Save