Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 220x 220x | /**
* Handler for simple assignments (ADR-109).
*
* The fallback case: generates `target = value;` or `target op= value;`
* Used when no special handling is needed.
*/
import IAssignmentContext from "../IAssignmentContext";
import IHandlerDeps from "./IHandlerDeps";
/**
* Handle simple variable assignment.
*
* @example
* x <- 5 => x = 5;
* counter +<- 1 => counter += 1;
*/
function handleSimpleAssignment(
ctx: IAssignmentContext,
deps: IHandlerDeps,
): string {
const target = deps.generateAssignmentTarget(ctx.targetCtx);
return `${target} ${ctx.cOp} ${ctx.generatedValue};`;
}
export default handleSimpleAssignment;
|