Visitar URL original
refactor(compiler): remove empty string suffix from interpolati… by JeanMeche · Pull Request #60066 · angular/angular · GitHub
The Wayback Machine - https://web.archive.org/web/20250304234215/https://github.com/angular/angular/pull/60066
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(compiler): remove empty string suffix from interpolati… #60066

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JeanMeche
Copy link
Member

…on instructions

With this change, interpolations that don't have a suffix will miss the last argument which was previously an empty string.

@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Feb 23, 2025
@ngbot ngbot bot added this to the Backlog milestone Feb 23, 2025
@JeanMeche JeanMeche force-pushed the compiler/interpolation-empty-string branch 2 times, most recently from a7c58e1 to 536b79a Compare February 23, 2025 11:22
@JeanMeche JeanMeche requested a review from crisbeto February 23, 2025 11:45
@JeanMeche JeanMeche marked this pull request as ready for review February 23, 2025 11:45
@JeanMeche JeanMeche force-pushed the compiler/interpolation-empty-string branch 3 times, most recently from c7a385e to 29cdcb6 Compare February 23, 2025 17:20
@JeanMeche JeanMeche changed the title refactor(compiler): remove empty empty string suffix from interpolati… refactor(compiler): remove empty string suffix from interpolati… Feb 24, 2025
if (interpolationParts.length > 0) {
// This handles potential undefined last suffix in the interpolationParts array.
if (interpolationParts[interpolationParts.length - 1] === undefined) {
interpolationParts.pop();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to mutate the array instead of skipping the last value when reading it instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next line is a interpolationParts.join()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we handle this at the call site by doing something like suffix || ''?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you prefer that we can go that road. It's 16 callsites but they are guarded by ngDevMode.

@JeanMeche JeanMeche force-pushed the compiler/interpolation-empty-string branch from 29cdcb6 to 5615563 Compare February 27, 2025 15:13
@pullapprove pullapprove bot requested a review from devversion February 27, 2025 15:13
@JeanMeche JeanMeche force-pushed the compiler/interpolation-empty-string branch from 5615563 to 1058c78 Compare February 27, 2025 15:15
…on instructions

With this change, interpolations that don't have a suffix will miss the last argument which was previously an empty string.
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM on build infra (APF is already shipping ES2022; so it makes sense)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: compiler Issues related to `ngc`, Angular's template compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants