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

Missing comments in arrow function head #6321

Open
nicolo-ribaudo opened this issue Nov 2, 2022 · 0 comments
Open

Missing comments in arrow function head #6321

nicolo-ribaudo opened this issue Nov 2, 2022 · 0 comments
Labels

Comments

@nicolo-ribaudo
Copy link

nicolo-ribaudo commented Nov 2, 2022

Describe the bug

Almost all the comments in the "head" part of an arrow function disappear. In the example below, only /* 0 */ and /* 8 */ are preserved.

Input code

/* 0 */ async () => {};

async /* 1 */ () => {};
async () /* 2 */ => {};
async /* 3 */ (param) => {};
async (param) /* 4 */ => {};
async ( /* 5 */ ) => {};
async ( /*
         * 6 with newline
         */
) => {};
async /* 7 */ param => {}
async param /* 8 */ => {}

Config

{
  "minify": false,
  "jsc": {
    "parser": {
      "syntax": "typescript"
    },
    "target": "es2022"
  }
}

Playground link

https://play.swc.rs/?version=1.2.117&code=H4sIAAAAAAAAA9PXUjBQ0NJXSCyuzEtW0NBUsLVTqK615uKCCOhrKRiCpBEScIVAKSOQFIo4UNAYrL4gsSgxF10TVBCoyARDpwZI2BQkjK4LKMGlAANaCmYK5ZklGQp5qeU5mXmpSDL6XJoYjjEHGQi2FiIFlYGIAOUt4O7gAgD55TQuCgEAAA%3D%3D&config=H4sIAAAAAAAAAxXIMQrAIAwF0Lv82aE4epsgsVhakSSDQXL3ttvjbTx99OYojW7lhEsrysYkUZZf6sNoocB8slbp0xAJRnKyfc2aj5wR8QIQoOQiSwAAAA%3D%3D

Expected behavior

The comments should be printed.

Actual behavior

Comments from 1 to 7 are not printed.

Version

1.2.117

Additional context

No response

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

2 participants