fix: emit syntheticHostListener for legacy animation host listeners#256
Merged
Brooooooklyn merged 1 commit intovoidzero-dev:mainfrom May 2, 2026
Merged
Conversation
Legacy animation host listeners (`@HostListener('@trigger.phase')` and
`host: { '(@trigger.phase)': '...' }`) were being compiled as plain
`ɵɵlistener` calls, so `@trigger` events were never routed through the
animation renderer. Match Angular's reference compiler by classifying
these as `LegacyAnimation`, ordering them before regular listeners, and
emitting `ɵɵsyntheticHostListener` with the correct
`ComponentName_animation_<trigger>_<phase>_HostBindingHandler` name.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Brooooooklyn
approved these changes
May 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@HostListener('@trigger.phase')andhost: { '(@trigger.phase)': '...' }) were compiled to plainɵɵlistener, so@triggerevents never routed through Angular's animation renderer.@-prefixed host event names asParsedEventType::LegacyAnimationin bothcomponent/transform.rsanddirective/compiler.rsso the pipeline routes them through the synthetic-host path.CREATE_ORDERING.ɵɵsyntheticHostListener("@trigger.phase", fn ComponentName_animation_<trigger>_<phase>_HostBindingHandler)from the reify phase, including correct chaining.ListenerOp.animation_phase: Option<AnimationKind>withlegacy_animation_phase: Option<Ident<'a>>so the raw phase string round-trips through the IR (matches Angular'sparseLegacyAnimationEventName+splitAtPeriodsemantics: trim both halves, lowercase the phase, preserve unknown phases verbatim).sanitize_identifierto ASCII-only (is_ascii_alphanumeric) to match Angular'ssanitizeIdentifierregex (/\W/gis ASCII-only in JavaScript).Reproduction
Before: emitted
ɵɵlistener(\"@animation.done\", ...).After: emits the chained
ɵɵsyntheticHostListener(\"@animation.done\", fn)(\"@animation.start\", fn)— byte-for-byte match against Angular'schain_synthetic_listeners.jscompliance fixture.Test plan
chain_synthetic_listeners,chain_synthetic_listeners_mixed, andanimation_host_bindingscompliance fixtures (all match)@HostListenerandhost: { ... }syntax, ordering,@Directiveparity, uppercase phase normalization, whitespace trimming, bogus-phase preservation, no-phase fallback to plainɵɵlistener, and ASCII sanitizeListenerOp::is_legacy_animationandcreate_op_prioritycargo testpassescargo fmt --check,oxfmt --check,oxlint --type-aware --type-checkall clean🤖 Generated with Claude Code