@danielx/civet 0.5.81 → 0.5.83
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 +189 -79
- package/dist/civet +0 -0
- package/dist/main.js +189 -79
- package/dist/main.mjs +189 -79
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -116,12 +116,29 @@ var Civet = (() => {
|
|
|
116
116
|
}
|
|
117
117
|
return nodes;
|
|
118
118
|
}
|
|
119
|
+
function hasAwait(exp) {
|
|
120
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
121
|
+
}
|
|
122
|
+
function hasYield(exp) {
|
|
123
|
+
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Yield").length > 0;
|
|
124
|
+
}
|
|
125
|
+
function isFunction(node) {
|
|
126
|
+
const { type } = node;
|
|
127
|
+
return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
|
|
128
|
+
}
|
|
129
|
+
function gatherRecursiveWithinFunction(node, predicate) {
|
|
130
|
+
return gatherRecursive(node, predicate, isFunction);
|
|
131
|
+
}
|
|
119
132
|
module.exports = {
|
|
120
133
|
clone,
|
|
121
134
|
deepCopy,
|
|
122
135
|
gatherNodes,
|
|
123
136
|
gatherRecursive,
|
|
124
137
|
gatherRecursiveAll,
|
|
138
|
+
gatherRecursiveWithinFunction,
|
|
139
|
+
hasAwait,
|
|
140
|
+
hasYield,
|
|
141
|
+
isFunction,
|
|
125
142
|
removeParentPointers
|
|
126
143
|
};
|
|
127
144
|
}
|
|
@@ -569,7 +586,6 @@ ${input.slice(result.pos)}
|
|
|
569
586
|
YieldExpression,
|
|
570
587
|
YieldTail,
|
|
571
588
|
ArrowFunction,
|
|
572
|
-
ArrowFunctionTail,
|
|
573
589
|
FatArrow,
|
|
574
590
|
FatArrowBody,
|
|
575
591
|
ConditionalExpression,
|
|
@@ -805,6 +821,7 @@ ${input.slice(result.pos)}
|
|
|
805
821
|
ForbidClassImplicitCall,
|
|
806
822
|
AllowClassImplicitCall,
|
|
807
823
|
RestoreClassImplicitCall,
|
|
824
|
+
ClassImplicitCallForbidden,
|
|
808
825
|
ForbidIndentedApplication,
|
|
809
826
|
AllowIndentedApplication,
|
|
810
827
|
RestoreIndentedApplication,
|
|
@@ -1841,7 +1858,7 @@ ${input.slice(result.pos)}
|
|
|
1841
1858
|
}
|
|
1842
1859
|
var ForbiddenImplicitCalls$0 = $R$0($EXPECT($R0, fail, "ForbiddenImplicitCalls /(as|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])/"));
|
|
1843
1860
|
var ForbiddenImplicitCalls$1 = $EXPECT($L1, fail, 'ForbiddenImplicitCalls "/ "');
|
|
1844
|
-
var ForbiddenImplicitCalls$2 = $S(
|
|
1861
|
+
var ForbiddenImplicitCalls$2 = $S(ClassImplicitCallForbidden, Class);
|
|
1845
1862
|
var ForbiddenImplicitCalls$3 = AtAt;
|
|
1846
1863
|
var ForbiddenImplicitCalls$4 = $S(Identifier, $EXPECT($L2, fail, 'ForbiddenImplicitCalls "="'), Whitespace);
|
|
1847
1864
|
var ForbiddenImplicitCalls$5 = $TS($S(Identifier, $N($EXPECT($L3, fail, 'ForbiddenImplicitCalls "("'))), function($skip, $loc, $0, $1, $2) {
|
|
@@ -2589,53 +2606,36 @@ ${input.slice(result.pos)}
|
|
|
2589
2606
|
return result;
|
|
2590
2607
|
}
|
|
2591
2608
|
}
|
|
2592
|
-
var ArrowFunction$0 =
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
let eventData;
|
|
2601
|
-
if (state.events) {
|
|
2602
|
-
const result = state.events.enter?.("ArrowFunction", state);
|
|
2603
|
-
if (result) {
|
|
2604
|
-
if (result.cache)
|
|
2605
|
-
return result.cache;
|
|
2606
|
-
eventData = result.data;
|
|
2607
|
-
}
|
|
2609
|
+
var ArrowFunction$0 = ThinArrowFunction;
|
|
2610
|
+
var ArrowFunction$1 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
2611
|
+
var async = $1;
|
|
2612
|
+
var parameters = $2;
|
|
2613
|
+
var suffix = $3;
|
|
2614
|
+
var expOrBlock = $5;
|
|
2615
|
+
if (hasAwait(expOrBlock) && !async) {
|
|
2616
|
+
async = "async ";
|
|
2608
2617
|
}
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
const result = ArrowFunction$0(state);
|
|
2616
|
-
if (state.events)
|
|
2617
|
-
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2618
|
-
return result;
|
|
2618
|
+
let error;
|
|
2619
|
+
if (hasYield(expOrBlock)) {
|
|
2620
|
+
error = {
|
|
2621
|
+
type: "Error",
|
|
2622
|
+
message: "Can't use yield inside of => arrow function"
|
|
2623
|
+
};
|
|
2619
2624
|
}
|
|
2620
|
-
}
|
|
2621
|
-
var ArrowFunctionTail$0 = ThinArrowFunction;
|
|
2622
|
-
var ArrowFunctionTail$1 = $TS($S(Parameters, $E(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
2623
|
-
var parameters = $1;
|
|
2624
|
-
var suffix = $2;
|
|
2625
|
-
var expOrBlock = $4;
|
|
2626
2625
|
return {
|
|
2627
2626
|
type: "ArrowFunction",
|
|
2628
2627
|
parameters,
|
|
2629
2628
|
returnType: suffix,
|
|
2630
2629
|
ts: false,
|
|
2630
|
+
async,
|
|
2631
2631
|
block: expOrBlock,
|
|
2632
|
-
children: $0
|
|
2632
|
+
children: [async, $0.slice(1), error]
|
|
2633
2633
|
};
|
|
2634
2634
|
});
|
|
2635
|
-
function
|
|
2635
|
+
function ArrowFunction(state) {
|
|
2636
2636
|
let eventData;
|
|
2637
2637
|
if (state.events) {
|
|
2638
|
-
const result = state.events.enter?.("
|
|
2638
|
+
const result = state.events.enter?.("ArrowFunction", state);
|
|
2639
2639
|
if (result) {
|
|
2640
2640
|
if (result.cache)
|
|
2641
2641
|
return result.cache;
|
|
@@ -2643,14 +2643,14 @@ ${input.slice(result.pos)}
|
|
|
2643
2643
|
}
|
|
2644
2644
|
}
|
|
2645
2645
|
if (state.tokenize) {
|
|
2646
|
-
const result = $TOKEN("
|
|
2646
|
+
const result = $TOKEN("ArrowFunction", state, ArrowFunction$0(state) || ArrowFunction$1(state));
|
|
2647
2647
|
if (state.events)
|
|
2648
|
-
state.events.exit?.("
|
|
2648
|
+
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2649
2649
|
return result;
|
|
2650
2650
|
} else {
|
|
2651
|
-
const result =
|
|
2651
|
+
const result = ArrowFunction$0(state) || ArrowFunction$1(state);
|
|
2652
2652
|
if (state.events)
|
|
2653
|
-
state.events.exit?.("
|
|
2653
|
+
state.events.exit?.("ArrowFunction", state, result, eventData);
|
|
2654
2654
|
return result;
|
|
2655
2655
|
}
|
|
2656
2656
|
}
|
|
@@ -3561,9 +3561,16 @@ ${input.slice(result.pos)}
|
|
|
3561
3561
|
var exp = $6;
|
|
3562
3562
|
switch (exp.type) {
|
|
3563
3563
|
case "FunctionExpression":
|
|
3564
|
+
const fnTokenIndex = exp.children.findIndex((c) => c?.token?.startsWith("function"));
|
|
3565
|
+
const children = exp.children.slice();
|
|
3566
|
+
if (exp.generator) {
|
|
3567
|
+
children.splice(fnTokenIndex, 2, children[fnTokenIndex + 1], id);
|
|
3568
|
+
} else {
|
|
3569
|
+
children.splice(fnTokenIndex, 1, id);
|
|
3570
|
+
}
|
|
3564
3571
|
return {
|
|
3565
3572
|
...exp,
|
|
3566
|
-
children
|
|
3573
|
+
children
|
|
3567
3574
|
};
|
|
3568
3575
|
default:
|
|
3569
3576
|
return [id, " = ", exp];
|
|
@@ -5664,22 +5671,28 @@ ${input.slice(result.pos)}
|
|
|
5664
5671
|
return result;
|
|
5665
5672
|
}
|
|
5666
5673
|
}
|
|
5667
|
-
var FunctionSignature$0 = $TS($S($E($S(Async,
|
|
5674
|
+
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) {
|
|
5668
5675
|
var async = $1;
|
|
5669
5676
|
var func = $2;
|
|
5670
|
-
var
|
|
5677
|
+
var generator = $3;
|
|
5671
5678
|
var wid = $4;
|
|
5672
5679
|
var w = $5;
|
|
5673
5680
|
var parameters = $6;
|
|
5674
5681
|
var suffix = $7;
|
|
5682
|
+
if (!async)
|
|
5683
|
+
async = [];
|
|
5684
|
+
if (!generator)
|
|
5685
|
+
generator = [];
|
|
5675
5686
|
return {
|
|
5676
5687
|
type: "FunctionSignature",
|
|
5677
5688
|
id: wid?.[1],
|
|
5678
5689
|
parameters,
|
|
5679
5690
|
returnType: suffix,
|
|
5680
5691
|
ts: false,
|
|
5692
|
+
async,
|
|
5693
|
+
generator,
|
|
5681
5694
|
block: null,
|
|
5682
|
-
children: !parameters.implicit ? $0 : [async, func,
|
|
5695
|
+
children: !parameters.implicit ? $0 : [async, func, generator, wid, parameters, w, suffix]
|
|
5683
5696
|
};
|
|
5684
5697
|
});
|
|
5685
5698
|
function FunctionSignature(state) {
|
|
@@ -5711,6 +5724,12 @@ ${input.slice(result.pos)}
|
|
|
5711
5724
|
signature.ts = true;
|
|
5712
5725
|
return signature;
|
|
5713
5726
|
}
|
|
5727
|
+
if (hasAwait(block) && !signature.async.length) {
|
|
5728
|
+
signature.async.push("async ");
|
|
5729
|
+
}
|
|
5730
|
+
if (hasYield(block) && !signature.generator.length) {
|
|
5731
|
+
signature.generator.push("*");
|
|
5732
|
+
}
|
|
5714
5733
|
return {
|
|
5715
5734
|
...signature,
|
|
5716
5735
|
type: "FunctionExpression",
|
|
@@ -5759,7 +5778,7 @@ ${input.slice(result.pos)}
|
|
|
5759
5778
|
body = [prefix, rhs];
|
|
5760
5779
|
}
|
|
5761
5780
|
const children = [ref, " => ", ...body];
|
|
5762
|
-
if (
|
|
5781
|
+
if (hasAwait(body)) {
|
|
5763
5782
|
children.unshift("async ");
|
|
5764
5783
|
}
|
|
5765
5784
|
return {
|
|
@@ -5959,20 +5978,32 @@ ${input.slice(result.pos)}
|
|
|
5959
5978
|
return result;
|
|
5960
5979
|
}
|
|
5961
5980
|
}
|
|
5962
|
-
var ThinArrowFunction$0 = $TS($S(Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
5963
|
-
var
|
|
5964
|
-
var
|
|
5965
|
-
var
|
|
5966
|
-
var
|
|
5981
|
+
var ThinArrowFunction$0 = $TS($S($E($S(Async, _)), Parameters, $E(ReturnTypeSuffix), $Q(_), Arrow, BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
5982
|
+
var async = $1;
|
|
5983
|
+
var parameters = $2;
|
|
5984
|
+
var suffix = $3;
|
|
5985
|
+
var arrow = $5;
|
|
5986
|
+
var block = $6;
|
|
5987
|
+
if (hasAwait(block) && !async) {
|
|
5988
|
+
async = "async ";
|
|
5989
|
+
}
|
|
5990
|
+
let generator;
|
|
5991
|
+
if (hasYield(block)) {
|
|
5992
|
+
generator = "*";
|
|
5993
|
+
}
|
|
5967
5994
|
return {
|
|
5968
5995
|
type: "FunctionExpression",
|
|
5969
5996
|
id: void 0,
|
|
5970
5997
|
parameters,
|
|
5971
5998
|
returnType: suffix,
|
|
5972
5999
|
ts: false,
|
|
6000
|
+
async,
|
|
6001
|
+
generator,
|
|
5973
6002
|
block,
|
|
5974
6003
|
children: [
|
|
6004
|
+
async,
|
|
5975
6005
|
{ $loc: arrow.$loc, token: "function" },
|
|
6006
|
+
generator,
|
|
5976
6007
|
parameters,
|
|
5977
6008
|
suffix,
|
|
5978
6009
|
block
|
|
@@ -7939,9 +7970,38 @@ ${input.slice(result.pos)}
|
|
|
7939
7970
|
var MethodDefinition$1 = $TS($S(MethodSignature, $N(PropertyAccess), BracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3) {
|
|
7940
7971
|
var signature = $1;
|
|
7941
7972
|
var block = $3;
|
|
7973
|
+
let children = $0;
|
|
7974
|
+
let generatorPos = 0;
|
|
7975
|
+
const { modifier } = signature;
|
|
7976
|
+
if (hasAwait(block)) {
|
|
7977
|
+
generatorPos++;
|
|
7978
|
+
children = children.slice();
|
|
7979
|
+
if (modifier?.get || modifier?.set) {
|
|
7980
|
+
children.push({
|
|
7981
|
+
type: "Error",
|
|
7982
|
+
message: "Getters and setters cannot be async"
|
|
7983
|
+
});
|
|
7984
|
+
} else if (modifier?.async) {
|
|
7985
|
+
} else {
|
|
7986
|
+
children.unshift("async ");
|
|
7987
|
+
}
|
|
7988
|
+
}
|
|
7989
|
+
if (hasYield(block)) {
|
|
7990
|
+
if (children === $0)
|
|
7991
|
+
children = children.slice();
|
|
7992
|
+
if (modifier?.get || modifier?.set) {
|
|
7993
|
+
children.push({
|
|
7994
|
+
type: "Error",
|
|
7995
|
+
message: "Getters and setters cannot be generators"
|
|
7996
|
+
});
|
|
7997
|
+
} else if (modifier?.generator) {
|
|
7998
|
+
} else {
|
|
7999
|
+
children.splice(generatorPos, 0, "*");
|
|
8000
|
+
}
|
|
8001
|
+
}
|
|
7942
8002
|
return {
|
|
7943
8003
|
type: "MethodDefinition",
|
|
7944
|
-
children
|
|
8004
|
+
children,
|
|
7945
8005
|
name: signature.name,
|
|
7946
8006
|
signature,
|
|
7947
8007
|
block,
|
|
@@ -7970,9 +8030,37 @@ ${input.slice(result.pos)}
|
|
|
7970
8030
|
return result;
|
|
7971
8031
|
}
|
|
7972
8032
|
}
|
|
7973
|
-
var MethodModifier$0 = $S(GetOrSet, $E(_))
|
|
7974
|
-
|
|
7975
|
-
|
|
8033
|
+
var MethodModifier$0 = $TS($S(GetOrSet, $E(_)), function($skip, $loc, $0, $1, $2) {
|
|
8034
|
+
var kind = $1;
|
|
8035
|
+
return {
|
|
8036
|
+
type: "MethodModifier",
|
|
8037
|
+
async: false,
|
|
8038
|
+
generator: false,
|
|
8039
|
+
get: kind.token === "get",
|
|
8040
|
+
set: kind.token === "set",
|
|
8041
|
+
children: $0
|
|
8042
|
+
};
|
|
8043
|
+
});
|
|
8044
|
+
var MethodModifier$1 = $TS($S($S(Async, __), $E($S(Star, __))), function($skip, $loc, $0, $1, $2) {
|
|
8045
|
+
return {
|
|
8046
|
+
type: "MethodModifier",
|
|
8047
|
+
async: true,
|
|
8048
|
+
get: false,
|
|
8049
|
+
set: false,
|
|
8050
|
+
generator: !!$1,
|
|
8051
|
+
children: $0
|
|
8052
|
+
};
|
|
8053
|
+
});
|
|
8054
|
+
var MethodModifier$2 = $TS($S(Star, __), function($skip, $loc, $0, $1, $2) {
|
|
8055
|
+
return {
|
|
8056
|
+
type: "MethodModifier",
|
|
8057
|
+
async: false,
|
|
8058
|
+
get: false,
|
|
8059
|
+
set: false,
|
|
8060
|
+
generator: true,
|
|
8061
|
+
children: $0
|
|
8062
|
+
};
|
|
8063
|
+
});
|
|
7976
8064
|
function MethodModifier(state) {
|
|
7977
8065
|
let eventData;
|
|
7978
8066
|
if (state.events) {
|
|
@@ -8005,7 +8093,8 @@ ${input.slice(result.pos)}
|
|
|
8005
8093
|
parameters
|
|
8006
8094
|
};
|
|
8007
8095
|
});
|
|
8008
|
-
var MethodSignature$1 = $TS($S($E(MethodModifier), ClassElementName, $
|
|
8096
|
+
var MethodSignature$1 = $TS($S($E(MethodModifier), ClassElementName, $E(_), NonEmptyParameters, $E(ReturnTypeSuffix)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
8097
|
+
var modifier = $1;
|
|
8009
8098
|
var name = $2;
|
|
8010
8099
|
var parameters = $4;
|
|
8011
8100
|
var suffix = $5;
|
|
@@ -8018,7 +8107,7 @@ ${input.slice(result.pos)}
|
|
|
8018
8107
|
type: "MethodSignature",
|
|
8019
8108
|
children: $0,
|
|
8020
8109
|
name,
|
|
8021
|
-
modifier
|
|
8110
|
+
modifier,
|
|
8022
8111
|
returnType: suffix,
|
|
8023
8112
|
parameters
|
|
8024
8113
|
};
|
|
@@ -10702,6 +10791,33 @@ ${input.slice(result.pos)}
|
|
|
10702
10791
|
return result;
|
|
10703
10792
|
}
|
|
10704
10793
|
}
|
|
10794
|
+
var ClassImplicitCallForbidden$0 = $TV($EXPECT($L0, fail, 'ClassImplicitCallForbidden ""'), function($skip, $loc, $0, $1) {
|
|
10795
|
+
if (module.classImplicitCallForbidden)
|
|
10796
|
+
return $skip;
|
|
10797
|
+
return;
|
|
10798
|
+
});
|
|
10799
|
+
function ClassImplicitCallForbidden(state) {
|
|
10800
|
+
let eventData;
|
|
10801
|
+
if (state.events) {
|
|
10802
|
+
const result = state.events.enter?.("ClassImplicitCallForbidden", state);
|
|
10803
|
+
if (result) {
|
|
10804
|
+
if (result.cache)
|
|
10805
|
+
return result.cache;
|
|
10806
|
+
eventData = result.data;
|
|
10807
|
+
}
|
|
10808
|
+
}
|
|
10809
|
+
if (state.tokenize) {
|
|
10810
|
+
const result = $TOKEN("ClassImplicitCallForbidden", state, ClassImplicitCallForbidden$0(state));
|
|
10811
|
+
if (state.events)
|
|
10812
|
+
state.events.exit?.("ClassImplicitCallForbidden", state, result, eventData);
|
|
10813
|
+
return result;
|
|
10814
|
+
} else {
|
|
10815
|
+
const result = ClassImplicitCallForbidden$0(state);
|
|
10816
|
+
if (state.events)
|
|
10817
|
+
state.events.exit?.("ClassImplicitCallForbidden", state, result, eventData);
|
|
10818
|
+
return result;
|
|
10819
|
+
}
|
|
10820
|
+
}
|
|
10705
10821
|
var ForbidIndentedApplication$0 = $TV($EXPECT($L0, fail, 'ForbidIndentedApplication ""'), function($skip, $loc, $0, $1) {
|
|
10706
10822
|
module.forbidIndentedApplication.push(true);
|
|
10707
10823
|
});
|
|
@@ -15886,7 +16002,7 @@ ${input.slice(result.pos)}
|
|
|
15886
16002
|
}
|
|
15887
16003
|
}
|
|
15888
16004
|
var Yield$0 = $TS($S($EXPECT($L164, fail, 'Yield "yield"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
15889
|
-
return { $loc, token: $1 };
|
|
16005
|
+
return { $loc, token: $1, type: "Yield" };
|
|
15890
16006
|
});
|
|
15891
16007
|
function Yield(state) {
|
|
15892
16008
|
let eventData;
|
|
@@ -20698,15 +20814,12 @@ ${input.slice(result.pos)}
|
|
|
20698
20814
|
], exp.async)
|
|
20699
20815
|
);
|
|
20700
20816
|
}
|
|
20701
|
-
module.hasAwait = (exp) => {
|
|
20702
|
-
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
20703
|
-
};
|
|
20704
20817
|
module.wrapIIFE = (exp, async) => {
|
|
20705
20818
|
let prefix, suffix;
|
|
20706
20819
|
if (async) {
|
|
20707
20820
|
prefix = "(async ()=>{";
|
|
20708
20821
|
suffix = "})()";
|
|
20709
|
-
} else if (
|
|
20822
|
+
} else if (hasAwait(exp)) {
|
|
20710
20823
|
prefix = "(await (async ()=>{";
|
|
20711
20824
|
suffix = "})())";
|
|
20712
20825
|
} else {
|
|
@@ -21280,13 +21393,6 @@ ${input.slice(result.pos)}
|
|
|
21280
21393
|
}, props2]
|
|
21281
21394
|
};
|
|
21282
21395
|
};
|
|
21283
|
-
function isFunction(node) {
|
|
21284
|
-
const { type } = node;
|
|
21285
|
-
return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
|
|
21286
|
-
}
|
|
21287
|
-
function gatherRecursiveWithinFunction(node, predicate) {
|
|
21288
|
-
return gatherRecursive(node, predicate, isFunction);
|
|
21289
|
-
}
|
|
21290
21396
|
function addParentPointers(node, parent) {
|
|
21291
21397
|
if (node == null)
|
|
21292
21398
|
return;
|
|
@@ -21458,7 +21564,7 @@ ${input.slice(result.pos)}
|
|
|
21458
21564
|
const { signature, block } = f;
|
|
21459
21565
|
const isConstructor = signature.name === "constructor";
|
|
21460
21566
|
const isVoid = isVoidType(signature.returnType?.t);
|
|
21461
|
-
const isSet = signature.modifier
|
|
21567
|
+
const isSet = signature.modifier?.set;
|
|
21462
21568
|
if (!isConstructor && !isSet && !isVoid) {
|
|
21463
21569
|
insertReturn(block);
|
|
21464
21570
|
}
|
|
@@ -21619,24 +21725,24 @@ ${input.slice(result.pos)}
|
|
|
21619
21725
|
};
|
|
21620
21726
|
module.convertMethodToFunction = function(method) {
|
|
21621
21727
|
const { signature, block } = method;
|
|
21622
|
-
let
|
|
21623
|
-
if (
|
|
21624
|
-
if (
|
|
21728
|
+
let { modifier } = signature;
|
|
21729
|
+
if (modifier) {
|
|
21730
|
+
if (modifier.get || modifier.set) {
|
|
21625
21731
|
throw new Error("cannot convert get/set method to function");
|
|
21626
|
-
} else if (
|
|
21627
|
-
|
|
21732
|
+
} else if (modifier.async) {
|
|
21733
|
+
modifier = [modifier.children[0][0], " function ", ...modifier.children.slice(1)];
|
|
21628
21734
|
} else {
|
|
21629
|
-
|
|
21735
|
+
modifier = ["function ", ...modifier.children];
|
|
21630
21736
|
}
|
|
21631
21737
|
} else {
|
|
21632
|
-
|
|
21738
|
+
modifier = "function ";
|
|
21633
21739
|
}
|
|
21634
21740
|
return {
|
|
21635
21741
|
...signature,
|
|
21636
21742
|
id: signature.name,
|
|
21637
21743
|
type: "FunctionExpression",
|
|
21638
21744
|
children: [
|
|
21639
|
-
[
|
|
21745
|
+
[modifier, ...signature.children.slice(1)],
|
|
21640
21746
|
block
|
|
21641
21747
|
],
|
|
21642
21748
|
block
|
|
@@ -22611,6 +22717,10 @@ ${input.slice(result.pos)}
|
|
|
22611
22717
|
gatherNodes,
|
|
22612
22718
|
gatherRecursive,
|
|
22613
22719
|
gatherRecursiveAll,
|
|
22720
|
+
gatherRecursiveWithinFunction,
|
|
22721
|
+
hasAwait,
|
|
22722
|
+
hasYield,
|
|
22723
|
+
isFunction,
|
|
22614
22724
|
removeParentPointers
|
|
22615
22725
|
} = require_lib();
|
|
22616
22726
|
}
|
|
@@ -23049,7 +23159,7 @@ ${input.slice(result.pos)}
|
|
|
23049
23159
|
var uncacheable;
|
|
23050
23160
|
({ parse } = import_parser.default);
|
|
23051
23161
|
({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
|
|
23052
|
-
uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowIndentedApplication", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidIndentedApplication", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
|
|
23162
|
+
uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowClassImplicitCall", "AllowIndentedApplication", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "ClassImplicitCallForbidden", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElementListWithIndentedApplicationForbidden", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidClassImplicitCall", "ForbidIndentedApplication", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "NotDedented", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreClassImplicitCall", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
|
|
23053
23163
|
var compile = function(src, options) {
|
|
23054
23164
|
var ast, code, events, filename, ref, result, sm, srcMapJSON;
|
|
23055
23165
|
if (!options) {
|
package/dist/civet
CHANGED
|
File without changes
|