Skip to content

Commit

Permalink
fix(es/es2015): Remove needless unreachable! (#9021)
Browse files Browse the repository at this point in the history
**Related issue:**

 - Closes #9020
  • Loading branch information
kdy1 authored Jun 5, 2024
1 parent e3dfa87 commit 555e71c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
19 changes: 19 additions & 0 deletions crates/swc/tests/fixture/issues-9xxx/9020/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": false
},
"target": "es5",
"loose": false,
"minify": {
"compress": false,
"mangle": false
}
},
"module": {
"type": "es6"
},
"minify": false,
"isModule": true
}
4 changes: 4 additions & 0 deletions crates/swc/tests/fixture/issues-9xxx/9020/input/1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const student = {
name: "Tom",
age = 12
};
4 changes: 4 additions & 0 deletions crates/swc/tests/fixture/issues-9xxx/9020/output/1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var student = {
name: "Tom",
age=12
};
2 changes: 1 addition & 1 deletion crates/swc_ecma_compat_es2015/src/duplicate_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl VisitMut for PropFolder {
}
}

Prop::Assign(..) => unreachable!("assign property in object literal is invalid"),
Prop::Assign(..) => {}

Prop::Getter(..) => prop.visit_mut_children_with(&mut PropNameFolder {
props: &mut self.getter_props,
Expand Down

0 comments on commit 555e71c

Please sign in to comment.