Skip to content

Commit

Permalink
fix(es/resolver): Skip property in JSX member (#8598)
Browse files Browse the repository at this point in the history
**Related issue:**

 - Close #8528
  • Loading branch information
magic-akari authored Feb 4, 2024
1 parent 52b821a commit d480ab9
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 0 deletions.
26 changes: 26 additions & 0 deletions crates/swc/tests/fixture/issues-8xxx/8528/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"jsc": {
"parser": {
"decorators": true,
"syntax": "typescript"
},
"transform": {
"decoratorVersion": "2022-03"
},
"externalHelpers": true,
"experimental": {
"plugins": [
[
"@swc/plugin-styled-components",
{
"displayName": true,
"ssr": true
}
]
]
}
},
"env": {
"targets": "> 1%, not dead"
}
}
10 changes: 10 additions & 0 deletions crates/swc/tests/fixture/issues-8xxx/8528/input/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { observer } from "mobx";
import * as React from "react";
import * as S from "./BetButton.styled";

@observer
class BetButtonWrapper extends React.Component {
render() {
return <S.BetButtonWrapper />;
}
}
15 changes: 15 additions & 0 deletions crates/swc/tests/fixture/issues-8xxx/8528/output/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { _ as _apply_decs_2203_r } from "@swc/helpers/_/_apply_decs_2203_r";
var _initClass, _React_Component;
import { observer } from "mobx";
import * as React from "react";
import * as S from "./BetButton.styled";
let _BetButtonWrapper;
class BetButtonWrapper extends (_React_Component = React.Component) {
static #_ = { c: [_BetButtonWrapper, _initClass] } = _apply_decs_2203_r(this, [], [
observer
], _React_Component);
render() {
return /*#__PURE__*/ React.createElement(S.BetButtonWrapper, null);
}
static #_2 = _initClass();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let A;

B.A;
<C.A />;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let A__2;
B.A;
<C.A/>;
4 changes: 4 additions & 0 deletions crates/swc_ecma_visit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,10 @@ macro_rules! visit_mut_obj_and_computed {
}
}

fn visit_mut_jsx_member_expr(&mut self, n: &mut $crate::swc_ecma_ast::JSXMemberExpr) {
n.obj.visit_mut_with(self);
}

fn visit_mut_super_prop_expr(&mut self, n: &mut $crate::swc_ecma_ast::SuperPropExpr) {
if let $crate::swc_ecma_ast::SuperProp::Computed(c) = &mut n.prop {
c.visit_mut_with(self);
Expand Down

0 comments on commit d480ab9

Please sign in to comment.