Skip to content

reversed word contain escape char should throw error but not #10851

@bvanjoi

Description

@bvanjoi

Describe the bug

This code should throw syntax error but not

Input code

// /tests/fixture/issues-2xxx/2844/input/index.js
class X { st\u0061tic y() { } }

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": false
    },
    "target": "es2015",
    "loose": false,
    "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": false
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": true,
  "isModule": "unknown"
}

Link to the code that reproduces this issue

https://play.swc.rs/?version=1.12.14&code=H4sIAAAAAAAAA0vOSSwuVohQqFYoLokpNTAwMyzJTFao1NAEitQq1AIAwysljB8AAAA%3D&config=H4sIAAAAAAAAA32US47bMAyG9zlF4HUXbYHpYg7QXc8gKBLlKGOLhkglMQa5%2B9CvJJ3Q3tn8%2BJMSSfFzt99XJ3LV%2B%2F5TPuWns5kg3%2F%2FFQn1iexVLBa615HLsuPqx0BMNKNiGYDTdJlKxzTXwqKLfP3%2B9zYqqQSRYFLOtjSmG%2Fjmnw7bLQPRkE6uELC0kpv%2F1M8t4GQDn8mw%2FIDZg0wYxlkxMDDVkLbDDprEdgTnbrEQZTmpzJNRSDLAweNNl7FSefOSISXK%2BUg%2FWG4ceFBQzOI5n0GSSS2SJ5HrKfUbs4VDqeuzzNzWcbVMsKznhOrZETqtEPWIkNqEkrYQTXKnBBOfiflfGYDJwyelVd8KYVnryASAVaCxRsi1ocUePIPO0pg6bypiCjCz3Cpf51m6ZoJaimhiDUtmhMpA5at3M4IuDobJOO86MV8pH0YOBEGRWlNB0ieyOWlLuO8CgAOmvDdpUTcDcX%2BEKHx7EBv4rt2R9wGaP1vJxnVLfHrDZSNACH9FvOEgrGNdxli1x7dZ5SR5kNMCrLoVG8LoE5AEwmmbcly%2BzIc9DIpq6wcNjTcwOt%2Fsebm2qH%2B99WsW72aFq0ZcRzkt%2B6O%2B0mv9UD6dlCy8nqCL9W4Ry%2Bo%2BEl1Ttbl%2Bt8e50NAYAAA%3D%3D

SWC Info output

No response

Expected behavior

throw syntax error

Actual behavior

No response

Version

1.12.14

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions