Skip to content

TypeScript: skip ! when parsing variable statements#4389

Open
masatake wants to merge 2 commits intouniversal-ctags:masterfrom
masatake:typescript--ban-in-expr
Open

TypeScript: skip ! when parsing variable statements#4389
masatake wants to merge 2 commits intouniversal-ctags:masterfrom
masatake:typescript--ban-in-expr

Conversation

@masatake
Copy link
Member

Fixes #4384

@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.02%. Comparing base (b4fdb90) to head (feb392b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4389   +/-   ##
=======================================
  Coverage   86.02%   86.02%           
=======================================
  Files         253      253           
  Lines       63506    63506           
=======================================
  Hits        54634    54634           
  Misses       8872     8872           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@masatake masatake force-pushed the typescript--ban-in-expr branch from 76ba2c3 to 416d9c3 Compare February 26, 2026 17:36
Fixes universal-ctags#4384

Suggested-by: Rimvydas Naktinis (@naktinis)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake force-pushed the typescript--ban-in-expr branch from 416d9c3 to feb392b Compare February 26, 2026 18:06
@masatake masatake requested a review from Copilot February 26, 2026 18:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for TypeScript's non-null assertion operator (!) in the parser, ensuring it is properly skipped and doesn't interfere with parsing variable statements and class properties.

Changes:

  • Added TOKEN_BANG to handle the ! operator in TypeScript
  • Updated parser logic to skip ! tokens in variable and class body parsing contexts
  • Added comprehensive test cases for both definite assignment assertions and non-null assertions

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
parsers/typescript.c Added TOKEN_BANG token type and updated parsers to handle ! in variable statements and class properties
Units/parser-typescript.r/skip-bang.d/validator Added validator file specifying TypeScript compiler for test validation
Units/parser-typescript.r/skip-bang.d/input.ts Added test case for non-null assertion in ternary expression
Units/parser-typescript.r/skip-bang.d/input-0.ts Added test case for definite assignment assertions on class properties
Units/parser-typescript.r/skip-bang.d/expected.tags Added expected parser output for the test cases
Units/parser-typescript.r/skip-bang.d/args.ctags Added test configuration to disable sorting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exclamation point breaks TypeScript assignment parsing

2 participants