-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Milestone
Description
This is follow-up of #6818.
With the PR, the variable renamed is now able to rename even with presence of eval
.
But for modification, the current code is not ideal.
For the input
import styled from 'styled-components';
const C1 = styled.div`
position: absolute;
`;
const C2 = styled.div`
position: absolute;
`;
const debug = eval('');
swc produces
import _tagged_template_literal from "@swc/helpers/src/_tagged_template_literal.mjs";
function _templateObject() {
var n = _tagged_template_literal([
"\n position: absolute;\n"
]);
_templateObject = function r() {
return n;
};
return n;
}
function _templateObject1() {
var n = _tagged_template_literal([
"\n position: absolute;\n"
]);
_templateObject1 = function r() {
return n;
};
return n;
}
import styled from "styled-components";
var C1 = styled.div(_templateObject());
var C2 = styled.div(_templateObject1());
var debug = eval("");
but there are some synthesized variables.
This is because we apply hygiene
before applying the name mangler, and hygiene
pass removes information indicating if an identifier is synthesized.
Metadata
Metadata
Assignees
Labels
No labels