Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reparse fixes#2372

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ahejlsberg merged 2 commits intomainfromreparse-fixes
Dec 13, 2025
Merged

Reparse fixes#2372

ahejlsberg merged 2 commits intomainfromreparse-fixes
Dec 13, 2025

Conversation

@ahejlsberg
Copy link
Member

@ahejlsbergahejlsberg commentedDec 13, 2025
edited
Loading

This PR modifies our reparse strategy for@type and@satisfies assertions. Previously, we'd generate anast.AsExpression orast.SatisfiesExpression containing clones of the target expression and type, and mark all of them asast.NodeFlagsReparsed. This had the unfortunate effect of "hiding" the target expression because it would now only occur in the AST as a reparsed node. With this PR, we still generate anast.AsExpression orast.SatisfiesExpression, but we no longer mark it as reparsed. We re-parent the target expression into the assertion node, but still clone the target type and mark it asast.NodeFlagsReparsed. So, the AST reflects a normalast.AsExpression orast.SatisfiesExpression with anExpression child that is the original expression andType child that is markedast.NodeFlagsReparsed. This flag on theType node makes it simple to detect the transformation, should that be necessary.

With this PR we have the nice property that reparsed nodes can consistently be ignored in AST walks.

The PR also contains:

  • A panic that occurs ifast.GetOrCreateToken is called with a parent markedast.NodeFlagsReparsed. Tokens should never be created from reparsed nodes.
  • The node visitor inaddRegionOutliningSpans is modified to skip over reparsed nodes.
  • Fixed error spans on@satisfies assertions to be consistent with errors spans on@type assertions.

Fixes#2245.
Fixes#2289.
Fixes#2346.

Copy link
Member

@jakebaileyjakebailey left a comment

Choose a reason for hiding this comment

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

This seems like what we discussed; I am not sure how to reconcile#2371 with it, though.

@ahejlsbergahejlsberg added this pull request to themerge queueDec 13, 2025
@ahejlsberg
Copy link
MemberAuthor

I am not sure how to reconcile#2371 with it, though.

Actually,#2371 becomes simpler because we no longer need logic to track "special" reparsed nodes. TheshouldVisitNode function just becomes a simple check that the node isn't reparsed.

Merged via the queue intomain with commit92c21dbDec 13, 2025
28 checks passed
@ahejlsbergahejlsberg deleted the reparse-fixes branchDecember 13, 2025 16:04
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jakebaileyjakebaileyjakebailey approved these changes

@DanielRosenwasserDanielRosenwasserAwaiting requested review from DanielRosenwasser

@sandersnsandersnAwaiting requested review from sandersn

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

3 participants

@ahejlsberg@jakebailey

[8]ページ先頭

©2009-2025 Movatter.jp