Skip to content

chore: split the heritage changes of --strip-deprecated by base class and interfaces - #3401

Open
momo-bee wants to merge 1 commit into
aws:preview/v7.1from
momo-bee:simplify-heritage-transformations
Open

momo-bee wants to merge 1 commit into
aws:preview/v7.1from
momo-bee:simplify-heritage-transformations

Conversation

@momo-bee

@momo-bee momo-bee commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

_heritageTransformations had a cyclomatic complexity of 21, the most of any function in its part of the assembler. It did three jobs in one loop: it erased a stripped base class, it erased stripped interfaces, and it held two helpers as closures.

The loop now only picks the classes and interfaces to change. _replaceStrippedBase and _replaceStrippedInterfaces each do one of the two jobs, and the closures became the small methods _isStripped and _heritageReference. The highest complexity is now 9. The changes come out in the same order as before.

  • Full jest passes on Node 26 with coverage (functions 96.61%).
  • jsii-calc and aws-cdk-lib (plain, --add-deprecation-warnings, --strip-deprecated) are byte-identical.
  • aws-cdk-lib with --strip-deprecated, the only mode that runs this code, 4 paired runs: median 54.95s -> 54.50s (gaps +0.85, -0.67, +0.65, -0.27s), the same.

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.

1 participant