Filters run after typing, in a fixed sequence declared in src/ax4/Filters.hx.
AS3 and Haxe are close but not equivalent. Filters bridge semantic and API gaps, for example:
for...in/for eachrewrites- Metadata conversion (
[Inject],[Embed], etc.) - API remaps (
Math,Date,String,Array, display classes) - Cast normalization and type coercion
- Import and override fixes
- Order is significant.
- Some filters are diagnostic and only report issues.
- Some filters are compatibility-oriented and introduce helpers/imports.
testCloneExprinserts extra smoke filters before and after rewrites.
- Early structural and safety passes
- Expression and syntax rewrites
- Type and cast normalization
- API adaptation filters
- Late consistency fixes (overrides, imports, redundant parenthesis)
The canonical source of truth is src/ax4/Filters.hx.
Each filter implementation is in src/ax4/filters/.
When debugging a behavior change:
- Locate the responsible filter in
Filters.hx - Open corresponding file in
src/ax4/filters/ - Add a minimal test in
tests/src - Re-run conversion with
tests/config.json