mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
Copy from https://github.com/rolldown-rs/rolldown/blob/main/crates/rolldown/tests/esbuild/dce/remove_unused_pure_comment_calls/entry.js
399 lines
12 KiB
Text
399 lines
12 KiB
Text
---
|
|
source: crates/oxc_codegen/tests/integration/main.rs
|
|
---
|
|
########## 0
|
|
|
|
x([
|
|
/* #__NO_SIDE_EFFECTS__ */ function() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ function y() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ function*() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ function* y() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async function() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async function y() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async function*() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async function* y() {},
|
|
])
|
|
----------
|
|
x([
|
|
/* #__NO_SIDE_EFFECTS__ */ function() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ function y() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ function* () {},
|
|
/* #__NO_SIDE_EFFECTS__ */ function* y() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async function() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async function y() {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async function* () {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async function* y() {}
|
|
]);
|
|
|
|
########## 1
|
|
|
|
x([
|
|
/* #__NO_SIDE_EFFECTS__ */ y => y,
|
|
/* #__NO_SIDE_EFFECTS__ */ () => {},
|
|
/* #__NO_SIDE_EFFECTS__ */ (y) => (y),
|
|
/* #__NO_SIDE_EFFECTS__ */ async y => y,
|
|
/* #__NO_SIDE_EFFECTS__ */ async () => {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async (y) => (y),
|
|
])
|
|
----------
|
|
x([
|
|
/* #__NO_SIDE_EFFECTS__ */ (y) => y,
|
|
/* #__NO_SIDE_EFFECTS__ */ () => {},
|
|
/* #__NO_SIDE_EFFECTS__ */ (y) => y,
|
|
/* #__NO_SIDE_EFFECTS__ */ async (y) => y,
|
|
/* #__NO_SIDE_EFFECTS__ */ async () => {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async (y) => y
|
|
]);
|
|
|
|
########## 2
|
|
|
|
x([
|
|
/* #__NO_SIDE_EFFECTS__ */ y => y,
|
|
/* #__NO_SIDE_EFFECTS__ */ () => {},
|
|
/* #__NO_SIDE_EFFECTS__ */ (y) => (y),
|
|
/* #__NO_SIDE_EFFECTS__ */ async y => y,
|
|
/* #__NO_SIDE_EFFECTS__ */ async () => {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async (y) => (y),
|
|
])
|
|
----------
|
|
x([
|
|
/* #__NO_SIDE_EFFECTS__ */ (y) => y,
|
|
/* #__NO_SIDE_EFFECTS__ */ () => {},
|
|
/* #__NO_SIDE_EFFECTS__ */ (y) => y,
|
|
/* #__NO_SIDE_EFFECTS__ */ async (y) => y,
|
|
/* #__NO_SIDE_EFFECTS__ */ async () => {},
|
|
/* #__NO_SIDE_EFFECTS__ */ async (y) => y
|
|
]);
|
|
|
|
########## 3
|
|
|
|
// #__NO_SIDE_EFFECTS__
|
|
function a() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
function* b() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
async function c() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
async function* d() {}
|
|
|
|
----------
|
|
// #__NO_SIDE_EFFECTS__
|
|
function a() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
function* b() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
async function c() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
async function* d() {}
|
|
|
|
########## 4
|
|
|
|
// #__NO_SIDE_EFFECTS__
|
|
function a() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
function* b() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
async function c() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
async function* d() {}
|
|
|
|
----------
|
|
// #__NO_SIDE_EFFECTS__
|
|
function a() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
function* b() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
async function c() {}
|
|
// #__NO_SIDE_EFFECTS__
|
|
async function* d() {}
|
|
|
|
########## 5
|
|
|
|
/* @__NO_SIDE_EFFECTS__ */ export function a() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export function* b() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export async function c() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export async function* d() {}
|
|
----------
|
|
/* @__NO_SIDE_EFFECTS__ */ export function a() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export function* b() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export async function c() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export async function* d() {}
|
|
|
|
########## 6
|
|
/* @__NO_SIDE_EFFECTS__ */ export function a() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export function* b() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export async function c() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export async function* d() {}
|
|
|
|
----------
|
|
/* @__NO_SIDE_EFFECTS__ */ export function a() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export function* b() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export async function c() {}
|
|
/* @__NO_SIDE_EFFECTS__ */ export async function* d() {}
|
|
|
|
########## 7
|
|
|
|
/* #__NO_SIDE_EFFECTS__ */ export var v0 = function() {}, v1 = function() {}
|
|
/* #__NO_SIDE_EFFECTS__ */ export let l0 = function() {}, l1 = function() {}
|
|
/* #__NO_SIDE_EFFECTS__ */ export const c0 = function() {}, c1 = function() {}
|
|
/* #__NO_SIDE_EFFECTS__ */ export var v2 = () => {}, v3 = () => {}
|
|
/* #__NO_SIDE_EFFECTS__ */ export let l2 = () => {}, l3 = () => {}
|
|
/* #__NO_SIDE_EFFECTS__ */ export const c2 = () => {}, c3 = () => {}
|
|
|
|
----------
|
|
export var v0 = function() {}, v1 = function() {};
|
|
export let l0 = function() {}, l1 = function() {};
|
|
export const c0 = /* #__NO_SIDE_EFFECTS__ */ function() {}, c1 = function() {};
|
|
export var v2 = () => {}, v3 = () => {};
|
|
export let l2 = () => {}, l3 = () => {};
|
|
export const c2 = /* #__NO_SIDE_EFFECTS__ */ () => {}, c3 = () => {};
|
|
|
|
########## 8
|
|
|
|
/* #__NO_SIDE_EFFECTS__ */ var v0 = function() {}, v1 = function() {}
|
|
/* #__NO_SIDE_EFFECTS__ */ let l0 = function() {}, l1 = function() {}
|
|
/* #__NO_SIDE_EFFECTS__ */ const c0 = function() {}, c1 = function() {}
|
|
/* #__NO_SIDE_EFFECTS__ */ var v2 = () => {}, v3 = () => {}
|
|
/* #__NO_SIDE_EFFECTS__ */ let l2 = () => {}, l3 = () => {}
|
|
/* #__NO_SIDE_EFFECTS__ */ const c2 = () => {}, c3 = () => {}
|
|
|
|
----------
|
|
var v0 = function() {}, v1 = function() {};
|
|
let l0 = function() {}, l1 = function() {};
|
|
const c0 = /* #__NO_SIDE_EFFECTS__ */ function() {}, c1 = function() {};
|
|
var v2 = () => {}, v3 = () => {};
|
|
let l2 = () => {}, l3 = () => {};
|
|
const c2 = /* #__NO_SIDE_EFFECTS__ */ () => {}, c3 = () => {};
|
|
|
|
########## 9
|
|
|
|
isFunction(options)
|
|
? // #8326: extend call and options.name access are considered side-effects
|
|
// by Rollup, so we have to wrap it in a pure-annotated IIFE.
|
|
/*#__PURE__*/ (() =>
|
|
extend({ name: options.name }, extraOptions, { setup: options }))()
|
|
: options
|
|
|
|
----------
|
|
isFunction(options) ? /*#__PURE__*/ (() => extend({ name: options.name }, extraOptions, { setup: options }))() : options;
|
|
|
|
########## 10
|
|
isFunction(options) ? /*#__PURE__*/ (() => extend({ name: options.name }, extraOptions, { setup: options }))() : options;
|
|
|
|
----------
|
|
isFunction(options) ? /*#__PURE__*/ (() => extend({ name: options.name }, extraOptions, { setup: options }))() : options;
|
|
|
|
########## 11
|
|
|
|
const obj = {
|
|
props: /*#__PURE__*/ extend({}, TransitionPropsValidators, {
|
|
tag: String,
|
|
moveClass: String,
|
|
}),
|
|
};
|
|
const p = /*#__PURE__*/ Promise.resolve();
|
|
|
|
----------
|
|
const obj = { props: /*#__PURE__*/ extend({}, TransitionPropsValidators, {
|
|
tag: String,
|
|
moveClass: String
|
|
}) };
|
|
const p = /*#__PURE__*/ Promise.resolve();
|
|
|
|
########## 12
|
|
|
|
const staticCacheMap = /*#__PURE__*/ new WeakMap()
|
|
|
|
----------
|
|
const staticCacheMap = /*#__PURE__*/ new WeakMap();
|
|
|
|
########## 13
|
|
|
|
const builtInSymbols = new Set(
|
|
/*#__PURE__*/
|
|
Object.getOwnPropertyNames(Symbol)
|
|
.filter(key => key !== "arguments" && key !== "caller")
|
|
)
|
|
|
|
----------
|
|
const builtInSymbols = new Set(
|
|
/*#__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== 'arguments' && key !== 'caller')
|
|
);
|
|
|
|
########## 14
|
|
(/* @__PURE__ */ new Foo()).bar();
|
|
|
|
----------
|
|
(/* @__PURE__ */ new Foo()).bar();
|
|
|
|
########## 15
|
|
(/* @__PURE__ */ Foo()).bar();
|
|
|
|
----------
|
|
(/* @__PURE__ */ Foo()).bar();
|
|
|
|
########## 16
|
|
(/* @__PURE__ */ new Foo())['bar']();
|
|
|
|
----------
|
|
(/* @__PURE__ */ new Foo())['bar']();
|
|
|
|
########## 17
|
|
(/* @__PURE__ */ Foo())['bar']();
|
|
|
|
----------
|
|
(/* @__PURE__ */ Foo())['bar']();
|
|
|
|
########## 18
|
|
|
|
/* #__NO_SIDE_EFFECTS__ */
|
|
const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (
|
|
options,
|
|
extraOptions,
|
|
) => {
|
|
return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
|
|
};
|
|
|
|
----------
|
|
const defineSSRCustomElement = /* #__NO_SIDE_EFFECTS__ */ /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
|
|
return /* @__PURE__ */ defineCustomElement(options, extraOptions, hydrate);
|
|
};
|
|
|
|
########## 19
|
|
|
|
const defineSSRCustomElement = () => {
|
|
return /* @__PURE__ */ /* @__NO_SIDE_EFFECTS__ */ /* #__NO_SIDE_EFFECTS__ */ defineCustomElement(options, extraOptions, hydrate);
|
|
};
|
|
|
|
----------
|
|
const defineSSRCustomElement = () => {
|
|
return /* @__PURE__ */ /* @__NO_SIDE_EFFECTS__ */ /* #__NO_SIDE_EFFECTS__ */ defineCustomElement(options, extraOptions, hydrate);
|
|
};
|
|
|
|
########## 20
|
|
|
|
const Component = // #__PURE__
|
|
React.forwardRef((props, ref) => {});
|
|
|
|
----------
|
|
const Component = /* #__PURE__*/ React.forwardRef((props, ref) => {});
|
|
|
|
########## 21
|
|
|
|
function bar() {}
|
|
let bare = foo(bar);
|
|
|
|
let at_yes = /* @__PURE__ */ foo(bar);
|
|
let at_no = /* @__PURE__ */ foo(bar());
|
|
let new_at_yes = /* @__PURE__ */ new foo(bar);
|
|
let new_at_no = /* @__PURE__ */ new foo(bar());
|
|
|
|
let nospace_at_yes = /*@__PURE__*/ foo(bar);
|
|
let nospace_at_no = /*@__PURE__*/ foo(bar());
|
|
let nospace_new_at_yes = /*@__PURE__*/ new foo(bar);
|
|
let nospace_new_at_no = /*@__PURE__*/ new foo(bar());
|
|
|
|
let num_yes = /* #__PURE__ */ foo(bar);
|
|
let num_no = /* #__PURE__ */ foo(bar());
|
|
let new_num_yes = /* #__PURE__ */ new foo(bar);
|
|
let new_num_no = /* #__PURE__ */ new foo(bar());
|
|
|
|
let nospace_num_yes = /*#__PURE__*/ foo(bar);
|
|
let nospace_num_no = /*#__PURE__*/ foo(bar());
|
|
let nospace_new_num_yes = /*#__PURE__*/ new foo(bar);
|
|
let nospace_new_num_no = /*#__PURE__*/ new foo(bar());
|
|
|
|
let dot_yes = /* @__PURE__ */ foo(sideEffect()).dot(bar);
|
|
let dot_no = /* @__PURE__ */ foo(sideEffect()).dot(bar());
|
|
let new_dot_yes = /* @__PURE__ */ new foo(sideEffect()).dot(bar);
|
|
let new_dot_no = /* @__PURE__ */ new foo(sideEffect()).dot(bar());
|
|
|
|
let nested_yes = [1, /* @__PURE__ */ foo(bar), 2];
|
|
let nested_no = [1, /* @__PURE__ */ foo(bar()), 2];
|
|
let new_nested_yes = [1, /* @__PURE__ */ new foo(bar), 2];
|
|
let new_nested_no = [1, /* @__PURE__ */ new foo(bar()), 2];
|
|
|
|
let single_at_yes = // @__PURE__
|
|
foo(bar);
|
|
let single_at_no = // @__PURE__
|
|
foo(bar());
|
|
let new_single_at_yes = // @__PURE__
|
|
new foo(bar);
|
|
let new_single_at_no = // @__PURE__
|
|
new foo(bar());
|
|
|
|
let single_num_yes = // #__PURE__
|
|
foo(bar);
|
|
let single_num_no = // #__PURE__
|
|
foo(bar());
|
|
let new_single_num_yes = // #__PURE__
|
|
new foo(bar);
|
|
let new_single_num_no = // #__PURE__
|
|
new foo(bar());
|
|
|
|
let bad_no = /* __PURE__ */ foo(bar);
|
|
let new_bad_no = /* __PURE__ */ new foo(bar);
|
|
|
|
let parens_no = (/* @__PURE__ */ foo)(bar);
|
|
let new_parens_no = new (/* @__PURE__ */ foo)(bar);
|
|
|
|
let exp_no = /* @__PURE__ */ foo() ** foo();
|
|
let new_exp_no = /* @__PURE__ */ new foo() ** foo();
|
|
|
|
----------
|
|
function bar() {}
|
|
let bare = foo(bar);
|
|
let at_yes = /* @__PURE__ */ foo(bar);
|
|
let at_no = /* @__PURE__ */ foo(bar());
|
|
let new_at_yes = /* @__PURE__ */ new foo(bar);
|
|
let new_at_no = /* @__PURE__ */ new foo(bar());
|
|
let nospace_at_yes = /*@__PURE__*/ foo(bar);
|
|
let nospace_at_no = /*@__PURE__*/ foo(bar());
|
|
let nospace_new_at_yes = /*@__PURE__*/ new foo(bar);
|
|
let nospace_new_at_no = /*@__PURE__*/ new foo(bar());
|
|
let num_yes = /* #__PURE__ */ foo(bar);
|
|
let num_no = /* #__PURE__ */ foo(bar());
|
|
let new_num_yes = /* #__PURE__ */ new foo(bar);
|
|
let new_num_no = /* #__PURE__ */ new foo(bar());
|
|
let nospace_num_yes = /*#__PURE__*/ foo(bar);
|
|
let nospace_num_no = /*#__PURE__*/ foo(bar());
|
|
let nospace_new_num_yes = /*#__PURE__*/ new foo(bar);
|
|
let nospace_new_num_no = /*#__PURE__*/ new foo(bar());
|
|
let dot_yes = /* @__PURE__ */ foo(sideEffect()).dot(bar);
|
|
let dot_no = /* @__PURE__ */ foo(sideEffect()).dot(bar());
|
|
let new_dot_yes = /* @__PURE__ */ new foo(sideEffect()).dot(bar);
|
|
let new_dot_no = /* @__PURE__ */ new foo(sideEffect()).dot(bar());
|
|
let nested_yes = [
|
|
1,
|
|
/* @__PURE__ */ foo(bar),
|
|
2
|
|
];
|
|
let nested_no = [
|
|
1,
|
|
/* @__PURE__ */ foo(bar()),
|
|
2
|
|
];
|
|
let new_nested_yes = [
|
|
1,
|
|
/* @__PURE__ */ new foo(bar),
|
|
2
|
|
];
|
|
let new_nested_no = [
|
|
1,
|
|
/* @__PURE__ */ new foo(bar()),
|
|
2
|
|
];
|
|
let single_at_yes = /* @__PURE__*/ foo(bar);
|
|
let single_at_no = /* @__PURE__*/ foo(bar());
|
|
let new_single_at_yes = /* @__PURE__*/ new foo(bar);
|
|
let new_single_at_no = /* @__PURE__*/ new foo(bar());
|
|
let single_num_yes = /* #__PURE__*/ foo(bar);
|
|
let single_num_no = /* #__PURE__*/ foo(bar());
|
|
let new_single_num_yes = /* #__PURE__*/ new foo(bar);
|
|
let new_single_num_no = /* #__PURE__*/ new foo(bar());
|
|
let bad_no = foo(bar);
|
|
let new_bad_no = new foo(bar);
|
|
let parens_no = foo(bar);
|
|
let new_parens_no = new foo(bar);
|
|
let exp_no = /* @__PURE__ */ foo() ** foo();
|
|
let new_exp_no = /* @__PURE__ */ new foo() ** foo();
|