@danielx/civet 0.5.80 → 0.5.82
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 +372 -220
- package/dist/main.js +372 -220
- package/dist/main.mjs +372 -220
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -26,6 +26,123 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
|
|
29
|
+
// source/lib.js
|
|
30
|
+
var require_lib = __commonJS({
|
|
31
|
+
"source/lib.js"(exports, module2) {
|
|
32
|
+
"use strict";
|
|
33
|
+
function clone(node) {
|
|
34
|
+
removeParentPointers(node);
|
|
35
|
+
return deepCopy(node);
|
|
36
|
+
}
|
|
37
|
+
function deepCopy(node) {
|
|
38
|
+
if (node == null)
|
|
39
|
+
return node;
|
|
40
|
+
if (typeof node !== "object")
|
|
41
|
+
return node;
|
|
42
|
+
if (Array.isArray(node)) {
|
|
43
|
+
return node.map(deepCopy);
|
|
44
|
+
}
|
|
45
|
+
return Object.fromEntries(
|
|
46
|
+
Object.entries(node).map(([key, value]) => {
|
|
47
|
+
return [key, deepCopy(value)];
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function removeParentPointers(node) {
|
|
52
|
+
if (node == null)
|
|
53
|
+
return;
|
|
54
|
+
if (typeof node !== "object")
|
|
55
|
+
return;
|
|
56
|
+
if (Array.isArray(node)) {
|
|
57
|
+
for (const child of node) {
|
|
58
|
+
removeParentPointers(child);
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
node.parent = null;
|
|
63
|
+
if (node.children) {
|
|
64
|
+
for (const child of node.children) {
|
|
65
|
+
removeParentPointers(child);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function gatherNodes(node, predicate) {
|
|
70
|
+
if (node == null)
|
|
71
|
+
return [];
|
|
72
|
+
if (Array.isArray(node)) {
|
|
73
|
+
return node.flatMap((n) => gatherNodes(n, predicate));
|
|
74
|
+
}
|
|
75
|
+
if (predicate(node)) {
|
|
76
|
+
return [node];
|
|
77
|
+
}
|
|
78
|
+
switch (node.type) {
|
|
79
|
+
case "BlockStatement":
|
|
80
|
+
return [];
|
|
81
|
+
case "ForStatement":
|
|
82
|
+
const isDec = node.declaration?.type === "Declaration";
|
|
83
|
+
return node.children.flatMap((n) => {
|
|
84
|
+
if (isDec && n === node.declaration)
|
|
85
|
+
return [];
|
|
86
|
+
return gatherNodes(n, predicate);
|
|
87
|
+
});
|
|
88
|
+
default:
|
|
89
|
+
return gatherNodes(node.children, predicate);
|
|
90
|
+
}
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
function gatherRecursive(node, predicate, skipPredicate) {
|
|
94
|
+
if (node == null)
|
|
95
|
+
return [];
|
|
96
|
+
if (Array.isArray(node)) {
|
|
97
|
+
return node.flatMap((n) => gatherRecursive(n, predicate, skipPredicate));
|
|
98
|
+
}
|
|
99
|
+
if (skipPredicate?.(node))
|
|
100
|
+
return [];
|
|
101
|
+
if (predicate(node)) {
|
|
102
|
+
return [node];
|
|
103
|
+
}
|
|
104
|
+
return gatherRecursive(node.children, predicate, skipPredicate);
|
|
105
|
+
}
|
|
106
|
+
function gatherRecursiveAll(node, predicate) {
|
|
107
|
+
if (node == null)
|
|
108
|
+
return [];
|
|
109
|
+
if (Array.isArray(node)) {
|
|
110
|
+
return node.flatMap((n) => gatherRecursiveAll(n, predicate));
|
|
111
|
+
}
|
|
112
|
+
const nodes = gatherRecursiveAll(node.children, predicate);
|
|
113
|
+
if (predicate(node)) {
|
|
114
|
+
nodes.push(node);
|
|
115
|
+
}
|
|
116
|
+
return nodes;
|
|
117
|
+
}
|
|
118
|
+
function hasAwait(exp) {
|
|
119
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
120
|
+
}
|
|
121
|
+
function hasYield(exp) {
|
|
122
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Yield").length > 0;
|
|
123
|
+
}
|
|
124
|
+
function isFunction(node) {
|
|
125
|
+
const { type } = node;
|
|
126
|
+
return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
|
|
127
|
+
}
|
|
128
|
+
function gatherRecursiveWithinFunction(node, predicate) {
|
|
129
|
+
return gatherRecursive(node, predicate, isFunction);
|
|
130
|
+
}
|
|
131
|
+
module2.exports = {
|
|
132
|
+
clone,
|
|
133
|
+
deepCopy,
|
|
134
|
+
gatherNodes,
|
|
135
|
+
gatherRecursive,
|
|
136
|
+
gatherRecursiveAll,
|
|
137
|
+
gatherRecursiveWithinFunction,
|
|
138
|
+
hasAwait,
|
|
139
|
+
hasYield,
|
|
140
|
+
isFunction,
|
|
141
|
+
removeParentPointers
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
29
146
|
// source/parser.hera
|
|
30
147
|
var require_parser = __commonJS({
|
|
31
148
|
"source/parser.hera"(exports, module2) {
|
|
@@ -468,7 +585,6 @@ ${input.slice(result.pos)}
|
|
|
468
585
|
YieldExpression,
|
|
469
586
|
YieldTail,
|
|
470
587
|
ArrowFunction,
|
|
471
|
-
ArrowFunctionTail,
|
|
472
588
|
FatArrow,
|
|
473
589
|
FatArrowBody,
|
|
474
590
|
ConditionalExpression,
|
|
@@ -565,6 +681,7 @@ ${input.slice(result.pos)}
|
|
|
565
681
|
FunctionDeclaration,
|
|
566
682
|
FunctionSignature,
|
|
567
683
|
FunctionExpression,
|
|
684
|
+
AmpersandFunctionExpression,
|
|
568
685
|
OperatorDeclaration,
|
|
569
686
|
OperatorSignature,
|
|
570
687
|
AmpersandBlockRHS,
|
|
@@ -1879,8 +1996,8 @@ ${input.slice(result.pos)}
|
|
|
1879
1996
|
return module2.insertTrimmingSpace($1, "");
|
|
1880
1997
|
});
|
|
1881
1998
|
var ArgumentList$2 = NestedArgumentList;
|
|
1882
|
-
var ArgumentList$3 = $TS($S($
|
|
1883
|
-
return [...$1, $2, ...$3];
|
|
1999
|
+
var ArgumentList$3 = $TS($S($E(_), ArgumentPart, $Q($S(CommaDelimiter, $E(_), ArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
2000
|
+
return [...$1 || [], $2, ...$3];
|
|
1884
2001
|
});
|
|
1885
2002
|
function ArgumentList(state) {
|
|
1886
2003
|
let eventData;
|
|
@@ -1909,8 +2026,8 @@ ${input.slice(result.pos)}
|
|
|
1909
2026
|
return module2.insertTrimmingSpace($1, "");
|
|
1910
2027
|
});
|
|
1911
2028
|
var NonPipelineArgumentList$2 = NestedArgumentList;
|
|
1912
|
-
var NonPipelineArgumentList$3 = $TS($S($
|
|
1913
|
-
return [...$1, $2, ...$3];
|
|
2029
|
+
var NonPipelineArgumentList$3 = $TS($S($E(_), NonPipelineArgumentPart, $Q($S(CommaDelimiter, $E(_), NonPipelineArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
2030
|
+
return [...$1 || [], $2, ...$3];
|
|
1914
2031
|
});
|
|
1915
2032
|
function NonPipelineArgumentList(state) {
|
|
1916
2033
|
let eventData;
|
|
@@ -1985,7 +2102,7 @@ ${input.slice(result.pos)}
|
|
|
1985
2102
|
return result;
|
|
1986
2103
|
}
|
|
1987
2104
|
}
|
|
1988
|
-
var SingleLineArgumentExpressions$0 = $S($
|
|
2105
|
+
var SingleLineArgumentExpressions$0 = $S($E(_), ArgumentPart, $Q($S($E(_), Comma, $E(_), ArgumentPart)));
|
|
1989
2106
|
function SingleLineArgumentExpressions(state) {
|
|
1990
2107
|
let eventData;
|
|
1991
2108
|
if (state.events) {
|
|
@@ -2344,10 +2461,10 @@ ${input.slice(result.pos)}
|
|
|
2344
2461
|
return result;
|
|
2345
2462
|
}
|
|
2346
2463
|
}
|
|
2347
|
-
var SingleLineAssignmentExpression$0 = $TS($S($
|
|
2464
|
+
var SingleLineAssignmentExpression$0 = $TS($S($E(_), AssignmentExpressionTail), function($skip, $loc, $0, $1, $2) {
|
|
2348
2465
|
var ws = $1;
|
|
2349
2466
|
var tail = $2;
|
|
2350
|
-
if (ws
|
|
2467
|
+
if (ws?.length) {
|
|
2351
2468
|
if (tail.children && tail.type !== "IterationExpression") {
|
|
2352
2469
|
return {
|
|
2353
2470
|
...tail,
|
|
@@ -2464,7 +2581,7 @@ ${input.slice(result.pos)}
|
|
|
2464
2581
|
}
|
|
2465
2582
|
}
|
|
2466
2583
|
var YieldTail$0 = $Y(EOS);
|
|
2467
|
-
var YieldTail$1 = $S($E($S($
|
|
2584
|
+
var YieldTail$1 = $S($E($S($E(_), Star)), AssignmentExpression);
|
|
2468
2585
|
function YieldTail(state) {
|
|
2469
2586
|
let eventData;
|
|
2470
2587
|
if (state.events) {
|
|
@@ -2487,53 +2604,36 @@ ${input.slice(result.pos)}
|
|
|
2487
2604
|
return result;
|
|
2488
2605
|
}
|
|
2489
2606
|
}
|
|
2490
|
-
var ArrowFunction$0 =
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
let eventData;
|
|
2499
|
-
if (state.events) {
|
|
2500
|
-
const result = state.events.enter?.("ArrowFunction", state);
|
|
2501
|
-
if (result) {
|
|
2502
|
-
if (result.cache)
|
|
2503
|
-
return result.cache;
|
|
2504
|
-
eventData = result.data;
|
|
2505
|
-
}
|
|
2607
|
+
var ArrowFunction$0 = ThinArrowFunction;
|
|
2608
|
+
var ArrowFunction$1 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
2609
|
+
var async = $1;
|
|
2610
|
+
var parameters = $2;
|
|
2611
|
+
var suffix = $3;
|
|
2612
|
+
var expOrBlock = $5;
|
|
2613
|
+
if (hasAwait(expOrBlock) && !async) {
|
|
2614
|
+
async = "async ";
|
|
2506
2615
|
}
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
const result = ArrowFunction$0(state);
|
|
2514
|
-
if (state.events)
|
|
2515
|
-
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2516
|
-
return result;
|
|
2616
|
+
let error;
|
|
2617
|
+
if (hasYield(expOrBlock)) {
|
|
2618
|
+
error = {
|
|
2619
|
+
type: "Error",
|
|
2620
|
+
message: "Can't use yield inside of => arrow function"
|
|
2621
|
+
};
|
|
2517
2622
|
}
|
|
2518
|
-
}
|
|
2519
|
-
var ArrowFunctionTail$0 = ThinArrowFunction;
|
|
2520
|
-
var ArrowFunctionTail$1 = $TS($S(Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
2521
|
-
var parameters = $1;
|
|
2522
|
-
var suffix = $2;
|
|
2523
|
-
var expOrBlock = $4;
|
|
2524
2623
|
return {
|
|
2525
2624
|
type: "ArrowFunction",
|
|
2526
2625
|
parameters,
|
|
2527
2626
|
returnType: suffix,
|
|
2528
2627
|
ts: false,
|
|
2628
|
+
async,
|
|
2529
2629
|
block: expOrBlock,
|
|
2530
|
-
children: $0
|
|
2630
|
+
children: [async, $0.slice(1), error]
|
|
2531
2631
|
};
|
|
2532
2632
|
});
|
|
2533
|
-
function
|
|
2633
|
+
function ArrowFunction(state) {
|
|
2534
2634
|
let eventData;
|
|
2535
2635
|
if (state.events) {
|
|
2536
|
-
const result = state.events.enter?.("
|
|
2636
|
+
const result = state.events.enter?.("ArrowFunction", state);
|
|
2537
2637
|
if (result) {
|
|
2538
2638
|
if (result.cache)
|
|
2539
2639
|
return result.cache;
|
|
@@ -2541,14 +2641,14 @@ ${input.slice(result.pos)}
|
|
|
2541
2641
|
}
|
|
2542
2642
|
}
|
|
2543
2643
|
if (state.tokenize) {
|
|
2544
|
-
const result = $TOKEN("
|
|
2644
|
+
const result = $TOKEN("ArrowFunction", state, ArrowFunction$0(state) || ArrowFunction$1(state));
|
|
2545
2645
|
if (state.events)
|
|
2546
|
-
state.events.exit?.("
|
|
2646
|
+
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2547
2647
|
return result;
|
|
2548
2648
|
} else {
|
|
2549
|
-
const result =
|
|
2649
|
+
const result = ArrowFunction$0(state) || ArrowFunction$1(state);
|
|
2550
2650
|
if (state.events)
|
|
2551
|
-
state.events.exit?.("
|
|
2651
|
+
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2552
2652
|
return result;
|
|
2553
2653
|
}
|
|
2554
2654
|
}
|
|
@@ -2636,7 +2736,7 @@ ${input.slice(result.pos)}
|
|
|
2636
2736
|
}
|
|
2637
2737
|
}
|
|
2638
2738
|
var TernaryRest$0 = NestedTernaryRest;
|
|
2639
|
-
var TernaryRest$1 = $TS($S($N(CoffeeBinaryExistentialEnabled), $Y($EXPECT($L9, fail, 'TernaryRest " "')), $
|
|
2739
|
+
var TernaryRest$1 = $TS($S($N(CoffeeBinaryExistentialEnabled), $Y($EXPECT($L9, fail, 'TernaryRest " "')), $E(_), QuestionMark, ExtendedExpression, __, Colon, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
|
2640
2740
|
return $0.slice(2);
|
|
2641
2741
|
});
|
|
2642
2742
|
function TernaryRest(state) {
|
|
@@ -2715,6 +2815,23 @@ ${input.slice(result.pos)}
|
|
|
2715
2815
|
var ws = $1;
|
|
2716
2816
|
var head = $2;
|
|
2717
2817
|
var body = $3;
|
|
2818
|
+
if (head.token === "&") {
|
|
2819
|
+
const ref = {
|
|
2820
|
+
type: "Ref",
|
|
2821
|
+
base: "$"
|
|
2822
|
+
};
|
|
2823
|
+
const arrowBody = {
|
|
2824
|
+
type: "PipelineExpression",
|
|
2825
|
+
children: [ws, ref, body]
|
|
2826
|
+
};
|
|
2827
|
+
return {
|
|
2828
|
+
type: "ArrowFunction",
|
|
2829
|
+
children: [ref, " => ", arrowBody],
|
|
2830
|
+
ref,
|
|
2831
|
+
body: [arrowBody],
|
|
2832
|
+
ampersandBlock: true
|
|
2833
|
+
};
|
|
2834
|
+
}
|
|
2718
2835
|
return {
|
|
2719
2836
|
type: "PipelineExpression",
|
|
2720
2837
|
children: [ws, head, body]
|
|
@@ -2744,6 +2861,7 @@ ${input.slice(result.pos)}
|
|
|
2744
2861
|
}
|
|
2745
2862
|
var PipelineHeadItem$0 = NonPipelineExtendedExpression;
|
|
2746
2863
|
var PipelineHeadItem$1 = ParenthesizedExpression;
|
|
2864
|
+
var PipelineHeadItem$2 = Ampersand;
|
|
2747
2865
|
function PipelineHeadItem(state) {
|
|
2748
2866
|
let eventData;
|
|
2749
2867
|
if (state.events) {
|
|
@@ -2755,12 +2873,12 @@ ${input.slice(result.pos)}
|
|
|
2755
2873
|
}
|
|
2756
2874
|
}
|
|
2757
2875
|
if (state.tokenize) {
|
|
2758
|
-
const result = $TOKEN("PipelineHeadItem", state, PipelineHeadItem$0(state) || PipelineHeadItem$1(state));
|
|
2876
|
+
const result = $TOKEN("PipelineHeadItem", state, PipelineHeadItem$0(state) || PipelineHeadItem$1(state) || PipelineHeadItem$2(state));
|
|
2759
2877
|
if (state.events)
|
|
2760
2878
|
state.events.exit?.("PipelineHeadItem", state, result, eventData);
|
|
2761
2879
|
return result;
|
|
2762
2880
|
} else {
|
|
2763
|
-
const result = PipelineHeadItem$0(state) || PipelineHeadItem$1(state);
|
|
2881
|
+
const result = PipelineHeadItem$0(state) || PipelineHeadItem$1(state) || PipelineHeadItem$2(state);
|
|
2764
2882
|
if (state.events)
|
|
2765
2883
|
state.events.exit?.("PipelineHeadItem", state, result, eventData);
|
|
2766
2884
|
return result;
|
|
@@ -2769,7 +2887,10 @@ ${input.slice(result.pos)}
|
|
|
2769
2887
|
var PipelineTailItem$0 = Await;
|
|
2770
2888
|
var PipelineTailItem$1 = Yield;
|
|
2771
2889
|
var PipelineTailItem$2 = Return;
|
|
2772
|
-
var PipelineTailItem$3 =
|
|
2890
|
+
var PipelineTailItem$3 = AmpersandFunctionExpression;
|
|
2891
|
+
var PipelineTailItem$4 = $T($S($N(Ampersand), PipelineHeadItem), function(value) {
|
|
2892
|
+
return value[1];
|
|
2893
|
+
});
|
|
2773
2894
|
function PipelineTailItem(state) {
|
|
2774
2895
|
let eventData;
|
|
2775
2896
|
if (state.events) {
|
|
@@ -2781,12 +2902,12 @@ ${input.slice(result.pos)}
|
|
|
2781
2902
|
}
|
|
2782
2903
|
}
|
|
2783
2904
|
if (state.tokenize) {
|
|
2784
|
-
const result = $TOKEN("PipelineTailItem", state, PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state));
|
|
2905
|
+
const result = $TOKEN("PipelineTailItem", state, PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state) || PipelineTailItem$4(state));
|
|
2785
2906
|
if (state.events)
|
|
2786
2907
|
state.events.exit?.("PipelineTailItem", state, result, eventData);
|
|
2787
2908
|
return result;
|
|
2788
2909
|
} else {
|
|
2789
|
-
const result = PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state);
|
|
2910
|
+
const result = PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state) || PipelineTailItem$4(state);
|
|
2790
2911
|
if (state.events)
|
|
2791
2912
|
state.events.exit?.("PipelineTailItem", state, result, eventData);
|
|
2792
2913
|
return result;
|
|
@@ -3233,7 +3354,7 @@ ${input.slice(result.pos)}
|
|
|
3233
3354
|
return result;
|
|
3234
3355
|
}
|
|
3235
3356
|
}
|
|
3236
|
-
var ClassElement$0 = $S($E(Decorators), $E(AccessModifier), $E($S(Static, $
|
|
3357
|
+
var ClassElement$0 = $S($E(Decorators), $E(AccessModifier), $E($S(Static, $E(_))), ClassElementDefinition);
|
|
3237
3358
|
var ClassElement$1 = $S(Static, BracedBlock);
|
|
3238
3359
|
function ClassElement(state) {
|
|
3239
3360
|
let eventData;
|
|
@@ -3379,7 +3500,7 @@ ${input.slice(result.pos)}
|
|
|
3379
3500
|
return result;
|
|
3380
3501
|
}
|
|
3381
3502
|
}
|
|
3382
|
-
var ClassSignatureElement$0 = $S($E(Decorators), $E(AccessModifier), $E($S(Static, $
|
|
3503
|
+
var ClassSignatureElement$0 = $S($E(Decorators), $E(AccessModifier), $E($S(Static, $E(_))), $C(MethodSignature, FieldDefinition));
|
|
3383
3504
|
var ClassSignatureElement$1 = $S(Static, ClassSignatureBody);
|
|
3384
3505
|
function ClassSignatureElement(state) {
|
|
3385
3506
|
let eventData;
|
|
@@ -3438,9 +3559,16 @@ ${input.slice(result.pos)}
|
|
|
3438
3559
|
var exp = $6;
|
|
3439
3560
|
switch (exp.type) {
|
|
3440
3561
|
case "FunctionExpression":
|
|
3562
|
+
const fnTokenIndex = exp.children.findIndex((c) => c?.token?.startsWith("function"));
|
|
3563
|
+
const children = exp.children.slice();
|
|
3564
|
+
if (exp.generator) {
|
|
3565
|
+
children.splice(fnTokenIndex, 2, children[fnTokenIndex + 1], id);
|
|
3566
|
+
} else {
|
|
3567
|
+
children.splice(fnTokenIndex, 1, id);
|
|
3568
|
+
}
|
|
3441
3569
|
return {
|
|
3442
3570
|
...exp,
|
|
3443
|
-
children
|
|
3571
|
+
children
|
|
3444
3572
|
};
|
|
3445
3573
|
default:
|
|
3446
3574
|
return [id, " = ", exp];
|
|
@@ -3455,7 +3583,7 @@ ${input.slice(result.pos)}
|
|
|
3455
3583
|
};
|
|
3456
3584
|
return $0;
|
|
3457
3585
|
});
|
|
3458
|
-
var FieldDefinition$2 = $TS($S($E($S(Abstract, $
|
|
3586
|
+
var FieldDefinition$2 = $TS($S($E($S(Abstract, $E(_))), $E($S(Readonly, $E(_))), ClassElementName, $E(TypeSuffix), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
3459
3587
|
if ($1)
|
|
3460
3588
|
return { children: $0, ts: true };
|
|
3461
3589
|
return $0;
|
|
@@ -5541,22 +5669,28 @@ ${input.slice(result.pos)}
|
|
|
5541
5669
|
return result;
|
|
5542
5670
|
}
|
|
5543
5671
|
}
|
|
5544
|
-
var FunctionSignature$0 = $TS($S($E($S(Async,
|
|
5672
|
+
var FunctionSignature$0 = $TS($S($E($S(Async, _)), Function, $E($S($E(_), Star)), $E($S($E(_), NWBindingIdentifier)), $E(_), Parameters, $E(ReturnTypeSuffix)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
5545
5673
|
var async = $1;
|
|
5546
5674
|
var func = $2;
|
|
5547
|
-
var
|
|
5675
|
+
var generator = $3;
|
|
5548
5676
|
var wid = $4;
|
|
5549
5677
|
var w = $5;
|
|
5550
5678
|
var parameters = $6;
|
|
5551
5679
|
var suffix = $7;
|
|
5680
|
+
if (!async)
|
|
5681
|
+
async = [];
|
|
5682
|
+
if (!generator)
|
|
5683
|
+
generator = [];
|
|
5552
5684
|
return {
|
|
5553
5685
|
type: "FunctionSignature",
|
|
5554
5686
|
id: wid?.[1],
|
|
5555
5687
|
parameters,
|
|
5556
5688
|
returnType: suffix,
|
|
5557
5689
|
ts: false,
|
|
5690
|
+
async,
|
|
5691
|
+
generator,
|
|
5558
5692
|
block: null,
|
|
5559
|
-
children: !parameters.implicit ? $0 : [async, func,
|
|
5693
|
+
children: !parameters.implicit ? $0 : [async, func, generator, wid, parameters, w, suffix]
|
|
5560
5694
|
};
|
|
5561
5695
|
});
|
|
5562
5696
|
function FunctionSignature(state) {
|
|
@@ -5588,6 +5722,12 @@ ${input.slice(result.pos)}
|
|
|
5588
5722
|
signature.ts = true;
|
|
5589
5723
|
return signature;
|
|
5590
5724
|
}
|
|
5725
|
+
if (hasAwait(block) && !signature.async.length) {
|
|
5726
|
+
signature.async.push("async ");
|
|
5727
|
+
}
|
|
5728
|
+
if (hasYield(block) && !signature.generator.length) {
|
|
5729
|
+
signature.generator.push("*");
|
|
5730
|
+
}
|
|
5591
5731
|
return {
|
|
5592
5732
|
...signature,
|
|
5593
5733
|
type: "FunctionExpression",
|
|
@@ -5595,7 +5735,30 @@ ${input.slice(result.pos)}
|
|
|
5595
5735
|
block
|
|
5596
5736
|
};
|
|
5597
5737
|
});
|
|
5598
|
-
var FunctionExpression$1 =
|
|
5738
|
+
var FunctionExpression$1 = AmpersandFunctionExpression;
|
|
5739
|
+
function FunctionExpression(state) {
|
|
5740
|
+
let eventData;
|
|
5741
|
+
if (state.events) {
|
|
5742
|
+
const result = state.events.enter?.("FunctionExpression", state);
|
|
5743
|
+
if (result) {
|
|
5744
|
+
if (result.cache)
|
|
5745
|
+
return result.cache;
|
|
5746
|
+
eventData = result.data;
|
|
5747
|
+
}
|
|
5748
|
+
}
|
|
5749
|
+
if (state.tokenize) {
|
|
5750
|
+
const result = $TOKEN("FunctionExpression", state, FunctionExpression$0(state) || FunctionExpression$1(state));
|
|
5751
|
+
if (state.events)
|
|
5752
|
+
state.events.exit?.("FunctionExpression", state, result, eventData);
|
|
5753
|
+
return result;
|
|
5754
|
+
} else {
|
|
5755
|
+
const result = FunctionExpression$0(state) || FunctionExpression$1(state);
|
|
5756
|
+
if (state.events)
|
|
5757
|
+
state.events.exit?.("FunctionExpression", state, result, eventData);
|
|
5758
|
+
return result;
|
|
5759
|
+
}
|
|
5760
|
+
}
|
|
5761
|
+
var AmpersandFunctionExpression$0 = $TS($S($E(AmpersandUnaryPrefix), $C(Ampersand, $S($N(NumericLiteral), $Y($S($E(QuestionMark), Dot)))), $E(AmpersandBlockRHS)), function($skip, $loc, $0, $1, $2, $3) {
|
|
5599
5762
|
var prefix = $1;
|
|
5600
5763
|
var rhs = $3;
|
|
5601
5764
|
if (!prefix && !rhs)
|
|
@@ -5613,7 +5776,7 @@ ${input.slice(result.pos)}
|
|
|
5613
5776
|
body = [prefix, rhs];
|
|
5614
5777
|
}
|
|
5615
5778
|
const children = [ref, " => ", ...body];
|
|
5616
|
-
if (
|
|
5779
|
+
if (hasAwait(body)) {
|
|
5617
5780
|
children.unshift("async ");
|
|
5618
5781
|
}
|
|
5619
5782
|
return {
|
|
@@ -5624,10 +5787,10 @@ ${input.slice(result.pos)}
|
|
|
5624
5787
|
ampersandBlock: true
|
|
5625
5788
|
};
|
|
5626
5789
|
});
|
|
5627
|
-
function
|
|
5790
|
+
function AmpersandFunctionExpression(state) {
|
|
5628
5791
|
let eventData;
|
|
5629
5792
|
if (state.events) {
|
|
5630
|
-
const result = state.events.enter?.("
|
|
5793
|
+
const result = state.events.enter?.("AmpersandFunctionExpression", state);
|
|
5631
5794
|
if (result) {
|
|
5632
5795
|
if (result.cache)
|
|
5633
5796
|
return result.cache;
|
|
@@ -5635,14 +5798,14 @@ ${input.slice(result.pos)}
|
|
|
5635
5798
|
}
|
|
5636
5799
|
}
|
|
5637
5800
|
if (state.tokenize) {
|
|
5638
|
-
const result = $TOKEN("
|
|
5801
|
+
const result = $TOKEN("AmpersandFunctionExpression", state, AmpersandFunctionExpression$0(state));
|
|
5639
5802
|
if (state.events)
|
|
5640
|
-
state.events.exit?.("
|
|
5803
|
+
state.events.exit?.("AmpersandFunctionExpression", state, result, eventData);
|
|
5641
5804
|
return result;
|
|
5642
5805
|
} else {
|
|
5643
|
-
const result =
|
|
5806
|
+
const result = AmpersandFunctionExpression$0(state);
|
|
5644
5807
|
if (state.events)
|
|
5645
|
-
state.events.exit?.("
|
|
5808
|
+
state.events.exit?.("AmpersandFunctionExpression", state, result, eventData);
|
|
5646
5809
|
return result;
|
|
5647
5810
|
}
|
|
5648
5811
|
}
|
|
@@ -5813,20 +5976,32 @@ ${input.slice(result.pos)}
|
|
|
5813
5976
|
return result;
|
|
5814
5977
|
}
|
|
5815
5978
|
}
|
|
5816
|
-
var ThinArrowFunction$0 = $TS($S(Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
5817
|
-
var
|
|
5818
|
-
var
|
|
5819
|
-
var
|
|
5820
|
-
var
|
|
5979
|
+
var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
5980
|
+
var async = $1;
|
|
5981
|
+
var parameters = $2;
|
|
5982
|
+
var suffix = $3;
|
|
5983
|
+
var arrow = $5;
|
|
5984
|
+
var block = $6;
|
|
5985
|
+
if (hasAwait(block) && !async) {
|
|
5986
|
+
async = "async ";
|
|
5987
|
+
}
|
|
5988
|
+
let generator;
|
|
5989
|
+
if (hasYield(block)) {
|
|
5990
|
+
generator = "*";
|
|
5991
|
+
}
|
|
5821
5992
|
return {
|
|
5822
5993
|
type: "FunctionExpression",
|
|
5823
5994
|
id: void 0,
|
|
5824
5995
|
parameters,
|
|
5825
5996
|
returnType: suffix,
|
|
5826
5997
|
ts: false,
|
|
5998
|
+
async,
|
|
5999
|
+
generator,
|
|
5827
6000
|
block,
|
|
5828
6001
|
children: [
|
|
6002
|
+
async,
|
|
5829
6003
|
{ $loc: arrow.$loc, token: "function" },
|
|
6004
|
+
generator,
|
|
5830
6005
|
parameters,
|
|
5831
6006
|
suffix,
|
|
5832
6007
|
block
|
|
@@ -6197,7 +6372,7 @@ ${input.slice(result.pos)}
|
|
|
6197
6372
|
return result;
|
|
6198
6373
|
}
|
|
6199
6374
|
}
|
|
6200
|
-
var NonSingleBracedBlock$0 = $TS($S($
|
|
6375
|
+
var NonSingleBracedBlock$0 = $TS($S($E(_), OpenBrace, AllowAll, $E($S(BracedContent, __, CloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
6201
6376
|
var ws1 = $1;
|
|
6202
6377
|
var open = $2;
|
|
6203
6378
|
if (!$4)
|
|
@@ -6313,7 +6488,7 @@ ${input.slice(result.pos)}
|
|
|
6313
6488
|
}
|
|
6314
6489
|
}
|
|
6315
6490
|
var BracedContent$0 = NestedBlockStatements;
|
|
6316
|
-
var BracedContent$1 = $TS($S($
|
|
6491
|
+
var BracedContent$1 = $TS($S($E(_), Statement), function($skip, $loc, $0, $1, $2) {
|
|
6317
6492
|
const expressions = [["", $2]];
|
|
6318
6493
|
return {
|
|
6319
6494
|
type: "BlockStatement",
|
|
@@ -7357,7 +7532,7 @@ ${input.slice(result.pos)}
|
|
|
7357
7532
|
return result;
|
|
7358
7533
|
}
|
|
7359
7534
|
}
|
|
7360
|
-
var ImplicitInlineObjectPropertyDelimiter$0 = $S($
|
|
7535
|
+
var ImplicitInlineObjectPropertyDelimiter$0 = $S($E(_), Comma);
|
|
7361
7536
|
var ImplicitInlineObjectPropertyDelimiter$1 = $T($S($Y($S($C(Samedent, $Q(_)), NamedProperty)), InsertComma), function(value) {
|
|
7362
7537
|
return value[1];
|
|
7363
7538
|
});
|
|
@@ -7793,9 +7968,38 @@ ${input.slice(result.pos)}
|
|
|
7793
7968
|
var MethodDefinition$1 = $TS($S(MethodSignature, $N(PropertyAccess), BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3) {
|
|
7794
7969
|
var signature = $1;
|
|
7795
7970
|
var block = $3;
|
|
7971
|
+
let children = $0;
|
|
7972
|
+
let generatorPos = 0;
|
|
7973
|
+
const { modifier } = signature;
|
|
7974
|
+
if (hasAwait(block)) {
|
|
7975
|
+
generatorPos++;
|
|
7976
|
+
children = children.slice();
|
|
7977
|
+
if (modifier?.get || modifier?.set) {
|
|
7978
|
+
children.push({
|
|
7979
|
+
type: "Error",
|
|
7980
|
+
message: "Getters and setters cannot be async"
|
|
7981
|
+
});
|
|
7982
|
+
} else if (modifier?.async) {
|
|
7983
|
+
} else {
|
|
7984
|
+
children.unshift("async ");
|
|
7985
|
+
}
|
|
7986
|
+
}
|
|
7987
|
+
if (hasYield(block)) {
|
|
7988
|
+
if (children === $0)
|
|
7989
|
+
children = children.slice();
|
|
7990
|
+
if (modifier?.get || modifier?.set) {
|
|
7991
|
+
children.push({
|
|
7992
|
+
type: "Error",
|
|
7993
|
+
message: "Getters and setters cannot be generators"
|
|
7994
|
+
});
|
|
7995
|
+
} else if (modifier?.generator) {
|
|
7996
|
+
} else {
|
|
7997
|
+
children.splice(generatorPos, 0, "*");
|
|
7998
|
+
}
|
|
7999
|
+
}
|
|
7796
8000
|
return {
|
|
7797
8001
|
type: "MethodDefinition",
|
|
7798
|
-
children
|
|
8002
|
+
children,
|
|
7799
8003
|
name: signature.name,
|
|
7800
8004
|
signature,
|
|
7801
8005
|
block,
|
|
@@ -7824,9 +8028,37 @@ ${input.slice(result.pos)}
|
|
|
7824
8028
|
return result;
|
|
7825
8029
|
}
|
|
7826
8030
|
}
|
|
7827
|
-
var MethodModifier$0 = $S(GetOrSet, $
|
|
7828
|
-
|
|
7829
|
-
|
|
8031
|
+
var MethodModifier$0 = $TS($S(GetOrSet, $E(_)), function($skip, $loc, $0, $1, $2) {
|
|
8032
|
+
var kind = $1;
|
|
8033
|
+
return {
|
|
8034
|
+
type: "MethodModifier",
|
|
8035
|
+
async: false,
|
|
8036
|
+
generator: false,
|
|
8037
|
+
get: kind.token === "get",
|
|
8038
|
+
set: kind.token === "set",
|
|
8039
|
+
children: $0
|
|
8040
|
+
};
|
|
8041
|
+
});
|
|
8042
|
+
var MethodModifier$1 = $TS($S($S(Async, __), $E($S(Star, __))), function($skip, $loc, $0, $1, $2) {
|
|
8043
|
+
return {
|
|
8044
|
+
type: "MethodModifier",
|
|
8045
|
+
async: true,
|
|
8046
|
+
get: false,
|
|
8047
|
+
set: false,
|
|
8048
|
+
generator: !!$1,
|
|
8049
|
+
children: $0
|
|
8050
|
+
};
|
|
8051
|
+
});
|
|
8052
|
+
var MethodModifier$2 = $TS($S(Star, __), function($skip, $loc, $0, $1, $2) {
|
|
8053
|
+
return {
|
|
8054
|
+
type: "MethodModifier",
|
|
8055
|
+
async: false,
|
|
8056
|
+
get: false,
|
|
8057
|
+
set: false,
|
|
8058
|
+
generator: true,
|
|
8059
|
+
children: $0
|
|
8060
|
+
};
|
|
8061
|
+
});
|
|
7830
8062
|
function MethodModifier(state) {
|
|
7831
8063
|
let eventData;
|
|
7832
8064
|
if (state.events) {
|
|
@@ -7859,7 +8091,8 @@ ${input.slice(result.pos)}
|
|
|
7859
8091
|
parameters
|
|
7860
8092
|
};
|
|
7861
8093
|
});
|
|
7862
|
-
var MethodSignature$1 = $TS($S($E(MethodModifier), ClassElementName, $
|
|
8094
|
+
var MethodSignature$1 = $TS($S($E(MethodModifier), ClassElementName, $E(_), NonEmptyParameters, $E(ReturnTypeSuffix)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
8095
|
+
var modifier = $1;
|
|
7863
8096
|
var name = $2;
|
|
7864
8097
|
var parameters = $4;
|
|
7865
8098
|
var suffix = $5;
|
|
@@ -7872,7 +8105,7 @@ ${input.slice(result.pos)}
|
|
|
7872
8105
|
type: "MethodSignature",
|
|
7873
8106
|
children: $0,
|
|
7874
8107
|
name,
|
|
7875
|
-
modifier
|
|
8108
|
+
modifier,
|
|
7876
8109
|
returnType: suffix,
|
|
7877
8110
|
parameters
|
|
7878
8111
|
};
|
|
@@ -7980,8 +8213,8 @@ ${input.slice(result.pos)}
|
|
|
7980
8213
|
return result;
|
|
7981
8214
|
}
|
|
7982
8215
|
}
|
|
7983
|
-
var AssignmentOp$0 = $TS($S(AssignmentOpSymbol, $
|
|
7984
|
-
if ($2
|
|
8216
|
+
var AssignmentOp$0 = $TS($S(AssignmentOpSymbol, $E(_)), function($skip, $loc, $0, $1, $2) {
|
|
8217
|
+
if ($2?.length) {
|
|
7985
8218
|
return {
|
|
7986
8219
|
token: $1,
|
|
7987
8220
|
children: [$1, ...$2]
|
|
@@ -8011,21 +8244,21 @@ ${input.slice(result.pos)}
|
|
|
8011
8244
|
return result;
|
|
8012
8245
|
}
|
|
8013
8246
|
}
|
|
8014
|
-
var OperatorAssignmentOp$0 = $TS($S(Xor, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $
|
|
8247
|
+
var OperatorAssignmentOp$0 = $TS($S(Xor, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $E(_)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8015
8248
|
return {
|
|
8016
8249
|
special: true,
|
|
8017
8250
|
call: module2.getRef("xor"),
|
|
8018
8251
|
children: [$2, ...$4]
|
|
8019
8252
|
};
|
|
8020
8253
|
});
|
|
8021
|
-
var OperatorAssignmentOp$1 = $TS($S(Xnor, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $
|
|
8254
|
+
var OperatorAssignmentOp$1 = $TS($S(Xnor, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $E(_)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8022
8255
|
return {
|
|
8023
8256
|
special: true,
|
|
8024
8257
|
call: module2.getRef("xnor"),
|
|
8025
8258
|
children: [$2, ...$4]
|
|
8026
8259
|
};
|
|
8027
8260
|
});
|
|
8028
|
-
var OperatorAssignmentOp$2 = $TS($S(Identifier, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $
|
|
8261
|
+
var OperatorAssignmentOp$2 = $TS($S(Identifier, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $E(_)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8029
8262
|
return {
|
|
8030
8263
|
special: true,
|
|
8031
8264
|
call: $1,
|
|
@@ -8491,7 +8724,7 @@ ${input.slice(result.pos)}
|
|
|
8491
8724
|
return result;
|
|
8492
8725
|
}
|
|
8493
8726
|
}
|
|
8494
|
-
var PostfixedStatement$0 = $TS($S(Statement, $E($S($
|
|
8727
|
+
var PostfixedStatement$0 = $TS($S(Statement, $E($S($E(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
|
|
8495
8728
|
var statement = $1;
|
|
8496
8729
|
var post = $2;
|
|
8497
8730
|
if (post)
|
|
@@ -8520,7 +8753,7 @@ ${input.slice(result.pos)}
|
|
|
8520
8753
|
return result;
|
|
8521
8754
|
}
|
|
8522
8755
|
}
|
|
8523
|
-
var PostfixedExpression$0 = $TS($S(ExtendedExpression, $E($S($
|
|
8756
|
+
var PostfixedExpression$0 = $TS($S(ExtendedExpression, $E($S($E(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
|
|
8524
8757
|
var expression = $1;
|
|
8525
8758
|
var post = $2;
|
|
8526
8759
|
if (post)
|
|
@@ -8549,7 +8782,7 @@ ${input.slice(result.pos)}
|
|
|
8549
8782
|
return result;
|
|
8550
8783
|
}
|
|
8551
8784
|
}
|
|
8552
|
-
var NonPipelinePostfixedExpression$0 = $TS($S(NonPipelineExtendedExpression, $E($S($
|
|
8785
|
+
var NonPipelinePostfixedExpression$0 = $TS($S(NonPipelineExtendedExpression, $E($S($E(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
|
|
8553
8786
|
var expression = $1;
|
|
8554
8787
|
var post = $2;
|
|
8555
8788
|
if (post)
|
|
@@ -8642,8 +8875,8 @@ ${input.slice(result.pos)}
|
|
|
8642
8875
|
return result;
|
|
8643
8876
|
}
|
|
8644
8877
|
}
|
|
8645
|
-
var EmptyStatement$0 = $
|
|
8646
|
-
return {
|
|
8878
|
+
var EmptyStatement$0 = $TS($S($E(_), $Y($EXPECT($L85, fail, 'EmptyStatement ";"'))), function($skip, $loc, $0, $1, $2) {
|
|
8879
|
+
return { type: "EmptyStatement", children: $1 || [] };
|
|
8647
8880
|
});
|
|
8648
8881
|
function EmptyStatement(state) {
|
|
8649
8882
|
let eventData;
|
|
@@ -8807,7 +9040,7 @@ ${input.slice(result.pos)}
|
|
|
8807
9040
|
}
|
|
8808
9041
|
}
|
|
8809
9042
|
var ElseClause$0 = $S(Samedent, Else, Block);
|
|
8810
|
-
var ElseClause$1 = $S($
|
|
9043
|
+
var ElseClause$1 = $S($E(_), Else, Block);
|
|
8811
9044
|
function ElseClause(state) {
|
|
8812
9045
|
let eventData;
|
|
8813
9046
|
if (state.events) {
|
|
@@ -8942,7 +9175,7 @@ ${input.slice(result.pos)}
|
|
|
8942
9175
|
return result;
|
|
8943
9176
|
}
|
|
8944
9177
|
}
|
|
8945
|
-
var ElseExpressionClause$0 = $TS($S($C($S(Samedent, Else), $S($
|
|
9178
|
+
var ElseExpressionClause$0 = $TS($S($C($S(Samedent, Else), $S($E(_), Else)), ElseExpressionBlock), function($skip, $loc, $0, $1, $2) {
|
|
8946
9179
|
return [...$1, $2];
|
|
8947
9180
|
});
|
|
8948
9181
|
function ElseExpressionClause(state) {
|
|
@@ -9318,7 +9551,7 @@ ${input.slice(result.pos)}
|
|
|
9318
9551
|
return result;
|
|
9319
9552
|
}
|
|
9320
9553
|
}
|
|
9321
|
-
var WhileClause$0 = $TS($S($C(While, Until), $
|
|
9554
|
+
var WhileClause$0 = $TS($S($C(While, Until), $E(_), Condition), function($skip, $loc, $0, $1, $2, $3) {
|
|
9322
9555
|
var kind = $1;
|
|
9323
9556
|
var ws = $2;
|
|
9324
9557
|
var cond = $3;
|
|
@@ -10415,7 +10648,7 @@ ${input.slice(result.pos)}
|
|
|
10415
10648
|
return result;
|
|
10416
10649
|
}
|
|
10417
10650
|
}
|
|
10418
|
-
var Condition$0 = $T($S(ParenthesizedExpression, $N($S($
|
|
10651
|
+
var Condition$0 = $T($S(ParenthesizedExpression, $N($S($E(_), $C(BinaryOp, AssignmentOp, Dot, QuestionMark))), $N($S(_, OperatorAssignmentOp))), function(value) {
|
|
10419
10652
|
return value[0];
|
|
10420
10653
|
});
|
|
10421
10654
|
var Condition$1 = $TS($S(InsertOpenParen, ExpressionWithIndentedApplicationForbidden, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -13380,9 +13613,7 @@ ${input.slice(result.pos)}
|
|
|
13380
13613
|
return result;
|
|
13381
13614
|
}
|
|
13382
13615
|
}
|
|
13383
|
-
var TrailingComment$0 =
|
|
13384
|
-
var TrailingComment$1 = InlineComment;
|
|
13385
|
-
var TrailingComment$2 = SingleLineComment;
|
|
13616
|
+
var TrailingComment$0 = $S($E(_), SingleLineComment);
|
|
13386
13617
|
function TrailingComment(state) {
|
|
13387
13618
|
let eventData;
|
|
13388
13619
|
if (state.events) {
|
|
@@ -13394,12 +13625,12 @@ ${input.slice(result.pos)}
|
|
|
13394
13625
|
}
|
|
13395
13626
|
}
|
|
13396
13627
|
if (state.tokenize) {
|
|
13397
|
-
const result = $TOKEN("TrailingComment", state, TrailingComment$0(state)
|
|
13628
|
+
const result = $TOKEN("TrailingComment", state, TrailingComment$0(state));
|
|
13398
13629
|
if (state.events)
|
|
13399
13630
|
state.events.exit?.("TrailingComment", state, result, eventData);
|
|
13400
13631
|
return result;
|
|
13401
13632
|
} else {
|
|
13402
|
-
const result = TrailingComment$0(state)
|
|
13633
|
+
const result = TrailingComment$0(state);
|
|
13403
13634
|
if (state.events)
|
|
13404
13635
|
state.events.exit?.("TrailingComment", state, result, eventData);
|
|
13405
13636
|
return result;
|
|
@@ -13530,7 +13761,7 @@ ${input.slice(result.pos)}
|
|
|
13530
13761
|
return result;
|
|
13531
13762
|
}
|
|
13532
13763
|
}
|
|
13533
|
-
var ExpressionDelimiter$0 = $TS($S($
|
|
13764
|
+
var ExpressionDelimiter$0 = $TS($S($E(_), Semicolon, InsertComma, $E(TrailingComment)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
13534
13765
|
return [$1, $3, $4];
|
|
13535
13766
|
});
|
|
13536
13767
|
var ExpressionDelimiter$1 = $T($S($Y(EOS), InsertComma), function(value) {
|
|
@@ -13607,7 +13838,7 @@ ${input.slice(result.pos)}
|
|
|
13607
13838
|
return result;
|
|
13608
13839
|
}
|
|
13609
13840
|
}
|
|
13610
|
-
var SemicolonDelimiter$0 = $TS($S($
|
|
13841
|
+
var SemicolonDelimiter$0 = $TS($S($E(_), Semicolon, $E(TrailingComment)), function($skip, $loc, $0, $1, $2, $3) {
|
|
13611
13842
|
return {
|
|
13612
13843
|
type: "SemicolonDelimiter",
|
|
13613
13844
|
children: $0
|
|
@@ -15742,7 +15973,7 @@ ${input.slice(result.pos)}
|
|
|
15742
15973
|
}
|
|
15743
15974
|
}
|
|
15744
15975
|
var Yield$0 = $TS($S($EXPECT($L164, fail, 'Yield "yield"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
15745
|
-
return { $loc, token: $1 };
|
|
15976
|
+
return { $loc, token: $1, type: "Yield" };
|
|
15746
15977
|
});
|
|
15747
15978
|
function Yield(state) {
|
|
15748
15979
|
let eventData;
|
|
@@ -17213,9 +17444,9 @@ ${input.slice(result.pos)}
|
|
|
17213
17444
|
return result;
|
|
17214
17445
|
}
|
|
17215
17446
|
}
|
|
17216
|
-
var TypeDeclarationRest$0 = $S(TypeKeyword, $
|
|
17217
|
-
var TypeDeclarationRest$1 = $S(Interface, $
|
|
17218
|
-
var TypeDeclarationRest$2 = $S(Namespace, $
|
|
17447
|
+
var TypeDeclarationRest$0 = $S(TypeKeyword, $E(_), IdentifierName, $E(TypeParameters), __, Equals, $C($S($E(_), Type), $S(__, Type)));
|
|
17448
|
+
var TypeDeclarationRest$1 = $S(Interface, $E(_), IdentifierName, $E(TypeParameters), $E(InterfaceExtendsClause), InterfaceBlock);
|
|
17449
|
+
var TypeDeclarationRest$2 = $S(Namespace, $E(_), IdentifierName, ModuleBlock);
|
|
17219
17450
|
var TypeDeclarationRest$3 = FunctionSignature;
|
|
17220
17451
|
function TypeDeclarationRest(state) {
|
|
17221
17452
|
let eventData;
|
|
@@ -17242,7 +17473,7 @@ ${input.slice(result.pos)}
|
|
|
17242
17473
|
var TypeLexicalDeclaration$0 = $S(__, LetOrConstOrVar, TypeDeclarationBinding, $Q($S(CommaDelimiter, __, TypeDeclarationBinding)));
|
|
17243
17474
|
var TypeLexicalDeclaration$1 = $S(__, EnumDeclaration);
|
|
17244
17475
|
var TypeLexicalDeclaration$2 = ClassSignature;
|
|
17245
|
-
var TypeLexicalDeclaration$3 = $S(Namespace, $
|
|
17476
|
+
var TypeLexicalDeclaration$3 = $S(Namespace, $E(_), IdentifierName, DeclareBlock);
|
|
17246
17477
|
var TypeLexicalDeclaration$4 = $S(Module, _, StringLiteral, $E(DeclareBlock));
|
|
17247
17478
|
var TypeLexicalDeclaration$5 = $S(Global, $E(DeclareBlock));
|
|
17248
17479
|
function TypeLexicalDeclaration(state) {
|
|
@@ -17814,7 +18045,7 @@ ${input.slice(result.pos)}
|
|
|
17814
18045
|
return result;
|
|
17815
18046
|
}
|
|
17816
18047
|
}
|
|
17817
|
-
var EnumDeclaration$0 = $TS($S($E($S(Const, _)), Enum, $
|
|
18048
|
+
var EnumDeclaration$0 = $TS($S($E($S(Const, _)), Enum, $E(_), IdentifierName, EnumBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
17818
18049
|
var isConst = $1;
|
|
17819
18050
|
var id = $4;
|
|
17820
18051
|
var block = $5;
|
|
@@ -17835,7 +18066,7 @@ ${input.slice(result.pos)}
|
|
|
17835
18066
|
let init, isString;
|
|
17836
18067
|
if (property.init) {
|
|
17837
18068
|
init = module2.replaceNodes(
|
|
17838
|
-
|
|
18069
|
+
deepCopy(property.init),
|
|
17839
18070
|
(n) => n.type === "Identifier" && names.has(n.name),
|
|
17840
18071
|
(n) => [id, '["', n.name, '"]']
|
|
17841
18072
|
);
|
|
@@ -20554,15 +20785,12 @@ ${input.slice(result.pos)}
|
|
|
20554
20785
|
], exp.async)
|
|
20555
20786
|
);
|
|
20556
20787
|
}
|
|
20557
|
-
module2.hasAwait = (exp) => {
|
|
20558
|
-
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
20559
|
-
};
|
|
20560
20788
|
module2.wrapIIFE = (exp, async) => {
|
|
20561
20789
|
let prefix, suffix;
|
|
20562
20790
|
if (async) {
|
|
20563
20791
|
prefix = "(async ()=>{";
|
|
20564
20792
|
suffix = "})()";
|
|
20565
|
-
} else if (
|
|
20793
|
+
} else if (hasAwait(exp)) {
|
|
20566
20794
|
prefix = "(await (async ()=>{";
|
|
20567
20795
|
suffix = "})())";
|
|
20568
20796
|
} else {
|
|
@@ -21136,62 +21364,6 @@ ${input.slice(result.pos)}
|
|
|
21136
21364
|
}, props2]
|
|
21137
21365
|
};
|
|
21138
21366
|
};
|
|
21139
|
-
function gatherNodes(node, predicate) {
|
|
21140
|
-
if (node == null)
|
|
21141
|
-
return [];
|
|
21142
|
-
if (Array.isArray(node)) {
|
|
21143
|
-
return node.flatMap((n) => gatherNodes(n, predicate));
|
|
21144
|
-
}
|
|
21145
|
-
if (predicate(node)) {
|
|
21146
|
-
return [node];
|
|
21147
|
-
}
|
|
21148
|
-
switch (node.type) {
|
|
21149
|
-
case "BlockStatement":
|
|
21150
|
-
return [];
|
|
21151
|
-
case "ForStatement":
|
|
21152
|
-
const isDec = node.declaration?.type === "Declaration";
|
|
21153
|
-
return node.children.flatMap((n) => {
|
|
21154
|
-
if (isDec && n === node.declaration)
|
|
21155
|
-
return [];
|
|
21156
|
-
return gatherNodes(n, predicate);
|
|
21157
|
-
});
|
|
21158
|
-
default:
|
|
21159
|
-
return gatherNodes(node.children, predicate);
|
|
21160
|
-
}
|
|
21161
|
-
return [];
|
|
21162
|
-
}
|
|
21163
|
-
function gatherRecursive(node, predicate, skipPredicate) {
|
|
21164
|
-
if (node == null)
|
|
21165
|
-
return [];
|
|
21166
|
-
if (Array.isArray(node)) {
|
|
21167
|
-
return node.flatMap((n) => gatherRecursive(n, predicate, skipPredicate));
|
|
21168
|
-
}
|
|
21169
|
-
if (skipPredicate?.(node))
|
|
21170
|
-
return [];
|
|
21171
|
-
if (predicate(node)) {
|
|
21172
|
-
return [node];
|
|
21173
|
-
}
|
|
21174
|
-
return gatherRecursive(node.children, predicate, skipPredicate);
|
|
21175
|
-
}
|
|
21176
|
-
function gatherRecursiveAll(node, predicate) {
|
|
21177
|
-
if (node == null)
|
|
21178
|
-
return [];
|
|
21179
|
-
if (Array.isArray(node)) {
|
|
21180
|
-
return node.flatMap((n) => gatherRecursiveAll(n, predicate));
|
|
21181
|
-
}
|
|
21182
|
-
const nodes = gatherRecursiveAll(node.children, predicate);
|
|
21183
|
-
if (predicate(node)) {
|
|
21184
|
-
nodes.push(node);
|
|
21185
|
-
}
|
|
21186
|
-
return nodes;
|
|
21187
|
-
}
|
|
21188
|
-
function isFunction(node) {
|
|
21189
|
-
const { type } = node;
|
|
21190
|
-
return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
|
|
21191
|
-
}
|
|
21192
|
-
function gatherRecursiveWithinFunction(node, predicate) {
|
|
21193
|
-
return gatherRecursive(node, predicate, isFunction);
|
|
21194
|
-
}
|
|
21195
21367
|
function addParentPointers(node, parent) {
|
|
21196
21368
|
if (node == null)
|
|
21197
21369
|
return;
|
|
@@ -21210,43 +21382,6 @@ ${input.slice(result.pos)}
|
|
|
21210
21382
|
}
|
|
21211
21383
|
}
|
|
21212
21384
|
}
|
|
21213
|
-
function removeParentPointers(node) {
|
|
21214
|
-
if (node == null)
|
|
21215
|
-
return;
|
|
21216
|
-
if (typeof node !== "object")
|
|
21217
|
-
return;
|
|
21218
|
-
if (Array.isArray(node)) {
|
|
21219
|
-
for (const child of node) {
|
|
21220
|
-
removeParentPointers(child);
|
|
21221
|
-
}
|
|
21222
|
-
return;
|
|
21223
|
-
}
|
|
21224
|
-
node.parent = null;
|
|
21225
|
-
if (node.children) {
|
|
21226
|
-
for (const child of node.children) {
|
|
21227
|
-
removeParentPointers(child);
|
|
21228
|
-
}
|
|
21229
|
-
}
|
|
21230
|
-
}
|
|
21231
|
-
function clone(node) {
|
|
21232
|
-
removeParentPointers(node);
|
|
21233
|
-
return deepCopy(node);
|
|
21234
|
-
}
|
|
21235
|
-
function deepCopy(node) {
|
|
21236
|
-
if (node == null)
|
|
21237
|
-
return node;
|
|
21238
|
-
if (typeof node !== "object")
|
|
21239
|
-
return node;
|
|
21240
|
-
if (Array.isArray(node)) {
|
|
21241
|
-
return node.map(deepCopy);
|
|
21242
|
-
}
|
|
21243
|
-
return Object.fromEntries(
|
|
21244
|
-
Object.entries(node).map(([key, value]) => {
|
|
21245
|
-
return [key, deepCopy(value)];
|
|
21246
|
-
})
|
|
21247
|
-
);
|
|
21248
|
-
}
|
|
21249
|
-
module2.deepCopy = deepCopy;
|
|
21250
21385
|
function findAncestor(node, predicate, stopPredicate) {
|
|
21251
21386
|
node = node.parent;
|
|
21252
21387
|
while (node && !stopPredicate?.(node)) {
|
|
@@ -21400,7 +21535,7 @@ ${input.slice(result.pos)}
|
|
|
21400
21535
|
const { signature, block } = f;
|
|
21401
21536
|
const isConstructor = signature.name === "constructor";
|
|
21402
21537
|
const isVoid = isVoidType(signature.returnType?.t);
|
|
21403
|
-
const isSet = signature.modifier
|
|
21538
|
+
const isSet = signature.modifier?.set;
|
|
21404
21539
|
if (!isConstructor && !isSet && !isVoid) {
|
|
21405
21540
|
insertReturn(block);
|
|
21406
21541
|
}
|
|
@@ -21561,24 +21696,24 @@ ${input.slice(result.pos)}
|
|
|
21561
21696
|
};
|
|
21562
21697
|
module2.convertMethodToFunction = function(method) {
|
|
21563
21698
|
const { signature, block } = method;
|
|
21564
|
-
let
|
|
21565
|
-
if (
|
|
21566
|
-
if (
|
|
21699
|
+
let { modifier } = signature;
|
|
21700
|
+
if (modifier) {
|
|
21701
|
+
if (modifier.get || modifier.set) {
|
|
21567
21702
|
throw new Error("cannot convert get/set method to function");
|
|
21568
|
-
} else if (
|
|
21569
|
-
|
|
21703
|
+
} else if (modifier.async) {
|
|
21704
|
+
modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
|
|
21570
21705
|
} else {
|
|
21571
|
-
|
|
21706
|
+
modifier = ["function ", ...modifier.children];
|
|
21572
21707
|
}
|
|
21573
21708
|
} else {
|
|
21574
|
-
|
|
21709
|
+
modifier = "function ";
|
|
21575
21710
|
}
|
|
21576
21711
|
return {
|
|
21577
21712
|
...signature,
|
|
21578
21713
|
id: signature.name,
|
|
21579
21714
|
type: "FunctionExpression",
|
|
21580
21715
|
children: [
|
|
21581
|
-
[
|
|
21716
|
+
[modifier, ...signature.children.slice(1)],
|
|
21582
21717
|
block
|
|
21583
21718
|
],
|
|
21584
21719
|
block
|
|
@@ -22209,8 +22344,12 @@ ${input.slice(result.pos)}
|
|
|
22209
22344
|
module2.gatherBindingCode = gatherBindingCode;
|
|
22210
22345
|
module2.constructInvocation = function(fn, arg) {
|
|
22211
22346
|
const fnArr = [fn.leadingComment, fn.expr, fn.trailingComment];
|
|
22212
|
-
|
|
22213
|
-
|
|
22347
|
+
let expr = fn.expr;
|
|
22348
|
+
while (expr.type === "ParenthesizedExpression") {
|
|
22349
|
+
expr = expr.expression;
|
|
22350
|
+
}
|
|
22351
|
+
if (expr.ampersandBlock) {
|
|
22352
|
+
const { ref, body } = expr;
|
|
22214
22353
|
ref.type = "PipedExpression";
|
|
22215
22354
|
ref.children = [module2.makeLeftHandSideExpression(arg)];
|
|
22216
22355
|
return {
|
|
@@ -22218,7 +22357,8 @@ ${input.slice(result.pos)}
|
|
|
22218
22357
|
children: [module2.skipIfOnlyWS(fn.leadingComment), ...body, module2.skipIfOnlyWS(fn.trailingComment)]
|
|
22219
22358
|
};
|
|
22220
22359
|
}
|
|
22221
|
-
|
|
22360
|
+
expr = fn.expr;
|
|
22361
|
+
const lhs = module2.makeLeftHandSideExpression(expr);
|
|
22222
22362
|
let comment = module2.skipIfOnlyWS(fn.trailingComment);
|
|
22223
22363
|
if (comment)
|
|
22224
22364
|
lhs.children.splice(2, 0, comment);
|
|
@@ -22542,6 +22682,18 @@ ${input.slice(result.pos)}
|
|
|
22542
22682
|
}
|
|
22543
22683
|
exports.parse = parse2;
|
|
22544
22684
|
exports.default = { parse: parse2 };
|
|
22685
|
+
var {
|
|
22686
|
+
clone,
|
|
22687
|
+
deepCopy,
|
|
22688
|
+
gatherNodes,
|
|
22689
|
+
gatherRecursive,
|
|
22690
|
+
gatherRecursiveAll,
|
|
22691
|
+
gatherRecursiveWithinFunction,
|
|
22692
|
+
hasAwait,
|
|
22693
|
+
hasYield,
|
|
22694
|
+
isFunction,
|
|
22695
|
+
removeParentPointers
|
|
22696
|
+
} = require_lib();
|
|
22545
22697
|
}
|
|
22546
22698
|
});
|
|
22547
22699
|
|