Skip to content

Commit a56e883

Browse files
author
Aleksander Katan
committed
Remove warn about hoisting
1 parent b37884b commit a56e883

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

packages/unplugin-typegpu/src/index.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,18 +172,6 @@ const typegpu: UnpluginInstance<Options, false> = createUnplugin(
172172
const { params, body, externalNames } = transpileFn(def);
173173
const isFunctionStatement = def.type === 'FunctionDeclaration';
174174

175-
if (
176-
isFunctionStatement &&
177-
name &&
178-
code
179-
.slice(0, def.start)
180-
.search(new RegExp(`(?<![\\w_.])${name}(?![\\w_])`)) !== -1
181-
) {
182-
console.warn(
183-
`File ${id}: function "${name}" might have been referenced before its usage. Function statements are no longer hoisted after being transformed by the plugin.`,
184-
);
185-
}
186-
187175
const metadata = `{
188176
v: ${FORMAT_VERSION},
189177
ast: ${embedJSON({ params, body, externalNames })},

packages/unplugin-typegpu/test/kernel-directive.test.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -407,21 +407,6 @@ describe('[ROLLUP] "kernel" directive', () => {
407407
`);
408408
});
409409

410-
it('throws when hoisting was meant to be used', async () => {
411-
const code = `\
412-
const sum = add(1, 2);
413-
function add(a, b) {
414-
'kernel';
415-
return a + b;
416-
};
417-
`;
418-
419-
await rollupTransform(code);
420-
expect(consoleWarnSpy).toHaveBeenCalledWith(
421-
`File virtual:code: function "add" might have been referenced before its usage. Function statements are no longer hoisted after being transformed by the plugin.`,
422-
);
423-
});
424-
425410
it('parses when no typegpu import', async () => {
426411
const code = `\
427412
function add(a, b) {

0 commit comments

Comments
 (0)