Repository navigation
Filters
github-actions[bot] edited this page Oct 11, 2026
·
5 revisions
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
Many filters both rewrite and report. Warnings are aggregated at end of run; meanings and triage notes live in Diagnostics.
Examples tied to recent fidelity work:
| Filter | Related behavior |
|---|---|
CoerceToNumber / typer |
Boolean in numeric arithmetic → ASCompat.toNumber, warning Boolean + / Boolean arithmetic
|
RewriteSwitch |
AS3 fall-through → duplicated case-body suffix in Haxe, warning Switch case fall-through…
|
CoerceToBool |
void used as condition → { call; false; }, warning void used as Bool…
|
The table is illustrative, not exhaustive — Filters.hx remains authoritative for order and membership.