parallelize-async-work
ComputerGuy 6 days ago
parent 464d7b6eab
commit 7788c30087

@ -1,12 +1,12 @@
/** @import { Identifier, Node } from 'estree' */ /** @import { Identifier, Node } from 'estree' */
/** @import { Context } from '../types' */ /** @import { ComponentContext } from '../types' */
import is_reference from 'is-reference'; import is_reference from 'is-reference';
import * as b from '#compiler/builders'; import * as b from '#compiler/builders';
import { build_getter } from '../utils.js'; import { build_getter } from '../utils.js';
/** /**
* @param {Identifier} node * @param {Identifier} node
* @param {Context} context * @param {ComponentContext} context
*/ */
export function Identifier(node, context) { export function Identifier(node, context) {
const parent = /** @type {Node} */ (context.path.at(-1)); const parent = /** @type {Node} */ (context.path.at(-1));
@ -35,6 +35,9 @@ export function Identifier(node, context) {
return b.id('$$props'); return b.id('$$props');
} }
} }
if (binding && context.state.current_parallelized_chunk?.bindings?.includes(binding)) {
context.state.current_parallelized_chunk = null;
}
return build_getter(node, context.state); return build_getter(node, context.state);
} }

@ -53,7 +53,10 @@ export function VariableDeclaration(node, context) {
init.argument, init.argument,
context.state.scope, context.state.scope,
context.state.analysis, context.state.analysis,
context.state.current_parallelized_chunk?.bindings ?? [] [
...(context.state.current_parallelized_chunk?.bindings ?? []),
...context.state.scope.get_bindings(declarator)
]
); );
if (parallelize) { if (parallelize) {
const bindings = context.state.scope.get_bindings(declarator); const bindings = context.state.scope.get_bindings(declarator);

Loading…
Cancel
Save