mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 05:22:58 -05:00
The declarations pass recorded a function body or loop replacing a variable's document write method only for `local.saveAs = ...` and `local['saveAs'] = ...`. A hoisted function or a later loop pass could still change the method through a compound or update operator (`local.saveAs += w`, `local['saveAs']++`), or hold the object under another name (`var y = local; y.saveAs = w`, `give(local)`), and an earlier `local.saveAs(f)` kept its exemption. The pass now reads these the way the main pass reads them: any compound or update operator on a write method, `++local.saveAs`, a key in brackets that is not one string or number literal, `delete local`, and the variable used as a value. Each recorded replacement is kept by the body that declares the variable, so a function's own variable of the same name keeps its exemption.