@danielx/civet 0.5.71 → 0.5.72
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/browser.js +52 -23
- package/dist/civet +0 -0
- package/dist/main.js +52 -23
- package/dist/main.mjs +52 -23
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -3700,6 +3700,20 @@ ${input.slice(result.pos)}
|
|
|
3700
3700
|
children: [start, [...ws, { ...sep, token: ", " }], [end, ...inc]]
|
|
3701
3701
|
};
|
|
3702
3702
|
});
|
|
3703
|
+
var SliceParameters$2 = $TS($S(Loc, __, $C(DotDot, DotDotDot), $Y($S(__, CloseBracket))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
3704
|
+
var l = $1;
|
|
3705
|
+
var ws = $2;
|
|
3706
|
+
const start = {
|
|
3707
|
+
$loc: l.$loc,
|
|
3708
|
+
token: "0"
|
|
3709
|
+
};
|
|
3710
|
+
return {
|
|
3711
|
+
type: "SliceParameters",
|
|
3712
|
+
start,
|
|
3713
|
+
end: void 0,
|
|
3714
|
+
children: [start, ws]
|
|
3715
|
+
};
|
|
3716
|
+
});
|
|
3703
3717
|
function SliceParameters(state) {
|
|
3704
3718
|
let eventData;
|
|
3705
3719
|
if (state.events) {
|
|
@@ -3711,12 +3725,12 @@ ${input.slice(result.pos)}
|
|
|
3711
3725
|
}
|
|
3712
3726
|
}
|
|
3713
3727
|
if (state.tokenize) {
|
|
3714
|
-
const result = $TOKEN("SliceParameters", state, SliceParameters$0(state) || SliceParameters$1(state));
|
|
3728
|
+
const result = $TOKEN("SliceParameters", state, SliceParameters$0(state) || SliceParameters$1(state) || SliceParameters$2(state));
|
|
3715
3729
|
if (state.events)
|
|
3716
3730
|
state.events.exit?.("SliceParameters", state, result, eventData);
|
|
3717
3731
|
return result;
|
|
3718
3732
|
} else {
|
|
3719
|
-
const result = SliceParameters$0(state) || SliceParameters$1(state);
|
|
3733
|
+
const result = SliceParameters$0(state) || SliceParameters$1(state) || SliceParameters$2(state);
|
|
3720
3734
|
if (state.events)
|
|
3721
3735
|
state.events.exit?.("SliceParameters", state, result, eventData);
|
|
3722
3736
|
return result;
|
|
@@ -5327,19 +5341,15 @@ ${input.slice(result.pos)}
|
|
|
5327
5341
|
};
|
|
5328
5342
|
return {
|
|
5329
5343
|
type: "ArrowFunction",
|
|
5330
|
-
children: [ref2, " => ", prefix, ref2]
|
|
5344
|
+
children: [ref2, " => ", prefix, ref2],
|
|
5345
|
+
ampersandBlock: true
|
|
5331
5346
|
};
|
|
5332
5347
|
}
|
|
5333
5348
|
const { ref } = rhs;
|
|
5334
|
-
if (!prefix) {
|
|
5335
|
-
return {
|
|
5336
|
-
type: "ArrowFunction",
|
|
5337
|
-
children: [ref, " => ", rhs]
|
|
5338
|
-
};
|
|
5339
|
-
}
|
|
5340
5349
|
return {
|
|
5341
5350
|
type: "ArrowFunction",
|
|
5342
|
-
children: [ref, " => ", prefix, rhs]
|
|
5351
|
+
children: [ref, " => ", prefix, rhs],
|
|
5352
|
+
ampersandBlock: true
|
|
5343
5353
|
};
|
|
5344
5354
|
});
|
|
5345
5355
|
function FunctionExpression(state) {
|
|
@@ -9579,7 +9589,8 @@ ${input.slice(result.pos)}
|
|
|
9579
9589
|
return {
|
|
9580
9590
|
type: "SwitchExpression",
|
|
9581
9591
|
children: ["(()=>{", e.children, "})()"],
|
|
9582
|
-
|
|
9592
|
+
expression: e.expression,
|
|
9593
|
+
caseBlock: e.caseBlock
|
|
9583
9594
|
};
|
|
9584
9595
|
});
|
|
9585
9596
|
function SwitchExpression(state) {
|
|
@@ -13776,7 +13787,7 @@ ${input.slice(result.pos)}
|
|
|
13776
13787
|
return result;
|
|
13777
13788
|
}
|
|
13778
13789
|
}
|
|
13779
|
-
var DotDot$0 = $
|
|
13790
|
+
var DotDot$0 = $TS($S($EXPECT($L114, fail, 'DotDot ".."'), $N($EXPECT($L4, fail, 'DotDot "."'))), function($skip, $loc, $0, $1, $2) {
|
|
13780
13791
|
return { $loc, token: $1 };
|
|
13781
13792
|
});
|
|
13782
13793
|
function DotDot(state) {
|
|
@@ -19616,6 +19627,9 @@ ${input.slice(result.pos)}
|
|
|
19616
19627
|
else
|
|
19617
19628
|
exp.children.push([" else {\n", indent, ref, ".push(undefined)\n", indent, "}"]);
|
|
19618
19629
|
return;
|
|
19630
|
+
case "PatternMatchingStatement":
|
|
19631
|
+
insertPush(exp.children[0][0], ref);
|
|
19632
|
+
return;
|
|
19619
19633
|
case "SwitchStatement":
|
|
19620
19634
|
insertPush(exp.children[2], ref);
|
|
19621
19635
|
return;
|
|
@@ -19703,6 +19717,9 @@ ${input.slice(result.pos)}
|
|
|
19703
19717
|
else
|
|
19704
19718
|
exp.children.push(["\n", indent, wrapWithReturn()]);
|
|
19705
19719
|
return;
|
|
19720
|
+
case "PatternMatchingStatement":
|
|
19721
|
+
insertReturn(exp.children[0][0]);
|
|
19722
|
+
return;
|
|
19706
19723
|
case "SwitchStatement":
|
|
19707
19724
|
insertSwitchReturns(exp);
|
|
19708
19725
|
return;
|
|
@@ -20630,7 +20647,7 @@ ${input.slice(result.pos)}
|
|
|
20630
20647
|
}
|
|
20631
20648
|
}
|
|
20632
20649
|
function processPatternMatching(statements) {
|
|
20633
|
-
gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement").forEach((s) => {
|
|
20650
|
+
gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement" || n.type === "SwitchExpression").forEach((s) => {
|
|
20634
20651
|
const { caseBlock } = s;
|
|
20635
20652
|
const { clauses } = caseBlock;
|
|
20636
20653
|
let errors = false;
|
|
@@ -20709,15 +20726,21 @@ ${input.slice(result.pos)}
|
|
|
20709
20726
|
block.children.push("}");
|
|
20710
20727
|
block.bare = false;
|
|
20711
20728
|
}
|
|
20712
|
-
|
|
20713
|
-
|
|
20729
|
+
if (i < l - 1)
|
|
20730
|
+
next.push("\n", "else ");
|
|
20731
|
+
prev.push(["", {
|
|
20714
20732
|
type: "IfStatement",
|
|
20715
|
-
children: ["if", condition, block,
|
|
20733
|
+
children: ["if", condition, block, next],
|
|
20716
20734
|
then: block,
|
|
20717
|
-
else:
|
|
20718
|
-
});
|
|
20735
|
+
else: next
|
|
20736
|
+
}]);
|
|
20719
20737
|
prev = next;
|
|
20720
20738
|
});
|
|
20739
|
+
if (module.config.implicitReturns && s.type === "SwitchExpression") {
|
|
20740
|
+
insertReturn(root[0]);
|
|
20741
|
+
root.unshift("(()=>{");
|
|
20742
|
+
root.push("})()");
|
|
20743
|
+
}
|
|
20721
20744
|
s.type = "PatternMatchingStatement";
|
|
20722
20745
|
s.children = [root];
|
|
20723
20746
|
});
|
|
@@ -20770,10 +20793,10 @@ ${input.slice(result.pos)}
|
|
|
20770
20793
|
addParentPointers(statements);
|
|
20771
20794
|
processPipelineExpressions(statements);
|
|
20772
20795
|
processAssignments(statements);
|
|
20796
|
+
processPatternMatching(statements);
|
|
20773
20797
|
processFunctions(statements);
|
|
20774
20798
|
processSwitchExpressions(statements);
|
|
20775
20799
|
processTryExpressions(statements);
|
|
20776
|
-
processPatternMatching(statements);
|
|
20777
20800
|
gatherRecursiveAll(statements, (n) => n.type === "IterationExpression").forEach((e) => expressionizeIteration(e));
|
|
20778
20801
|
checkSpliceRef(statements);
|
|
20779
20802
|
statements.unshift(...module.prelude);
|
|
@@ -20972,6 +20995,15 @@ ${input.slice(result.pos)}
|
|
|
20972
20995
|
module.gatherBindingCode = gatherBindingCode;
|
|
20973
20996
|
module.constructInvocation = function(fn, arg) {
|
|
20974
20997
|
const fnArr = [fn.leadingComment, fn.expr, fn.trailingComment];
|
|
20998
|
+
if (fn.expr.ampersandBlock) {
|
|
20999
|
+
const [ref, , prefix, rhs] = fn.expr.children;
|
|
21000
|
+
ref.type = "PipedExpression";
|
|
21001
|
+
ref.children = [module.makeLeftHandSideExpression(arg)];
|
|
21002
|
+
return {
|
|
21003
|
+
type: "UnwrappedExpression",
|
|
21004
|
+
children: [module.skipIfOnlyWS(fn.leadingComment), prefix, rhs, module.skipIfOnlyWS(fn.trailingComment)]
|
|
21005
|
+
};
|
|
21006
|
+
}
|
|
20975
21007
|
const lhs = module.makeLeftHandSideExpression(fn.expr);
|
|
20976
21008
|
let comment = module.skipIfOnlyWS(fn.trailingComment);
|
|
20977
21009
|
if (comment)
|
|
@@ -20981,10 +21013,7 @@ ${input.slice(result.pos)}
|
|
|
20981
21013
|
lhs.children.splice(1, 0, comment);
|
|
20982
21014
|
switch (arg.type) {
|
|
20983
21015
|
case "CommaExpression":
|
|
20984
|
-
arg =
|
|
20985
|
-
type: "ParenthesizedExpression",
|
|
20986
|
-
children: ["(", arg, ")"]
|
|
20987
|
-
};
|
|
21016
|
+
arg = module.makeLeftHandSideExpression(arg);
|
|
20988
21017
|
break;
|
|
20989
21018
|
}
|
|
20990
21019
|
return {
|
package/dist/civet
CHANGED
|
File without changes
|
package/dist/main.js
CHANGED
|
@@ -3699,6 +3699,20 @@ ${input.slice(result.pos)}
|
|
|
3699
3699
|
children: [start, [...ws, { ...sep, token: ", " }], [end, ...inc]]
|
|
3700
3700
|
};
|
|
3701
3701
|
});
|
|
3702
|
+
var SliceParameters$2 = $TS($S(Loc, __, $C(DotDot, DotDotDot), $Y($S(__, CloseBracket))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
3703
|
+
var l = $1;
|
|
3704
|
+
var ws = $2;
|
|
3705
|
+
const start = {
|
|
3706
|
+
$loc: l.$loc,
|
|
3707
|
+
token: "0"
|
|
3708
|
+
};
|
|
3709
|
+
return {
|
|
3710
|
+
type: "SliceParameters",
|
|
3711
|
+
start,
|
|
3712
|
+
end: void 0,
|
|
3713
|
+
children: [start, ws]
|
|
3714
|
+
};
|
|
3715
|
+
});
|
|
3702
3716
|
function SliceParameters(state) {
|
|
3703
3717
|
let eventData;
|
|
3704
3718
|
if (state.events) {
|
|
@@ -3710,12 +3724,12 @@ ${input.slice(result.pos)}
|
|
|
3710
3724
|
}
|
|
3711
3725
|
}
|
|
3712
3726
|
if (state.tokenize) {
|
|
3713
|
-
const result = $TOKEN("SliceParameters", state, SliceParameters$0(state) || SliceParameters$1(state));
|
|
3727
|
+
const result = $TOKEN("SliceParameters", state, SliceParameters$0(state) || SliceParameters$1(state) || SliceParameters$2(state));
|
|
3714
3728
|
if (state.events)
|
|
3715
3729
|
state.events.exit?.("SliceParameters", state, result, eventData);
|
|
3716
3730
|
return result;
|
|
3717
3731
|
} else {
|
|
3718
|
-
const result = SliceParameters$0(state) || SliceParameters$1(state);
|
|
3732
|
+
const result = SliceParameters$0(state) || SliceParameters$1(state) || SliceParameters$2(state);
|
|
3719
3733
|
if (state.events)
|
|
3720
3734
|
state.events.exit?.("SliceParameters", state, result, eventData);
|
|
3721
3735
|
return result;
|
|
@@ -5326,19 +5340,15 @@ ${input.slice(result.pos)}
|
|
|
5326
5340
|
};
|
|
5327
5341
|
return {
|
|
5328
5342
|
type: "ArrowFunction",
|
|
5329
|
-
children: [ref2, " => ", prefix, ref2]
|
|
5343
|
+
children: [ref2, " => ", prefix, ref2],
|
|
5344
|
+
ampersandBlock: true
|
|
5330
5345
|
};
|
|
5331
5346
|
}
|
|
5332
5347
|
const { ref } = rhs;
|
|
5333
|
-
if (!prefix) {
|
|
5334
|
-
return {
|
|
5335
|
-
type: "ArrowFunction",
|
|
5336
|
-
children: [ref, " => ", rhs]
|
|
5337
|
-
};
|
|
5338
|
-
}
|
|
5339
5348
|
return {
|
|
5340
5349
|
type: "ArrowFunction",
|
|
5341
|
-
children: [ref, " => ", prefix, rhs]
|
|
5350
|
+
children: [ref, " => ", prefix, rhs],
|
|
5351
|
+
ampersandBlock: true
|
|
5342
5352
|
};
|
|
5343
5353
|
});
|
|
5344
5354
|
function FunctionExpression(state) {
|
|
@@ -9578,7 +9588,8 @@ ${input.slice(result.pos)}
|
|
|
9578
9588
|
return {
|
|
9579
9589
|
type: "SwitchExpression",
|
|
9580
9590
|
children: ["(()=>{", e.children, "})()"],
|
|
9581
|
-
|
|
9591
|
+
expression: e.expression,
|
|
9592
|
+
caseBlock: e.caseBlock
|
|
9582
9593
|
};
|
|
9583
9594
|
});
|
|
9584
9595
|
function SwitchExpression(state) {
|
|
@@ -13775,7 +13786,7 @@ ${input.slice(result.pos)}
|
|
|
13775
13786
|
return result;
|
|
13776
13787
|
}
|
|
13777
13788
|
}
|
|
13778
|
-
var DotDot$0 = $
|
|
13789
|
+
var DotDot$0 = $TS($S($EXPECT($L114, fail, 'DotDot ".."'), $N($EXPECT($L4, fail, 'DotDot "."'))), function($skip, $loc, $0, $1, $2) {
|
|
13779
13790
|
return { $loc, token: $1 };
|
|
13780
13791
|
});
|
|
13781
13792
|
function DotDot(state) {
|
|
@@ -19615,6 +19626,9 @@ ${input.slice(result.pos)}
|
|
|
19615
19626
|
else
|
|
19616
19627
|
exp.children.push([" else {\n", indent, ref, ".push(undefined)\n", indent, "}"]);
|
|
19617
19628
|
return;
|
|
19629
|
+
case "PatternMatchingStatement":
|
|
19630
|
+
insertPush(exp.children[0][0], ref);
|
|
19631
|
+
return;
|
|
19618
19632
|
case "SwitchStatement":
|
|
19619
19633
|
insertPush(exp.children[2], ref);
|
|
19620
19634
|
return;
|
|
@@ -19702,6 +19716,9 @@ ${input.slice(result.pos)}
|
|
|
19702
19716
|
else
|
|
19703
19717
|
exp.children.push(["\n", indent, wrapWithReturn()]);
|
|
19704
19718
|
return;
|
|
19719
|
+
case "PatternMatchingStatement":
|
|
19720
|
+
insertReturn(exp.children[0][0]);
|
|
19721
|
+
return;
|
|
19705
19722
|
case "SwitchStatement":
|
|
19706
19723
|
insertSwitchReturns(exp);
|
|
19707
19724
|
return;
|
|
@@ -20629,7 +20646,7 @@ ${input.slice(result.pos)}
|
|
|
20629
20646
|
}
|
|
20630
20647
|
}
|
|
20631
20648
|
function processPatternMatching(statements) {
|
|
20632
|
-
gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement").forEach((s) => {
|
|
20649
|
+
gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement" || n.type === "SwitchExpression").forEach((s) => {
|
|
20633
20650
|
const { caseBlock } = s;
|
|
20634
20651
|
const { clauses } = caseBlock;
|
|
20635
20652
|
let errors = false;
|
|
@@ -20708,15 +20725,21 @@ ${input.slice(result.pos)}
|
|
|
20708
20725
|
block.children.push("}");
|
|
20709
20726
|
block.bare = false;
|
|
20710
20727
|
}
|
|
20711
|
-
|
|
20712
|
-
|
|
20728
|
+
if (i < l - 1)
|
|
20729
|
+
next.push("\n", "else ");
|
|
20730
|
+
prev.push(["", {
|
|
20713
20731
|
type: "IfStatement",
|
|
20714
|
-
children: ["if", condition, block,
|
|
20732
|
+
children: ["if", condition, block, next],
|
|
20715
20733
|
then: block,
|
|
20716
|
-
else:
|
|
20717
|
-
});
|
|
20734
|
+
else: next
|
|
20735
|
+
}]);
|
|
20718
20736
|
prev = next;
|
|
20719
20737
|
});
|
|
20738
|
+
if (module2.config.implicitReturns && s.type === "SwitchExpression") {
|
|
20739
|
+
insertReturn(root[0]);
|
|
20740
|
+
root.unshift("(()=>{");
|
|
20741
|
+
root.push("})()");
|
|
20742
|
+
}
|
|
20720
20743
|
s.type = "PatternMatchingStatement";
|
|
20721
20744
|
s.children = [root];
|
|
20722
20745
|
});
|
|
@@ -20769,10 +20792,10 @@ ${input.slice(result.pos)}
|
|
|
20769
20792
|
addParentPointers(statements);
|
|
20770
20793
|
processPipelineExpressions(statements);
|
|
20771
20794
|
processAssignments(statements);
|
|
20795
|
+
processPatternMatching(statements);
|
|
20772
20796
|
processFunctions(statements);
|
|
20773
20797
|
processSwitchExpressions(statements);
|
|
20774
20798
|
processTryExpressions(statements);
|
|
20775
|
-
processPatternMatching(statements);
|
|
20776
20799
|
gatherRecursiveAll(statements, (n) => n.type === "IterationExpression").forEach((e) => expressionizeIteration(e));
|
|
20777
20800
|
checkSpliceRef(statements);
|
|
20778
20801
|
statements.unshift(...module2.prelude);
|
|
@@ -20971,6 +20994,15 @@ ${input.slice(result.pos)}
|
|
|
20971
20994
|
module2.gatherBindingCode = gatherBindingCode;
|
|
20972
20995
|
module2.constructInvocation = function(fn, arg) {
|
|
20973
20996
|
const fnArr = [fn.leadingComment, fn.expr, fn.trailingComment];
|
|
20997
|
+
if (fn.expr.ampersandBlock) {
|
|
20998
|
+
const [ref, , prefix, rhs] = fn.expr.children;
|
|
20999
|
+
ref.type = "PipedExpression";
|
|
21000
|
+
ref.children = [module2.makeLeftHandSideExpression(arg)];
|
|
21001
|
+
return {
|
|
21002
|
+
type: "UnwrappedExpression",
|
|
21003
|
+
children: [module2.skipIfOnlyWS(fn.leadingComment), prefix, rhs, module2.skipIfOnlyWS(fn.trailingComment)]
|
|
21004
|
+
};
|
|
21005
|
+
}
|
|
20974
21006
|
const lhs = module2.makeLeftHandSideExpression(fn.expr);
|
|
20975
21007
|
let comment = module2.skipIfOnlyWS(fn.trailingComment);
|
|
20976
21008
|
if (comment)
|
|
@@ -20980,10 +21012,7 @@ ${input.slice(result.pos)}
|
|
|
20980
21012
|
lhs.children.splice(1, 0, comment);
|
|
20981
21013
|
switch (arg.type) {
|
|
20982
21014
|
case "CommaExpression":
|
|
20983
|
-
arg =
|
|
20984
|
-
type: "ParenthesizedExpression",
|
|
20985
|
-
children: ["(", arg, ")"]
|
|
20986
|
-
};
|
|
21015
|
+
arg = module2.makeLeftHandSideExpression(arg);
|
|
20987
21016
|
break;
|
|
20988
21017
|
}
|
|
20989
21018
|
return {
|
package/dist/main.mjs
CHANGED
|
@@ -3697,6 +3697,20 @@ ${input.slice(result.pos)}
|
|
|
3697
3697
|
children: [start, [...ws, { ...sep, token: ", " }], [end, ...inc]]
|
|
3698
3698
|
};
|
|
3699
3699
|
});
|
|
3700
|
+
var SliceParameters$2 = $TS($S(Loc, __, $C(DotDot, DotDotDot), $Y($S(__, CloseBracket))), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
3701
|
+
var l = $1;
|
|
3702
|
+
var ws = $2;
|
|
3703
|
+
const start = {
|
|
3704
|
+
$loc: l.$loc,
|
|
3705
|
+
token: "0"
|
|
3706
|
+
};
|
|
3707
|
+
return {
|
|
3708
|
+
type: "SliceParameters",
|
|
3709
|
+
start,
|
|
3710
|
+
end: void 0,
|
|
3711
|
+
children: [start, ws]
|
|
3712
|
+
};
|
|
3713
|
+
});
|
|
3700
3714
|
function SliceParameters(state) {
|
|
3701
3715
|
let eventData;
|
|
3702
3716
|
if (state.events) {
|
|
@@ -3708,12 +3722,12 @@ ${input.slice(result.pos)}
|
|
|
3708
3722
|
}
|
|
3709
3723
|
}
|
|
3710
3724
|
if (state.tokenize) {
|
|
3711
|
-
const result = $TOKEN("SliceParameters", state, SliceParameters$0(state) || SliceParameters$1(state));
|
|
3725
|
+
const result = $TOKEN("SliceParameters", state, SliceParameters$0(state) || SliceParameters$1(state) || SliceParameters$2(state));
|
|
3712
3726
|
if (state.events)
|
|
3713
3727
|
state.events.exit?.("SliceParameters", state, result, eventData);
|
|
3714
3728
|
return result;
|
|
3715
3729
|
} else {
|
|
3716
|
-
const result = SliceParameters$0(state) || SliceParameters$1(state);
|
|
3730
|
+
const result = SliceParameters$0(state) || SliceParameters$1(state) || SliceParameters$2(state);
|
|
3717
3731
|
if (state.events)
|
|
3718
3732
|
state.events.exit?.("SliceParameters", state, result, eventData);
|
|
3719
3733
|
return result;
|
|
@@ -5324,19 +5338,15 @@ ${input.slice(result.pos)}
|
|
|
5324
5338
|
};
|
|
5325
5339
|
return {
|
|
5326
5340
|
type: "ArrowFunction",
|
|
5327
|
-
children: [ref2, " => ", prefix, ref2]
|
|
5341
|
+
children: [ref2, " => ", prefix, ref2],
|
|
5342
|
+
ampersandBlock: true
|
|
5328
5343
|
};
|
|
5329
5344
|
}
|
|
5330
5345
|
const { ref } = rhs;
|
|
5331
|
-
if (!prefix) {
|
|
5332
|
-
return {
|
|
5333
|
-
type: "ArrowFunction",
|
|
5334
|
-
children: [ref, " => ", rhs]
|
|
5335
|
-
};
|
|
5336
|
-
}
|
|
5337
5346
|
return {
|
|
5338
5347
|
type: "ArrowFunction",
|
|
5339
|
-
children: [ref, " => ", prefix, rhs]
|
|
5348
|
+
children: [ref, " => ", prefix, rhs],
|
|
5349
|
+
ampersandBlock: true
|
|
5340
5350
|
};
|
|
5341
5351
|
});
|
|
5342
5352
|
function FunctionExpression(state) {
|
|
@@ -9576,7 +9586,8 @@ ${input.slice(result.pos)}
|
|
|
9576
9586
|
return {
|
|
9577
9587
|
type: "SwitchExpression",
|
|
9578
9588
|
children: ["(()=>{", e.children, "})()"],
|
|
9579
|
-
|
|
9589
|
+
expression: e.expression,
|
|
9590
|
+
caseBlock: e.caseBlock
|
|
9580
9591
|
};
|
|
9581
9592
|
});
|
|
9582
9593
|
function SwitchExpression(state) {
|
|
@@ -13773,7 +13784,7 @@ ${input.slice(result.pos)}
|
|
|
13773
13784
|
return result;
|
|
13774
13785
|
}
|
|
13775
13786
|
}
|
|
13776
|
-
var DotDot$0 = $
|
|
13787
|
+
var DotDot$0 = $TS($S($EXPECT($L114, fail, 'DotDot ".."'), $N($EXPECT($L4, fail, 'DotDot "."'))), function($skip, $loc, $0, $1, $2) {
|
|
13777
13788
|
return { $loc, token: $1 };
|
|
13778
13789
|
});
|
|
13779
13790
|
function DotDot(state) {
|
|
@@ -19613,6 +19624,9 @@ ${input.slice(result.pos)}
|
|
|
19613
19624
|
else
|
|
19614
19625
|
exp.children.push([" else {\n", indent, ref, ".push(undefined)\n", indent, "}"]);
|
|
19615
19626
|
return;
|
|
19627
|
+
case "PatternMatchingStatement":
|
|
19628
|
+
insertPush(exp.children[0][0], ref);
|
|
19629
|
+
return;
|
|
19616
19630
|
case "SwitchStatement":
|
|
19617
19631
|
insertPush(exp.children[2], ref);
|
|
19618
19632
|
return;
|
|
@@ -19700,6 +19714,9 @@ ${input.slice(result.pos)}
|
|
|
19700
19714
|
else
|
|
19701
19715
|
exp.children.push(["\n", indent, wrapWithReturn()]);
|
|
19702
19716
|
return;
|
|
19717
|
+
case "PatternMatchingStatement":
|
|
19718
|
+
insertReturn(exp.children[0][0]);
|
|
19719
|
+
return;
|
|
19703
19720
|
case "SwitchStatement":
|
|
19704
19721
|
insertSwitchReturns(exp);
|
|
19705
19722
|
return;
|
|
@@ -20627,7 +20644,7 @@ ${input.slice(result.pos)}
|
|
|
20627
20644
|
}
|
|
20628
20645
|
}
|
|
20629
20646
|
function processPatternMatching(statements) {
|
|
20630
|
-
gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement").forEach((s) => {
|
|
20647
|
+
gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement" || n.type === "SwitchExpression").forEach((s) => {
|
|
20631
20648
|
const { caseBlock } = s;
|
|
20632
20649
|
const { clauses } = caseBlock;
|
|
20633
20650
|
let errors = false;
|
|
@@ -20706,15 +20723,21 @@ ${input.slice(result.pos)}
|
|
|
20706
20723
|
block.children.push("}");
|
|
20707
20724
|
block.bare = false;
|
|
20708
20725
|
}
|
|
20709
|
-
|
|
20710
|
-
|
|
20726
|
+
if (i < l - 1)
|
|
20727
|
+
next.push("\n", "else ");
|
|
20728
|
+
prev.push(["", {
|
|
20711
20729
|
type: "IfStatement",
|
|
20712
|
-
children: ["if", condition, block,
|
|
20730
|
+
children: ["if", condition, block, next],
|
|
20713
20731
|
then: block,
|
|
20714
|
-
else:
|
|
20715
|
-
});
|
|
20732
|
+
else: next
|
|
20733
|
+
}]);
|
|
20716
20734
|
prev = next;
|
|
20717
20735
|
});
|
|
20736
|
+
if (module.config.implicitReturns && s.type === "SwitchExpression") {
|
|
20737
|
+
insertReturn(root[0]);
|
|
20738
|
+
root.unshift("(()=>{");
|
|
20739
|
+
root.push("})()");
|
|
20740
|
+
}
|
|
20718
20741
|
s.type = "PatternMatchingStatement";
|
|
20719
20742
|
s.children = [root];
|
|
20720
20743
|
});
|
|
@@ -20767,10 +20790,10 @@ ${input.slice(result.pos)}
|
|
|
20767
20790
|
addParentPointers(statements);
|
|
20768
20791
|
processPipelineExpressions(statements);
|
|
20769
20792
|
processAssignments(statements);
|
|
20793
|
+
processPatternMatching(statements);
|
|
20770
20794
|
processFunctions(statements);
|
|
20771
20795
|
processSwitchExpressions(statements);
|
|
20772
20796
|
processTryExpressions(statements);
|
|
20773
|
-
processPatternMatching(statements);
|
|
20774
20797
|
gatherRecursiveAll(statements, (n) => n.type === "IterationExpression").forEach((e) => expressionizeIteration(e));
|
|
20775
20798
|
checkSpliceRef(statements);
|
|
20776
20799
|
statements.unshift(...module.prelude);
|
|
@@ -20969,6 +20992,15 @@ ${input.slice(result.pos)}
|
|
|
20969
20992
|
module.gatherBindingCode = gatherBindingCode;
|
|
20970
20993
|
module.constructInvocation = function(fn, arg) {
|
|
20971
20994
|
const fnArr = [fn.leadingComment, fn.expr, fn.trailingComment];
|
|
20995
|
+
if (fn.expr.ampersandBlock) {
|
|
20996
|
+
const [ref, , prefix, rhs] = fn.expr.children;
|
|
20997
|
+
ref.type = "PipedExpression";
|
|
20998
|
+
ref.children = [module.makeLeftHandSideExpression(arg)];
|
|
20999
|
+
return {
|
|
21000
|
+
type: "UnwrappedExpression",
|
|
21001
|
+
children: [module.skipIfOnlyWS(fn.leadingComment), prefix, rhs, module.skipIfOnlyWS(fn.trailingComment)]
|
|
21002
|
+
};
|
|
21003
|
+
}
|
|
20972
21004
|
const lhs = module.makeLeftHandSideExpression(fn.expr);
|
|
20973
21005
|
let comment = module.skipIfOnlyWS(fn.trailingComment);
|
|
20974
21006
|
if (comment)
|
|
@@ -20978,10 +21010,7 @@ ${input.slice(result.pos)}
|
|
|
20978
21010
|
lhs.children.splice(1, 0, comment);
|
|
20979
21011
|
switch (arg.type) {
|
|
20980
21012
|
case "CommaExpression":
|
|
20981
|
-
arg =
|
|
20982
|
-
type: "ParenthesizedExpression",
|
|
20983
|
-
children: ["(", arg, ")"]
|
|
20984
|
-
};
|
|
21013
|
+
arg = module.makeLeftHandSideExpression(arg);
|
|
20985
21014
|
break;
|
|
20986
21015
|
}
|
|
20987
21016
|
return {
|