-
Notifications
You must be signed in to change notification settings - Fork 472
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: optional-dependency #3050
feat: optional-dependency #3050
Conversation
|
node: &'ast swc_core::ecma::ast::TryStmt, | ||
ast_path: &mut swc_core::ecma::visit::AstNodePath<'r>, | ||
) { | ||
self.in_try = true; |
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.
I currently could not come up with a problem case. But the code is kind of buggy.
It's better to store the old in_try
value and then recover it for the nested try-catch block.
let old_in_try = self.in_try;
self.in_try = true
node.visit_children_with_path(self, ast_path);
self.in_try = old_in_try
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.
I currently could not come up with a problem case. But the code is kind of buggy.
It's better to store the old
in_try
value and then recover it for the nested try-catch block.let old_in_try = self.in_try; self.in_try = true node.visit_children_with_path(self, ast_path); self.in_try = old_in_try
Do I need to submit an mr Again?
Related issue (if exists)
#3042
Summary
馃 Generated by Copilot at 0064be7
This pull request adds support for ignoring
require
calls inside try-catch blocks in therspack_plugin_javascript
crate. It also adds a new test case with fixture files to verify the functionality.Walkthrough
馃 Generated by Copilot at 0064be7
in_try
toDependencyScanner
to track try statements (link)visit_try_stmt
method to set and resetin_try
field (link)visit_expr
method to skiprequire
calls inside try blocks (link)index.js
with arequire
call inside a try-catch block (link)expected/main.js
with the expected output of the plugin (link)test.config.json
with the configuration for the plugin (link)