remove unused

parallelize-async-work
ComputerGuy 5 days ago
parent c8cc9319be
commit 464d7b6eab

@ -97,7 +97,6 @@ export interface ParallelizedChunk {
/** index in instance body */
position: number;
bindings: Binding[];
type: 'promise_all' | 'all';
}
export type Context = import('zimmerframe').Context<AST.SvelteNode, ClientTransformState>;

@ -152,17 +152,12 @@ export function Program(node, context) {
chunk.position + offset,
0,
b.declaration(chunk.kind, [
b.declarator(
declarator.id,
chunk.type === 'promise_all'
? b.await(declarator.init)
: b.call(b.await(b.call('$.save', declarator.init)))
)
b.declarator(declarator.id, b.call(b.await(b.call('$.save', declarator.init))))
])
);
} else {
const pattern = b.array_pattern(chunk.declarators.map(({ id }) => id));
const init = b.call(`$.${chunk.type}`, ...chunk.declarators.map(({ init }) => init));
const init = b.call(`$.all`, ...chunk.declarators.map(({ init }) => init));
body.splice(
chunk.position + offset,
0,

@ -71,8 +71,7 @@ export function VariableDeclaration(node, context) {
];
if (
context.state.current_parallelized_chunk &&
context.state.current_parallelized_chunk.kind === node.kind &&
context.state.current_parallelized_chunk.type === 'all'
context.state.current_parallelized_chunk.kind === node.kind
) {
context.state.current_parallelized_chunk.declarators.push(...declarators);
context.state.current_parallelized_chunk.bindings.push(...bindings);
@ -85,8 +84,7 @@ export function VariableDeclaration(node, context) {
kind: node.kind,
declarators,
position: /** @type {Program} */ (context.path.at(-1)).body.indexOf(node),
bindings,
type: 'all'
bindings
};
context.state.current_parallelized_chunk = chunk;
context.state.parallelized_chunks.push(chunk);
@ -268,8 +266,6 @@ export function VariableDeclaration(node, context) {
...context.state.scope.get_bindings(declarator)
]);
}
// const type = parallelize ? (dev ? 'promise_all' : 'all') : null;
const type = 'all';
/** @type {VariableDeclarator[]} */
const derived_declarators = [];
@ -383,8 +379,7 @@ export function VariableDeclaration(node, context) {
}));
if (
context.state.current_parallelized_chunk &&
context.state.current_parallelized_chunk.kind === node.kind &&
context.state.current_parallelized_chunk.type === type
context.state.current_parallelized_chunk.kind === node.kind
) {
context.state.current_parallelized_chunk.declarators.push(...declarators);
context.state.current_parallelized_chunk.bindings.push(...bindings);
@ -397,8 +392,7 @@ export function VariableDeclaration(node, context) {
kind: node.kind,
declarators,
position: /** @type {Program} */ (context.path.at(-1)).body.indexOf(node),
bindings,
type: /** @type {ParallelizedChunk['type']} */ (type)
bindings
};
context.state.current_parallelized_chunk = chunk;
context.state.parallelized_chunks.push(chunk);

@ -102,7 +102,6 @@ export {
all,
async_body,
for_await_track_reactivity_loss,
promise_all,
save,
track_reactivity_loss
} from './reactivity/async.js';

@ -202,5 +202,3 @@ export function all(...promises) {
)
);
}
export const promise_all = Promise.all;

Loading…
Cancel
Save