marko 6.0.134 → 6.0.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/translator/index.js
CHANGED
|
@@ -4399,23 +4399,20 @@ function replaceAssignedNode(node) {
|
|
|
4399
4399
|
switch (node.left.type) {
|
|
4400
4400
|
case "Identifier": {
|
|
4401
4401
|
const { extra } = node.left;
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
node.operator
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
) || extra?.assignment && withLeadingComment(node.right, getDebugName(extra.assignment));
|
|
4417
|
-
}
|
|
4418
|
-
break;
|
|
4402
|
+
return isAssignedBindingExtra(extra) && getBuildAssignment(extra)?.(
|
|
4403
|
+
extra.section,
|
|
4404
|
+
node.operator === "=" ? node.right : import_compiler22.types.binaryExpression(
|
|
4405
|
+
node.operator.slice(
|
|
4406
|
+
0,
|
|
4407
|
+
-1
|
|
4408
|
+
),
|
|
4409
|
+
createScopeReadExpression(
|
|
4410
|
+
extra.assignment,
|
|
4411
|
+
extra.section
|
|
4412
|
+
),
|
|
4413
|
+
node.right
|
|
4414
|
+
)
|
|
4415
|
+
) || extra?.assignment && withLeadingComment(node.right, getDebugName(extra.assignment));
|
|
4419
4416
|
}
|
|
4420
4417
|
case "ArrayPattern":
|
|
4421
4418
|
case "ObjectPattern": {
|
|
@@ -4443,7 +4440,7 @@ function replaceAssignedNode(node) {
|
|
|
4443
4440
|
(params ||= []).push(import_compiler22.types.identifier(id.name));
|
|
4444
4441
|
}
|
|
4445
4442
|
});
|
|
4446
|
-
if (assignments) {
|
|
4443
|
+
if (assignments || params) {
|
|
4447
4444
|
const resultId = generateUid("result");
|
|
4448
4445
|
return import_compiler22.types.callExpression(
|
|
4449
4446
|
import_compiler22.types.arrowFunctionExpression(
|
|
@@ -4454,7 +4451,7 @@ function replaceAssignedNode(node) {
|
|
|
4454
4451
|
node.left,
|
|
4455
4452
|
import_compiler22.types.identifier(resultId)
|
|
4456
4453
|
),
|
|
4457
|
-
...assignments,
|
|
4454
|
+
...assignments || [],
|
|
4458
4455
|
import_compiler22.types.identifier(resultId)
|
|
4459
4456
|
])
|
|
4460
4457
|
),
|
|
@@ -8485,8 +8482,10 @@ var kIsInvoked = Symbol("hoist is invoked");
|
|
|
8485
8482
|
var kBranchSerializeReason = Symbol("branch serialize reason");
|
|
8486
8483
|
var [getBindings] = createProgramState(() => /* @__PURE__ */ new Set());
|
|
8487
8484
|
var [getNextBindingId, setNextBindingId] = createProgramState(() => 0);
|
|
8488
|
-
function createBinding(name2, type,
|
|
8485
|
+
function createBinding(name2, type, refSection, upstreamAlias, property, excludeProperties, loc = null, refDeclared = false) {
|
|
8489
8486
|
const id = getNextBindingId();
|
|
8487
|
+
const section = upstreamAlias ? upstreamAlias.section : refSection;
|
|
8488
|
+
const declared = refDeclared && refSection === section;
|
|
8490
8489
|
const binding = {
|
|
8491
8490
|
id,
|
|
8492
8491
|
name: name2,
|
|
@@ -8581,6 +8580,7 @@ function trackDomVarReferences(tag, binding) {
|
|
|
8581
8580
|
function trackVarReferences(tag, type, upstreamAlias) {
|
|
8582
8581
|
const tagVar = tag.node.var;
|
|
8583
8582
|
if (tagVar) {
|
|
8583
|
+
const section = getOrCreateSection(tag);
|
|
8584
8584
|
let canonicalUpstreamAlias = upstreamAlias && getCanonicalBinding(upstreamAlias);
|
|
8585
8585
|
if (canonicalUpstreamAlias) {
|
|
8586
8586
|
const { excludeProperties } = canonicalUpstreamAlias;
|
|
@@ -8591,7 +8591,7 @@ function trackVarReferences(tag, type, upstreamAlias) {
|
|
|
8591
8591
|
tagVar,
|
|
8592
8592
|
canonicalUpstreamAlias.type,
|
|
8593
8593
|
tag.scope,
|
|
8594
|
-
|
|
8594
|
+
section,
|
|
8595
8595
|
canonicalUpstreamAlias,
|
|
8596
8596
|
void 0,
|
|
8597
8597
|
excludeProperties
|
|
@@ -8602,7 +8602,7 @@ function trackVarReferences(tag, type, upstreamAlias) {
|
|
|
8602
8602
|
tagVar,
|
|
8603
8603
|
type,
|
|
8604
8604
|
tag.scope,
|
|
8605
|
-
|
|
8605
|
+
section,
|
|
8606
8606
|
void 0,
|
|
8607
8607
|
void 0,
|
|
8608
8608
|
void 0
|
|
@@ -90,7 +90,7 @@ declare module "@marko/compiler/dist/types" {
|
|
|
90
90
|
interface FunctionExpressionExtra extends FunctionExtra {
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
export declare function createBinding(name: string, type: Binding["type"],
|
|
93
|
+
export declare function createBinding(name: string, type: Binding["type"], refSection: Section, upstreamAlias?: Binding["upstreamAlias"], property?: string, excludeProperties?: Opt<string>, loc?: t.SourceLocation | null, refDeclared?: boolean): Binding;
|
|
94
94
|
export declare function getOrCreatePropertyAlias(binding: Binding, property: string): Binding;
|
|
95
95
|
export declare function trackDomVarReferences(tag: t.NodePath<t.MarkoTag>, binding: Binding): Binding | undefined;
|
|
96
96
|
export declare function trackVarReferences(tag: t.NodePath<t.MarkoTag>, type: BindingType, upstreamAlias?: Binding["upstreamAlias"]): Binding | undefined;
|