rename addConditionalLine to addConditional

pull/769/head
Rich Harris 7 years ago
parent 6222198017
commit 9053e95460

@ -95,7 +95,7 @@ export default function dom(
.map(dep => `state.${dep}`)
.join(', ')} ) ), oldState.${key} ) ) changed.${key} = true;`;
computationBuilder.addConditionalLine(condition, statement);
computationBuilder.addConditional(condition, statement);
});
}

@ -166,16 +166,10 @@ export default function visitAttribute(
( dependencies.length ? `( ${changedCheck} ) && ${updateCachedValue}` : updateCachedValue ) :
changedCheck;
// block.builders.update.addConditionalLine(
// condition,
// updater
// );
block.builders.update.addBlock(deindent`
if ( ${condition} ) {
${updater}
}
`);
block.builders.update.addConditional(
condition,
updater
);
}
} else {
const value = attribute.value === true

@ -39,7 +39,7 @@ export default function visitTag(
( dependencies.length ? `( ${changedCheck} ) && ${updateCachedValue}` : updateCachedValue ) :
changedCheck;
block.builders.update.addConditionalLine(
block.builders.update.addConditional(
condition,
update(shouldCache ? value : snippet)
);

@ -21,7 +21,7 @@ export default class CodeBuilder {
this.lastCondition = null;
}
addConditionalLine(condition: string, body: string) {
addConditional(condition: string, body: string) {
body = body.replace(/^/gm, '\t');
if (condition === this.lastCondition) {

Loading…
Cancel
Save