Skip to content
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

some comments can't be visited #9292

Open
Darsoon opened this issue Jul 19, 2024 · 0 comments
Open

some comments can't be visited #9292

Darsoon opened this issue Jul 19, 2024 · 0 comments
Labels

Comments

@Darsoon
Copy link

Darsoon commented Jul 19, 2024

Describe the bug

I had try visit_mut_stmt to visit these comments. but some comments always cant be visited

Input code

function test3(partitionType, defaultPartition, CHANGE_VALUE_TYPE, partition) {
  // ✅ this can
  if (partitionType === CHANGE_VALUE_TYPE['ccc']) {
    partition = defaultPartition;
    // ❌ this comment cann't be visited
  } else if (partitionType === CHANGE_VALUE_TYPE['bbb']) {
    // ✅ this can
    partition = '';
  }
  return partition;
}

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": true
    },
    "loose": true,
    "minify": {
      "compress": {
        "arguments": false,
        "arrows": true,
        "booleans": true,
        "booleans_as_integers": false,
        "collapse_vars": true,
        "comparisons": true,
        "computed_props": true,
        "conditionals": true,
        "dead_code": true,
        "directives": true,
        "drop_console": false,
        "drop_debugger": true,
        "evaluate": true,
        "expression": false,
        "hoist_funs": false,
        "hoist_props": true,
        "hoist_vars": false,
        "if_return": true,
        "join_vars": true,
        "keep_classnames": false,
        "keep_fargs": true,
        "keep_fnames": false,
        "keep_infinity": false,
        "loops": true,
        "negate_iife": true,
        "properties": true,
        "reduce_funcs": false,
        "reduce_vars": false,
        "side_effects": true,
        "switches": true,
        "typeofs": true,
        "unsafe": false,
        "unsafe_arrows": false,
        "unsafe_comps": false,
        "unsafe_Function": false,
        "unsafe_math": false,
        "unsafe_symbols": false,
        "unsafe_methods": false,
        "unsafe_proto": false,
        "unsafe_regexp": false,
        "unsafe_undefined": false,
        "unused": true,
        "const_to_let": true,
        "pristine_globals": true
      },
      "mangle": {
        "toplevel": false,
        "keep_classnames": false,
        "keep_fnames": false,
        "keep_private_props": false,
        "ie8": false,
        "safari10": false
      }
    }
  },
  "module": {
    "type": "commonjs"
  },
  "minify": false,
  "isModule": true,
  "env": {
    "targets": ""
  }
}

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.7.0&code=H4sIAAAAAAAAA0srzUsuyczPUyhJLS4x1ihILCrJBPFDKgtSdRRSUtMSS3NKAmCiOgrOHo5%2B7q7xYY4%2Boa7xIZEBrjoKcD2aCtW8XAoK%2BvoKj%2Ba0KpRkZBYrJCfmgYQy0xRQjVawtbXFNCtaPTk5WT0Wao4CwmQFWwynWEOUgCyb2wO1LD83NzWvBGRpnnqJQlKqQllmcWZJagpIaa1Cak5xKvEuSUpKQnIJFj%2BhOk9dHeygWhBRlFpSWpSHkAbK1AIAHhH6E2gBAAA%3D&config=H4sIAAAAAAAAA42VwZKbMAyG73mKDOc9tLdOH6C3PoPHwTJxaluMJdhkdvLuFQ5k6UYwvTCgz5Is%2BZf5OByPzYXa5ufxQ17lo7eFoDy%2FxUK3zPYqlgbaZKktoefmbaEXmhCXAarl%2FgBNRCSYwWxKIQd%2FW0duMfUFiFY2sdrSDQkyT2ZvI8HbmhV8p3%2FiVvsJMYLNO8RYMiEzdFC0wC3GaHsCM9qiRJl2aksg1FJMcGBwpi%2FYqzy7wAGz5HylDqwzLTpQUCjQchhBc5Nc4pZJylPqqdjBaei6eppfvGG0cbCs5IRrPRLZrRL1jIHY%2BCFrLXzAjR484Nzcr57BmwI8lPzqd8GQN87kD4B0IFqibBNocesKL3ra8va7niF7kSzfFC7y1qrM0ElTTQhe6ezUGSgctNMs4IYWps622nZmvNE%2BCg4MeC9aUULTe%2BD2rCXlWw%2FoFSDna72mqgcwzync4NNA7OBfUiXrAptXJMvnbUq3dMK4kyABn9HtLJCjYNzGRW6Ja7%2FNh%2BxApAFOXTJQBa%2BXgAwAo4nAmjZkPCSi6SKePq%2BJecH9edsmm7s676v7krGPMELckvF%2FjMgulb2Nk6qXyX6ZXvihidLK4IXv3xa0lHJYnrWoJqEbVgVVTU6%2FGpFQwnyh5nPl8vt4ZmoC%2FV7cl342kMdVNJl9qEPR1ECH%2B1%2FntDuV8QYAAA%3D%3D

SWC Info output

No response

Expected behavior

get this comment

Actual behavior

No response

Version

1.4.14

Additional context

No response

@Darsoon Darsoon added the C-bug label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant