Skip to content

Conversation

@Haixing-Hu
Copy link

@Haixing-Hu Haixing-Hu commented Aug 25, 2025

Fix ES6 class mixin static members incorrectly converted to instance scope

  • Fix staticToInstance function in augment.js to preserve ES6 class static members
  • Add comprehensive test cases for both ES6 class mixins and traditional object mixins
  • ES6 class static members defined with 'static' keyword now remain static when mixed
  • Traditional object mixin members continue to be converted to instance (unchanged behavior)
  • Backward compatible: no breaking changes for existing codebases
  • Fixes issue ES6 class mixin static members incorrectly converted to instance scope during augmentation #2146

Test coverage:

  • ES6 class static properties/methods with 'static' keyword → remain static
  • ES6 class properties/methods defined outside class → become instance
  • Traditional object mixin properties/methods → become instance (unchanged)
  • All existing functionality continues to work without regression

Related: Depends on fix for issue #2144 (static property scope detection in parser)

Q A
Bug fix? yes
New feature? no
Breaking change? no
Deprecations? no
Tests added? yes
Fixed issues #2146
License Apache-2.0

- Fix parser.js to check node.static for class properties
- Add test case to verify static properties are parsed correctly
- Static properties now use correct longname (ClassName.prop) and scope (static)
- Fix prettier formatting issues in parser.js and test files
- All tests pass, confirming the fix doesn't break existing functionality
- Fixes issue jsdoc#2144
…scope

- Fix staticToInstance function in augment.js to preserve ES6 class static members
- Add comprehensive test cases for both ES6 class mixins and traditional object mixins
- ES6 class static members defined with 'static' keyword now remain static when mixed
- Traditional object mixin members continue to be converted to instance (unchanged behavior)
- Backward compatible: no breaking changes for existing codebases

Fixes: ES6 class mixin static members incorrectly converted to instance scope during augmentation
Related: Depends on fix for issue jsdoc#2144 (static property scope detection in parser)

Test coverage:
- ES6 class static properties/methods with 'static' keyword → remain static
- ES6 class properties/methods defined outside class → become instance
- Traditional object mixin properties/methods → become instance (unchanged)
- All existing functionality continues to work without regression
@Haixing-Hu Haixing-Hu changed the title Fix bug 2146 fix: #2146 ES6 class mixin static members incorrectly converted to instance scope Aug 25, 2025
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