-
-
Notifications
You must be signed in to change notification settings - Fork 746
feat: eval simple expression for enum member #11859
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
Conversation
✅ Deploy Preview for rspack ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this 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 implements expression evaluation for TypeScript enum members, enabling inlining of computed enum values like arithmetic operations, unary expressions, and references to other enum members.
Key changes:
- Enhanced enum member value evaluation to handle expressions beyond simple literals
- Added comprehensive expression evaluation methods supporting arithmetic, unary operators, member references, and template literals
- Updated function signatures to pass syntax context information for proper identifier resolution
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/rspack-test/configCases/inline-enum/enum-expression/index.js | Added test cases for evaluatable enum expressions |
| tests/rspack-test/configCases/inline-enum/enum-expression/enum.ts | Added new enum with various expression types for testing |
| crates/swc_plugin_ts_collector/tests/fixture.rs | Updated closure signature to match new API |
| crates/swc_plugin_ts_collector/src/enums.rs | Implemented comprehensive expression evaluation for enum members |
| crates/rspack_loader_swc/src/lib.rs | Updated to pass syntax context to TypeScript info collection |
| crates/rspack_loader_swc/src/collect_ts_info.rs | Added syntax context parameter to collection function |
| crates/rspack_javascript_compiler/src/compiler/transform.rs | Modified transform pipeline to provide syntax context |
| crates/rspack_javascript_compiler/examples/transform.rs | Updated example to match new closure signature |
| crates/rspack_binding_api/src/swc.rs | Updated binding to match new closure signature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
📦 Binary Size-limit
🎉 Size decreased by 274.13KB from 47.89MB to 47.62MB (⬇️0.56%) |
CodSpeed Performance ReportMerging #11859 will not alter performanceComparing Summary
|
Summary
Eval simple expression for enum member
Related links
Checklist