@markw65/monkeyc-optimizer 1.1.68 → 1.1.69
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/CHANGELOG.md +4 -0
- package/build/api.cjs +37 -37
- package/build/cftinfo.cjs +4 -4
- package/build/{chunk-MBTLUWXR.cjs → chunk-JDC43A3I.cjs} +5 -5
- package/build/{chunk-NGCEDNHJ.cjs → chunk-YERUPFGW.cjs} +283 -267
- package/build/optimizer.cjs +19 -19
- package/build/sdk-util.cjs +15 -15
- package/build/src/ast.d.ts +1 -1
- package/build/worker-thread.cjs +4 -4
- package/package.json +1 -1
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_YERUPFGW_exports = {};
|
|
30
|
+
__export(chunk_YERUPFGW_exports, {
|
|
31
31
|
EnumTagsConst: () => EnumTagsConst,
|
|
32
32
|
LastTypeTag: () => LastTypeTag,
|
|
33
33
|
ObjectLikeTagsConst: () => ObjectLikeTagsConst,
|
|
@@ -135,9 +135,9 @@ __export(chunk_NGCEDNHJ_exports, {
|
|
|
135
135
|
visitorNode: () => visitorNode,
|
|
136
136
|
xml_util_exports: () => xml_util_exports
|
|
137
137
|
});
|
|
138
|
-
module.exports = __toCommonJS(
|
|
138
|
+
module.exports = __toCommonJS(chunk_YERUPFGW_exports);
|
|
139
139
|
var import_chunk_OASVKTK5 = require("./chunk-OASVKTK5.cjs");
|
|
140
|
-
var
|
|
140
|
+
var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
|
|
141
141
|
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
142
142
|
var import_node_assert = __toESM(require("node:assert"));
|
|
143
143
|
var import_prettier_plugin_monkeyc = require("@markw65/prettier-plugin-monkeyc");
|
|
@@ -3196,7 +3196,7 @@ var init_xml_util = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
3196
3196
|
"src/xml-util.ts"() {
|
|
3197
3197
|
"use strict";
|
|
3198
3198
|
init_xml();
|
|
3199
|
-
(0,
|
|
3199
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
3200
3200
|
PeggyError = class extends Error {
|
|
3201
3201
|
constructor(message, location) {
|
|
3202
3202
|
super(message);
|
|
@@ -3244,11 +3244,11 @@ var init_xml_util = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
3244
3244
|
result.push(String.fromCharCode(child.value));
|
|
3245
3245
|
return true;
|
|
3246
3246
|
case "entityref":
|
|
3247
|
-
if ((0,
|
|
3247
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(entities, child.name)) {
|
|
3248
3248
|
result.push(entities[child.name]);
|
|
3249
3249
|
return true;
|
|
3250
3250
|
}
|
|
3251
|
-
if ((0,
|
|
3251
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(this.entities, child.name)) {
|
|
3252
3252
|
result.push(
|
|
3253
3253
|
this.processRefs(referenceList(this.entities[child.name].value))
|
|
3254
3254
|
);
|
|
@@ -3273,13 +3273,13 @@ var init_xml_util = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
3273
3273
|
} else if (hexref) {
|
|
3274
3274
|
return String.fromCharCode(parseInt(decref, 16));
|
|
3275
3275
|
} else if (entref) {
|
|
3276
|
-
if ((0,
|
|
3276
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(entities, entref)) {
|
|
3277
3277
|
return entities[entref];
|
|
3278
3278
|
}
|
|
3279
|
-
if ((0,
|
|
3279
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(this.entities, entref)) {
|
|
3280
3280
|
return referenceList(this.entities[entref].value);
|
|
3281
3281
|
}
|
|
3282
|
-
} else if ((0,
|
|
3282
|
+
} else if ((0, import_chunk_JDC43A3I.hasProperty)(this.pentities, peref)) {
|
|
3283
3283
|
return referenceList(this.pentities[peref].value);
|
|
3284
3284
|
}
|
|
3285
3285
|
return "";
|
|
@@ -5526,7 +5526,7 @@ function findCallees(lookupDefs) {
|
|
|
5526
5526
|
}
|
|
5527
5527
|
function findCalleesForNew(lookupDefs) {
|
|
5528
5528
|
const initializer = (decl) => {
|
|
5529
|
-
if ((0,
|
|
5529
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(decl.decls, "initialize")) {
|
|
5530
5530
|
return decl.decls["initialize"];
|
|
5531
5531
|
}
|
|
5532
5532
|
if (decl.superClass && decl.superClass !== true) {
|
|
@@ -5554,12 +5554,12 @@ function findCalleesByNode(state, callee) {
|
|
|
5554
5554
|
const name = callee.type === "Identifier" ? callee.name : callee.type === "MemberExpression" && !callee.computed ? callee.property.name : null;
|
|
5555
5555
|
if (!name)
|
|
5556
5556
|
return null;
|
|
5557
|
-
return (0,
|
|
5557
|
+
return (0, import_chunk_JDC43A3I.hasProperty)(state.allFunctions, name) && state.allFunctions[name] || null;
|
|
5558
5558
|
}
|
|
5559
5559
|
var init_function_info = (0, import_chunk_ABYVSU2C.__esm)({
|
|
5560
5560
|
"src/function-info.ts"() {
|
|
5561
5561
|
"use strict";
|
|
5562
|
-
(0,
|
|
5562
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
5563
5563
|
}
|
|
5564
5564
|
});
|
|
5565
5565
|
var buildConfigDescription;
|
|
@@ -5883,7 +5883,7 @@ function renameIdentifier(ident, newName) {
|
|
|
5883
5883
|
function renameVariable(state, locals, declName2) {
|
|
5884
5884
|
const map2 = locals.map;
|
|
5885
5885
|
if (declName2) {
|
|
5886
|
-
if (!(0,
|
|
5886
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(map2, declName2))
|
|
5887
5887
|
return null;
|
|
5888
5888
|
} else {
|
|
5889
5889
|
declName2 = "tmp";
|
|
@@ -5898,7 +5898,7 @@ function renameVariable(state, locals, declName2) {
|
|
|
5898
5898
|
if (!locals.inners) {
|
|
5899
5899
|
locals.inners = {};
|
|
5900
5900
|
const inners = locals.inners;
|
|
5901
|
-
(0,
|
|
5901
|
+
(0, import_chunk_JDC43A3I.traverseAst)(locals.node, (node) => {
|
|
5902
5902
|
if (node.type === "VariableDeclarator") {
|
|
5903
5903
|
inners[variableDeclarationName(node.id)] = true;
|
|
5904
5904
|
}
|
|
@@ -5907,13 +5907,13 @@ function renameVariable(state, locals, declName2) {
|
|
|
5907
5907
|
let name;
|
|
5908
5908
|
while (true) {
|
|
5909
5909
|
name = `pmcr_${node_name}_${suffix}`;
|
|
5910
|
-
if (!(0,
|
|
5910
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(map2, name) && !(0, import_chunk_JDC43A3I.hasProperty)(locals.inners, name)) {
|
|
5911
5911
|
let ok = false;
|
|
5912
5912
|
let i;
|
|
5913
5913
|
for (i = state.stack.length; i--; ) {
|
|
5914
5914
|
const elm = state.stack[i].sn;
|
|
5915
5915
|
if (ok) {
|
|
5916
|
-
if ((0,
|
|
5916
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(elm.decls, name)) {
|
|
5917
5917
|
break;
|
|
5918
5918
|
}
|
|
5919
5919
|
} else if (elm.node && elm.node.type === "FunctionDeclaration") {
|
|
@@ -5934,7 +5934,7 @@ var init_variable_renamer = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
5934
5934
|
"src/variable-renamer.ts"() {
|
|
5935
5935
|
"use strict";
|
|
5936
5936
|
init_api();
|
|
5937
|
-
(0,
|
|
5937
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
5938
5938
|
}
|
|
5939
5939
|
});
|
|
5940
5940
|
function inlinableSubExpression(expr) {
|
|
@@ -6070,7 +6070,7 @@ function getArgSafety(state, func, args, requireAll) {
|
|
|
6070
6070
|
case "AssignmentExpression":
|
|
6071
6071
|
case "UpdateExpression": {
|
|
6072
6072
|
const v = node.type === "UpdateExpression" ? node.argument : node.left;
|
|
6073
|
-
if (v.type === "Identifier" && (0,
|
|
6073
|
+
if (v.type === "Identifier" && (0, import_chunk_JDC43A3I.hasProperty)(params, v.name)) {
|
|
6074
6074
|
safeArgs[params[v.name]] = null;
|
|
6075
6075
|
break;
|
|
6076
6076
|
}
|
|
@@ -6116,7 +6116,7 @@ function getArgSafety(state, func, args, requireAll) {
|
|
|
6116
6116
|
}
|
|
6117
6117
|
break;
|
|
6118
6118
|
case "Identifier":
|
|
6119
|
-
if ((0,
|
|
6119
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(params, node.name) && !safeArgs[params[node.name]] && (modifiedUnknown || !argDecls[params[node.name]] || modifiedDecls.has(argDecls[params[node.name]]) || Array.from(callsSeen).some(
|
|
6120
6120
|
(callee) => functionMayModify(state, callee, argDecls[params[node.name]])
|
|
6121
6121
|
))) {
|
|
6122
6122
|
safeArgs[params[node.name]] = null;
|
|
@@ -6195,7 +6195,7 @@ function inliningLooksUseful(state, func, node) {
|
|
|
6195
6195
|
function inlineRequestedNode(state, func) {
|
|
6196
6196
|
const excludeAnnotations = func.loc?.source && state.fnMap[func.loc?.source]?.excludeAnnotations || {};
|
|
6197
6197
|
if (func.attrs && func.attrs.attributes && func.attrs.attributes.elements.some(
|
|
6198
|
-
(attr) => attr.type === "UnaryExpression" && (attr.argument.name === "inline" || attr.argument.name.startsWith("inline_") && !(0,
|
|
6198
|
+
(attr) => attr.type === "UnaryExpression" && (attr.argument.name === "inline" || attr.argument.name.startsWith("inline_") && !(0, import_chunk_JDC43A3I.hasProperty)(excludeAnnotations, attr.argument.name.substring(7)))
|
|
6199
6199
|
)) {
|
|
6200
6200
|
return true;
|
|
6201
6201
|
}
|
|
@@ -6309,7 +6309,7 @@ function processInlineBody(state, func, call, root, params) {
|
|
|
6309
6309
|
const fixId = (node) => {
|
|
6310
6310
|
if (state.inType)
|
|
6311
6311
|
return null;
|
|
6312
|
-
if ((0,
|
|
6312
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(params, node.name)) {
|
|
6313
6313
|
const ix = params[node.name];
|
|
6314
6314
|
if (ix >= 0) {
|
|
6315
6315
|
const replacement2 = { ...call.arguments[ix] };
|
|
@@ -6379,7 +6379,7 @@ function processInlineBody(state, func, call, root, params) {
|
|
|
6379
6379
|
}
|
|
6380
6380
|
}
|
|
6381
6381
|
function unused(state, expression, top) {
|
|
6382
|
-
const estmt = (expression2) => (0,
|
|
6382
|
+
const estmt = (expression2) => (0, import_chunk_JDC43A3I.withLoc)(
|
|
6383
6383
|
{
|
|
6384
6384
|
type: "ExpressionStatement",
|
|
6385
6385
|
expression: expression2
|
|
@@ -6404,7 +6404,7 @@ function unused(state, expression, top) {
|
|
|
6404
6404
|
const right = unused(state, expression.right);
|
|
6405
6405
|
if (!right.length)
|
|
6406
6406
|
return unused(state, expression.left);
|
|
6407
|
-
const consequent = (0,
|
|
6407
|
+
const consequent = (0, import_chunk_JDC43A3I.withLoc)(
|
|
6408
6408
|
{
|
|
6409
6409
|
type: "BlockStatement",
|
|
6410
6410
|
body: [estmt(expression.right)]
|
|
@@ -6417,7 +6417,7 @@ function unused(state, expression, top) {
|
|
|
6417
6417
|
consequent.body = [];
|
|
6418
6418
|
}
|
|
6419
6419
|
return [
|
|
6420
|
-
(0,
|
|
6420
|
+
(0, import_chunk_JDC43A3I.withLoc)(
|
|
6421
6421
|
{
|
|
6422
6422
|
type: "IfStatement",
|
|
6423
6423
|
test: expression.left,
|
|
@@ -6435,18 +6435,18 @@ function unused(state, expression, top) {
|
|
|
6435
6435
|
return unused(state, expression.test);
|
|
6436
6436
|
}
|
|
6437
6437
|
return [
|
|
6438
|
-
(0,
|
|
6438
|
+
(0, import_chunk_JDC43A3I.withLoc)(
|
|
6439
6439
|
{
|
|
6440
6440
|
type: "IfStatement",
|
|
6441
6441
|
test: expression.test,
|
|
6442
|
-
consequent: (0,
|
|
6442
|
+
consequent: (0, import_chunk_JDC43A3I.withLoc)(
|
|
6443
6443
|
{
|
|
6444
6444
|
type: "BlockStatement",
|
|
6445
6445
|
body: consequentExprs
|
|
6446
6446
|
},
|
|
6447
6447
|
expression.consequent
|
|
6448
6448
|
),
|
|
6449
|
-
alternate: (0,
|
|
6449
|
+
alternate: (0, import_chunk_JDC43A3I.withLoc)(
|
|
6450
6450
|
{
|
|
6451
6451
|
type: "BlockStatement",
|
|
6452
6452
|
body: alternateExprs
|
|
@@ -6514,7 +6514,7 @@ function inlineWithArgs(state, func, call, context) {
|
|
|
6514
6514
|
return null;
|
|
6515
6515
|
}
|
|
6516
6516
|
} else {
|
|
6517
|
-
(0,
|
|
6517
|
+
(0, import_chunk_JDC43A3I.traverseAst)(func.node.body, (node) => {
|
|
6518
6518
|
node.type === "ReturnStatement" && retStmtCount++;
|
|
6519
6519
|
});
|
|
6520
6520
|
if (retStmtCount > 1) {
|
|
@@ -6548,7 +6548,7 @@ function inlineWithArgs(state, func, call, context) {
|
|
|
6548
6548
|
}
|
|
6549
6549
|
}
|
|
6550
6550
|
}
|
|
6551
|
-
const body = (0,
|
|
6551
|
+
const body = (0, import_chunk_JDC43A3I.cloneDeep)(func.node.body);
|
|
6552
6552
|
const safeArgs = getArgSafety(state, func, call.arguments, false);
|
|
6553
6553
|
const params = Object.fromEntries(
|
|
6554
6554
|
func.node.params.map((param, i) => {
|
|
@@ -6636,7 +6636,7 @@ function updateLocationForInline(node, original, context, func) {
|
|
|
6636
6636
|
if (!loc) {
|
|
6637
6637
|
throw new Error("Internal error: Inlined call had no location info");
|
|
6638
6638
|
}
|
|
6639
|
-
(0,
|
|
6639
|
+
(0, import_chunk_JDC43A3I.traverseAst)(node, (node2) => {
|
|
6640
6640
|
if (!node2.loc || node2.loc.source !== loc.source || node2.loc.start.offset > loc.end.offset || node2.loc.end.offset <= loc.start.offset) {
|
|
6641
6641
|
if (node2.loc) {
|
|
6642
6642
|
if (!node2.origins) {
|
|
@@ -6644,7 +6644,7 @@ function updateLocationForInline(node, original, context, func) {
|
|
|
6644
6644
|
}
|
|
6645
6645
|
node2.origins.unshift({ loc: node2.loc, func: func.fullName });
|
|
6646
6646
|
}
|
|
6647
|
-
(0,
|
|
6647
|
+
(0, import_chunk_JDC43A3I.withLoc)(node2, context, context === original ? context : false);
|
|
6648
6648
|
}
|
|
6649
6649
|
});
|
|
6650
6650
|
return node;
|
|
@@ -6656,7 +6656,7 @@ function inlineFunctionHelper(state, func, call, context) {
|
|
|
6656
6656
|
if (context) {
|
|
6657
6657
|
return inlineWithArgs(state, func, call, context);
|
|
6658
6658
|
}
|
|
6659
|
-
const retArg = (0,
|
|
6659
|
+
const retArg = (0, import_chunk_JDC43A3I.cloneDeep)(
|
|
6660
6660
|
func.node.body.body[0].argument
|
|
6661
6661
|
);
|
|
6662
6662
|
const params = Object.fromEntries(
|
|
@@ -6693,7 +6693,7 @@ function inlineFunction(state, func, call, context) {
|
|
|
6693
6693
|
return ret;
|
|
6694
6694
|
}
|
|
6695
6695
|
if (!caller.attrs) {
|
|
6696
|
-
caller.attrs = (0,
|
|
6696
|
+
caller.attrs = (0, import_chunk_JDC43A3I.withLoc)(
|
|
6697
6697
|
{
|
|
6698
6698
|
type: "AttributeList"
|
|
6699
6699
|
},
|
|
@@ -6702,7 +6702,7 @@ function inlineFunction(state, func, call, context) {
|
|
|
6702
6702
|
);
|
|
6703
6703
|
}
|
|
6704
6704
|
if (!caller.attrs.attributes) {
|
|
6705
|
-
caller.attrs.attributes = (0,
|
|
6705
|
+
caller.attrs.attributes = (0, import_chunk_JDC43A3I.withLoc)(
|
|
6706
6706
|
{ type: "Attributes", elements: [] },
|
|
6707
6707
|
caller.attrs,
|
|
6708
6708
|
false
|
|
@@ -6710,7 +6710,7 @@ function inlineFunction(state, func, call, context) {
|
|
|
6710
6710
|
}
|
|
6711
6711
|
caller.attrs.attributes.elements.unshift(
|
|
6712
6712
|
...typecheckAttrs.map(
|
|
6713
|
-
(typecheck) => (0,
|
|
6713
|
+
(typecheck) => (0, import_chunk_JDC43A3I.withLocDeep)({ ...typecheck }, caller.attrs, false)
|
|
6714
6714
|
)
|
|
6715
6715
|
);
|
|
6716
6716
|
return ret;
|
|
@@ -6732,7 +6732,7 @@ function fixNodeScope(state, lookupNode, nodeStack) {
|
|
|
6732
6732
|
const { map: map2 } = locals;
|
|
6733
6733
|
if (!map2)
|
|
6734
6734
|
throw new Error("No local variable map!");
|
|
6735
|
-
if ((0,
|
|
6735
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(map2, lookupNode.name) && map2[lookupNode.name] !== false) {
|
|
6736
6736
|
return lookupNode;
|
|
6737
6737
|
}
|
|
6738
6738
|
}
|
|
@@ -6812,7 +6812,7 @@ function fixNodeScope(state, lookupNode, nodeStack) {
|
|
|
6812
6812
|
return null;
|
|
6813
6813
|
}
|
|
6814
6814
|
function reportFailedInlining(state, ast) {
|
|
6815
|
-
(0,
|
|
6815
|
+
(0, import_chunk_JDC43A3I.traverseAst)(ast, (node) => {
|
|
6816
6816
|
switch (node.type) {
|
|
6817
6817
|
case "FunctionDeclaration":
|
|
6818
6818
|
if (inlineRequestedNode(state, node)) {
|
|
@@ -6837,7 +6837,7 @@ var init_inliner = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
6837
6837
|
"src/inliner.ts"() {
|
|
6838
6838
|
"use strict";
|
|
6839
6839
|
init_api();
|
|
6840
|
-
(0,
|
|
6840
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
6841
6841
|
init_function_info();
|
|
6842
6842
|
init_optimizer_types();
|
|
6843
6843
|
init_variable_renamer();
|
|
@@ -6907,7 +6907,7 @@ function pragmaChecker(state, ast, diagnostics) {
|
|
|
6907
6907
|
};
|
|
6908
6908
|
next();
|
|
6909
6909
|
let promise = Promise.resolve();
|
|
6910
|
-
(0,
|
|
6910
|
+
(0, import_chunk_JDC43A3I.traverseAst)(ast, (node) => {
|
|
6911
6911
|
if (index >= comments.length || node.type === "Line" || node.type === "Block" || node.type === "MultiLine") {
|
|
6912
6912
|
return false;
|
|
6913
6913
|
}
|
|
@@ -6987,7 +6987,7 @@ var init_pragma_checker = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
6987
6987
|
"src/pragma-checker.ts"() {
|
|
6988
6988
|
"use strict";
|
|
6989
6989
|
init_api();
|
|
6990
|
-
(0,
|
|
6990
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
6991
6991
|
}
|
|
6992
6992
|
});
|
|
6993
6993
|
function buildReducedGraph(state, func, refsForUpdate, notice) {
|
|
@@ -7006,14 +7006,14 @@ function buildReducedGraph(state, func, refsForUpdate, notice) {
|
|
|
7006
7006
|
if (state.inType || localState.unreachable) {
|
|
7007
7007
|
return [];
|
|
7008
7008
|
}
|
|
7009
|
-
if (!localState.curBlock.node && ((0,
|
|
7009
|
+
if (!localState.curBlock.node && ((0, import_chunk_JDC43A3I.isStatement)(node) || (0, import_chunk_JDC43A3I.isExpression)(node))) {
|
|
7010
7010
|
localState.curBlock.node = node;
|
|
7011
7011
|
}
|
|
7012
7012
|
let topTest = testStack[testStack.length - 1];
|
|
7013
7013
|
if (topTest.node !== node && topTest.true) {
|
|
7014
7014
|
testStack.push(topTest = { node });
|
|
7015
7015
|
}
|
|
7016
|
-
if ((0,
|
|
7016
|
+
if ((0, import_chunk_JDC43A3I.isStatement)(node)) {
|
|
7017
7017
|
stmtStack.push(node);
|
|
7018
7018
|
}
|
|
7019
7019
|
switch (node.type) {
|
|
@@ -7330,7 +7330,7 @@ function buildReducedGraph(state, func, refsForUpdate, notice) {
|
|
|
7330
7330
|
const curStmt = stmtStack[stmtStack.length - 1];
|
|
7331
7331
|
const topTest = testStack[testStack.length - 1];
|
|
7332
7332
|
if (!state.inType) {
|
|
7333
|
-
const throws = tryActive > 0 && (0,
|
|
7333
|
+
const throws = tryActive > 0 && (0, import_chunk_JDC43A3I.mayThrow)(node);
|
|
7334
7334
|
const events = notice(node, curStmt, throws, getContainedEvents);
|
|
7335
7335
|
if (throws) {
|
|
7336
7336
|
if (!events) {
|
|
@@ -7391,7 +7391,7 @@ function buildReducedGraph(state, func, refsForUpdate, notice) {
|
|
|
7391
7391
|
}
|
|
7392
7392
|
if (curStmt === node) {
|
|
7393
7393
|
stmtStack.pop();
|
|
7394
|
-
} else if (localState.unreachable && curStmt.type === "BlockStatement" && (0,
|
|
7394
|
+
} else if (localState.unreachable && curStmt.type === "BlockStatement" && (0, import_chunk_JDC43A3I.isStatement)(node)) {
|
|
7395
7395
|
return false;
|
|
7396
7396
|
}
|
|
7397
7397
|
return null;
|
|
@@ -7485,7 +7485,7 @@ var Terminals, LocalState;
|
|
|
7485
7485
|
var init_control_flow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
7486
7486
|
"src/control-flow.ts"() {
|
|
7487
7487
|
"use strict";
|
|
7488
|
-
(0,
|
|
7488
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
7489
7489
|
(0, import_chunk_OASVKTK5.init_util)();
|
|
7490
7490
|
Terminals = {
|
|
7491
7491
|
BreakStatement: "break",
|
|
@@ -7853,7 +7853,7 @@ function mergeObjectValues(to, from) {
|
|
|
7853
7853
|
let empty = true;
|
|
7854
7854
|
let result = to;
|
|
7855
7855
|
Object.entries(to).forEach(([key, value2]) => {
|
|
7856
|
-
if (!(0,
|
|
7856
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(from, key)) {
|
|
7857
7857
|
if (result === to)
|
|
7858
7858
|
result = { ...result };
|
|
7859
7859
|
delete result[key];
|
|
@@ -8041,7 +8041,7 @@ function widenType(t) {
|
|
|
8041
8041
|
var init_union_type = (0, import_chunk_ABYVSU2C.__esm)({
|
|
8042
8042
|
"src/type-flow/union-type.ts"() {
|
|
8043
8043
|
"use strict";
|
|
8044
|
-
(0,
|
|
8044
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
8045
8045
|
init_data_flow();
|
|
8046
8046
|
(0, import_chunk_OASVKTK5.init_util)();
|
|
8047
8047
|
init_could_be();
|
|
@@ -8309,7 +8309,7 @@ function intersectObj(to, from) {
|
|
|
8309
8309
|
return to;
|
|
8310
8310
|
let result = to;
|
|
8311
8311
|
Object.entries(from).forEach(([key, value2]) => {
|
|
8312
|
-
if (!(0,
|
|
8312
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(to, key)) {
|
|
8313
8313
|
if (result === to)
|
|
8314
8314
|
result = { ...result };
|
|
8315
8315
|
result[key] = value2;
|
|
@@ -8724,7 +8724,7 @@ function subtypeOfObj(a, b) {
|
|
|
8724
8724
|
if (!a || !b)
|
|
8725
8725
|
return true;
|
|
8726
8726
|
return Object.entries(b).every(([key, value2]) => {
|
|
8727
|
-
if (!(0,
|
|
8727
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(a, key))
|
|
8728
8728
|
return false;
|
|
8729
8729
|
return subtypeOf(a[key], value2);
|
|
8730
8730
|
});
|
|
@@ -9282,7 +9282,7 @@ function filterDecls(decls, possible, name) {
|
|
|
9282
9282
|
cur[1].add(poss);
|
|
9283
9283
|
break;
|
|
9284
9284
|
}
|
|
9285
|
-
if ((0,
|
|
9285
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(sn.decls, name)) {
|
|
9286
9286
|
break;
|
|
9287
9287
|
}
|
|
9288
9288
|
}
|
|
@@ -9308,7 +9308,7 @@ function findObjectDeclsByProperty(state, object, next) {
|
|
|
9308
9308
|
const decls = getStateNodeDeclsFromType(state, object);
|
|
9309
9309
|
if (!decls)
|
|
9310
9310
|
return [null, null];
|
|
9311
|
-
const possibleDecls = (0,
|
|
9311
|
+
const possibleDecls = (0, import_chunk_JDC43A3I.hasProperty)(state.allDeclarations, next.name) && state.allDeclarations[next.name];
|
|
9312
9312
|
return filterDecls(decls, possibleDecls, next.name);
|
|
9313
9313
|
}
|
|
9314
9314
|
function refineObjectTypeByDecls(istate, object, trueDecls) {
|
|
@@ -9581,7 +9581,7 @@ function isOverride(cur, funcs) {
|
|
|
9581
9581
|
}
|
|
9582
9582
|
function sysCallInfo(state, func) {
|
|
9583
9583
|
const info = getSystemCallTable(state);
|
|
9584
|
-
if ((0,
|
|
9584
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(info, func.fullName)) {
|
|
9585
9585
|
return info[func.fullName];
|
|
9586
9586
|
}
|
|
9587
9587
|
return null;
|
|
@@ -9922,7 +9922,7 @@ function getSystemCallTable(state) {
|
|
|
9922
9922
|
};
|
|
9923
9923
|
const mathHelper = (state2, callee, calleeObj, getArgs, helper) => {
|
|
9924
9924
|
const results = {};
|
|
9925
|
-
const fn = helper && typeof helper === "function" ? helper : (0,
|
|
9925
|
+
const fn = helper && typeof helper === "function" ? helper : (0, import_chunk_JDC43A3I.hasProperty)(Math, helper || callee.name) && Math[helper || callee.name];
|
|
9926
9926
|
if (fn && typeof fn === "function") {
|
|
9927
9927
|
results.effectFree = true;
|
|
9928
9928
|
const args = getArgs();
|
|
@@ -10051,7 +10051,7 @@ function expandKeys(state, table) {
|
|
|
10051
10051
|
);
|
|
10052
10052
|
decls.forEach((decl) => {
|
|
10053
10053
|
if (decl.type === "FunctionDeclaration") {
|
|
10054
|
-
if (!(0,
|
|
10054
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(result, decl.fullName)) {
|
|
10055
10055
|
result[decl.fullName] = value2;
|
|
10056
10056
|
}
|
|
10057
10057
|
}
|
|
@@ -10256,9 +10256,9 @@ function evaluate(istate, node) {
|
|
|
10256
10256
|
}
|
|
10257
10257
|
return null;
|
|
10258
10258
|
};
|
|
10259
|
-
(0,
|
|
10259
|
+
(0, import_chunk_JDC43A3I.traverseAst)(node, pre, post);
|
|
10260
10260
|
const ret = istate.stack.pop();
|
|
10261
|
-
if ((0,
|
|
10261
|
+
if ((0, import_chunk_JDC43A3I.isExpression)(node)) {
|
|
10262
10262
|
if (!ret || node !== ret.node) {
|
|
10263
10263
|
throw new Error("evaluate failed to produce a value for an expression");
|
|
10264
10264
|
}
|
|
@@ -11200,7 +11200,7 @@ var init_interp = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
11200
11200
|
"src/type-flow/interp.ts"() {
|
|
11201
11201
|
"use strict";
|
|
11202
11202
|
init_api();
|
|
11203
|
-
(0,
|
|
11203
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
11204
11204
|
init_data_flow();
|
|
11205
11205
|
init_optimizer_types();
|
|
11206
11206
|
(0, import_chunk_OASVKTK5.init_util)();
|
|
@@ -11459,7 +11459,7 @@ function typeFromTypeStateNode(state, sn, classVsObj) {
|
|
|
11459
11459
|
declared = typeFromTypespec(state, sn.node.id.right, sn.stack);
|
|
11460
11460
|
}
|
|
11461
11461
|
if (sn.node.kind === "const" && sn.node.init) {
|
|
11462
|
-
if ((0,
|
|
11462
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(sn, "resolvedType")) {
|
|
11463
11463
|
return declared ?? {
|
|
11464
11464
|
type: 524287
|
|
11465
11465
|
/* Any */
|
|
@@ -11640,7 +11640,7 @@ function typeFromSingleTypeSpec(state, type, stack) {
|
|
|
11640
11640
|
value: { result, args }
|
|
11641
11641
|
};
|
|
11642
11642
|
}
|
|
11643
|
-
const id = typeof type.name === "string" ? (0,
|
|
11643
|
+
const id = typeof type.name === "string" ? (0, import_chunk_JDC43A3I.makeScopedName)(type.name) : type.name;
|
|
11644
11644
|
const [, results] = state.lookupType(id, null, stack);
|
|
11645
11645
|
if (!results) {
|
|
11646
11646
|
if (id.type === "Identifier") {
|
|
@@ -11719,7 +11719,7 @@ function typeFromTypespec(state, ts, stack) {
|
|
|
11719
11719
|
);
|
|
11720
11720
|
}
|
|
11721
11721
|
function typeFromLiteral(literal) {
|
|
11722
|
-
const [value2, type] = (0,
|
|
11722
|
+
const [value2, type] = (0, import_chunk_JDC43A3I.getNodeValue)(literal);
|
|
11723
11723
|
switch (type) {
|
|
11724
11724
|
case "Null":
|
|
11725
11725
|
return {
|
|
@@ -12126,7 +12126,7 @@ var init_types = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
12126
12126
|
"use strict";
|
|
12127
12127
|
init_data_flow();
|
|
12128
12128
|
init_api();
|
|
12129
|
-
(0,
|
|
12129
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
12130
12130
|
(0, import_chunk_OASVKTK5.init_util)();
|
|
12131
12131
|
init_interp();
|
|
12132
12132
|
init_union_type();
|
|
@@ -12290,7 +12290,7 @@ function couldBeObj(a, b) {
|
|
|
12290
12290
|
if (!a || !b)
|
|
12291
12291
|
return true;
|
|
12292
12292
|
return Object.entries(a).every(([key, value2]) => {
|
|
12293
|
-
if (!(0,
|
|
12293
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(b, key))
|
|
12294
12294
|
return true;
|
|
12295
12295
|
return couldBe(value2, b[key]);
|
|
12296
12296
|
});
|
|
@@ -12588,7 +12588,7 @@ function eliminateDeadStores(state, func, graph, logThisRun) {
|
|
|
12588
12588
|
);
|
|
12589
12589
|
}
|
|
12590
12590
|
let changes = false;
|
|
12591
|
-
(0,
|
|
12591
|
+
(0, import_chunk_JDC43A3I.traverseAst)(func.node.body, null, (node) => {
|
|
12592
12592
|
const cleaned = variableCleanup(node);
|
|
12593
12593
|
if (cleaned !== null)
|
|
12594
12594
|
return cleaned;
|
|
@@ -12598,7 +12598,7 @@ function eliminateDeadStores(state, func, graph, logThisRun) {
|
|
|
12598
12598
|
);
|
|
12599
12599
|
changes = true;
|
|
12600
12600
|
if (body.length) {
|
|
12601
|
-
return (0,
|
|
12601
|
+
return (0, import_chunk_JDC43A3I.withLoc)({ type: "BlockStatement", body }, node, node);
|
|
12602
12602
|
}
|
|
12603
12603
|
return false;
|
|
12604
12604
|
}
|
|
@@ -12631,7 +12631,7 @@ var init_dead_store = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
12631
12631
|
"src/type-flow/dead-store.ts"() {
|
|
12632
12632
|
"use strict";
|
|
12633
12633
|
init_api();
|
|
12634
|
-
(0,
|
|
12634
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
12635
12635
|
init_control_flow();
|
|
12636
12636
|
init_data_flow();
|
|
12637
12637
|
init_inliner();
|
|
@@ -13087,7 +13087,7 @@ function updateAffected(blockState, objectType, baseDecl, assignedPath, affected
|
|
|
13087
13087
|
type = newType;
|
|
13088
13088
|
} else {
|
|
13089
13089
|
const objValue = getObjectValue(type);
|
|
13090
|
-
if (!objValue || !(0,
|
|
13090
|
+
if (!objValue || !(0, import_chunk_JDC43A3I.hasProperty)(objValue.obj, pathItem)) {
|
|
13091
13091
|
break;
|
|
13092
13092
|
}
|
|
13093
13093
|
type = objValue.obj[pathItem];
|
|
@@ -13150,7 +13150,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13150
13150
|
const value2 = getObjectValue(cur);
|
|
13151
13151
|
if (i === l && newValue) {
|
|
13152
13152
|
next = newValue;
|
|
13153
|
-
} else if (value2 && (0,
|
|
13153
|
+
} else if (value2 && (0, import_chunk_JDC43A3I.hasProperty)(value2.obj, me.property.name)) {
|
|
13154
13154
|
next = value2.obj[me.property.name];
|
|
13155
13155
|
} else {
|
|
13156
13156
|
const [objDecls, trueDecls] = findObjectDeclsByProperty(
|
|
@@ -14317,16 +14317,16 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14317
14317
|
}
|
|
14318
14318
|
})
|
|
14319
14319
|
);
|
|
14320
|
-
(0,
|
|
14320
|
+
(0, import_chunk_JDC43A3I.traverseAst)(
|
|
14321
14321
|
func.node.body,
|
|
14322
14322
|
(node) => {
|
|
14323
14323
|
if (node.type === "AssignmentExpression" && node.operator !== "=" && nodeCopyProp.has(node.left)) {
|
|
14324
|
-
const left = (0,
|
|
14325
|
-
const right = (0,
|
|
14324
|
+
const left = (0, import_chunk_JDC43A3I.cloneDeep)(node.left);
|
|
14325
|
+
const right = (0, import_chunk_JDC43A3I.withLoc)(
|
|
14326
14326
|
{
|
|
14327
14327
|
type: "BinaryExpression",
|
|
14328
14328
|
operator: node.operator.slice(0, -1),
|
|
14329
|
-
left: (0,
|
|
14329
|
+
left: (0, import_chunk_JDC43A3I.withLocDeep)(node.left, node.right, false, true),
|
|
14330
14330
|
right: node.right
|
|
14331
14331
|
},
|
|
14332
14332
|
node.left,
|
|
@@ -14348,7 +14348,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14348
14348
|
)
|
|
14349
14349
|
);
|
|
14350
14350
|
}
|
|
14351
|
-
return (0,
|
|
14351
|
+
return (0, import_chunk_JDC43A3I.withLoc)(
|
|
14352
14352
|
{ type: "Literal", value: null, raw: "null" },
|
|
14353
14353
|
node,
|
|
14354
14354
|
node
|
|
@@ -14386,7 +14386,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14386
14386
|
)
|
|
14387
14387
|
);
|
|
14388
14388
|
}
|
|
14389
|
-
return (0,
|
|
14389
|
+
return (0, import_chunk_JDC43A3I.withLocDeep)(replacement2, node, node, false);
|
|
14390
14390
|
} else if (copyNode.type === "VariableDeclarator") {
|
|
14391
14391
|
const init = copyNode.init;
|
|
14392
14392
|
(0, import_node_assert3.default)(init);
|
|
@@ -14399,7 +14399,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14399
14399
|
)
|
|
14400
14400
|
);
|
|
14401
14401
|
}
|
|
14402
|
-
return (0,
|
|
14402
|
+
return (0, import_chunk_JDC43A3I.withLocDeep)(init, node, node, false);
|
|
14403
14403
|
}
|
|
14404
14404
|
(0, import_node_assert3.default)(false);
|
|
14405
14405
|
}
|
|
@@ -14413,7 +14413,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14413
14413
|
)
|
|
14414
14414
|
);
|
|
14415
14415
|
}
|
|
14416
|
-
return (0,
|
|
14416
|
+
return (0, import_chunk_JDC43A3I.withLoc)(
|
|
14417
14417
|
{ type: "Literal", value: null, raw: "null" },
|
|
14418
14418
|
node,
|
|
14419
14419
|
node
|
|
@@ -14465,7 +14465,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14465
14465
|
)
|
|
14466
14466
|
);
|
|
14467
14467
|
}
|
|
14468
|
-
const replacement = (0,
|
|
14468
|
+
const replacement = (0, import_chunk_JDC43A3I.withLoc)({ type: "Identifier", name }, node, node);
|
|
14469
14469
|
const tm = typeMap.get(node);
|
|
14470
14470
|
if (tm)
|
|
14471
14471
|
typeMap.set(replacement, tm);
|
|
@@ -14573,7 +14573,7 @@ var init_type_flow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
14573
14573
|
"src/type-flow.ts"() {
|
|
14574
14574
|
"use strict";
|
|
14575
14575
|
init_api();
|
|
14576
|
-
(0,
|
|
14576
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
14577
14577
|
init_control_flow();
|
|
14578
14578
|
init_data_flow();
|
|
14579
14579
|
init_function_info();
|
|
@@ -14712,11 +14712,11 @@ function minimizeLocals(state, func) {
|
|
|
14712
14712
|
};
|
|
14713
14713
|
if (sn.node.body.length && sn.node.body[0].type === "VariableDeclaration") {
|
|
14714
14714
|
sn.node.body[0].declarations.unshift(
|
|
14715
|
-
(0,
|
|
14715
|
+
(0, import_chunk_JDC43A3I.withLocDeep)(varDecl, sn.node.body[0], false, true)
|
|
14716
14716
|
);
|
|
14717
14717
|
} else {
|
|
14718
14718
|
sn.node.body.unshift(
|
|
14719
|
-
(0,
|
|
14719
|
+
(0, import_chunk_JDC43A3I.withLocDeep)(
|
|
14720
14720
|
{
|
|
14721
14721
|
type: "VariableDeclaration",
|
|
14722
14722
|
declarations: [varDecl],
|
|
@@ -14743,7 +14743,7 @@ function minimizeLocals(state, func) {
|
|
|
14743
14743
|
nodeMap.set(event.node, rep);
|
|
14744
14744
|
})
|
|
14745
14745
|
);
|
|
14746
|
-
(0,
|
|
14746
|
+
(0, import_chunk_JDC43A3I.traverseAst)(func.node.body, null, (node) => {
|
|
14747
14747
|
const info = nodeMap.get(node);
|
|
14748
14748
|
switch (node.type) {
|
|
14749
14749
|
case "Identifier":
|
|
@@ -14755,7 +14755,7 @@ function minimizeLocals(state, func) {
|
|
|
14755
14755
|
if (info) {
|
|
14756
14756
|
(0, import_node_assert4.default)(node.left.type === "Identifier");
|
|
14757
14757
|
if (node.right.type === "Identifier" && node.right.name === info.name && node.operator === "=") {
|
|
14758
|
-
return (0,
|
|
14758
|
+
return (0, import_chunk_JDC43A3I.withLoc)(
|
|
14759
14759
|
{ type: "Literal", value: null, raw: "null" },
|
|
14760
14760
|
node,
|
|
14761
14761
|
node
|
|
@@ -14784,11 +14784,11 @@ function minimizeLocals(state, func) {
|
|
|
14784
14784
|
if (node.init.type === "Identifier" && node.init.name === info.name) {
|
|
14785
14785
|
return false;
|
|
14786
14786
|
}
|
|
14787
|
-
return (0,
|
|
14787
|
+
return (0, import_chunk_JDC43A3I.withLoc)(
|
|
14788
14788
|
{
|
|
14789
14789
|
type: "AssignmentExpression",
|
|
14790
14790
|
operator: "=",
|
|
14791
|
-
left: (0,
|
|
14791
|
+
left: (0, import_chunk_JDC43A3I.withLoc)(
|
|
14792
14792
|
{
|
|
14793
14793
|
type: "Identifier",
|
|
14794
14794
|
name: info.name,
|
|
@@ -14824,11 +14824,11 @@ function variableCleanup(node) {
|
|
|
14824
14824
|
const results = [];
|
|
14825
14825
|
node.declarations.forEach(
|
|
14826
14826
|
(decl) => {
|
|
14827
|
-
if ((0,
|
|
14827
|
+
if ((0, import_chunk_JDC43A3I.isStatement)(decl)) {
|
|
14828
14828
|
results.push(decl);
|
|
14829
|
-
} else if ((0,
|
|
14829
|
+
} else if ((0, import_chunk_JDC43A3I.isExpression)(decl)) {
|
|
14830
14830
|
results.push(
|
|
14831
|
-
(0,
|
|
14831
|
+
(0, import_chunk_JDC43A3I.withLoc)(
|
|
14832
14832
|
{ type: "ExpressionStatement", expression: decl },
|
|
14833
14833
|
decl,
|
|
14834
14834
|
decl
|
|
@@ -14836,14 +14836,14 @@ function variableCleanup(node) {
|
|
|
14836
14836
|
);
|
|
14837
14837
|
} else if (decl.init) {
|
|
14838
14838
|
results.push(
|
|
14839
|
-
(0,
|
|
14839
|
+
(0, import_chunk_JDC43A3I.withLoc)(
|
|
14840
14840
|
{
|
|
14841
14841
|
type: "ExpressionStatement",
|
|
14842
|
-
expression: (0,
|
|
14842
|
+
expression: (0, import_chunk_JDC43A3I.withLoc)(
|
|
14843
14843
|
{
|
|
14844
14844
|
type: "AssignmentExpression",
|
|
14845
14845
|
operator: "=",
|
|
14846
|
-
left: (0,
|
|
14846
|
+
left: (0, import_chunk_JDC43A3I.withLoc)(
|
|
14847
14847
|
{
|
|
14848
14848
|
type: "Identifier",
|
|
14849
14849
|
name: variableDeclarationName(decl.id)
|
|
@@ -14872,7 +14872,7 @@ function variableCleanup(node) {
|
|
|
14872
14872
|
return false;
|
|
14873
14873
|
});
|
|
14874
14874
|
if (node.declarations.length) {
|
|
14875
|
-
(0,
|
|
14875
|
+
(0, import_chunk_JDC43A3I.withLocDeep)(node, node, false);
|
|
14876
14876
|
results.unshift(node);
|
|
14877
14877
|
}
|
|
14878
14878
|
return results;
|
|
@@ -14909,7 +14909,7 @@ var init_minimize_locals = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
14909
14909
|
"src/type-flow/minimize-locals.ts"() {
|
|
14910
14910
|
"use strict";
|
|
14911
14911
|
init_api();
|
|
14912
|
-
(0,
|
|
14912
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
14913
14913
|
init_control_flow();
|
|
14914
14914
|
init_type_flow();
|
|
14915
14915
|
(0, import_chunk_OASVKTK5.init_util)();
|
|
@@ -14950,7 +14950,7 @@ async function sizeBasedPRE(state, func) {
|
|
|
14950
14950
|
}
|
|
14951
14951
|
const nodeMap = /* @__PURE__ */ new Map();
|
|
14952
14952
|
const declMap = /* @__PURE__ */ new Map();
|
|
14953
|
-
const variableDecl = (0,
|
|
14953
|
+
const variableDecl = (0, import_chunk_JDC43A3I.withLoc)(
|
|
14954
14954
|
{
|
|
14955
14955
|
type: "VariableDeclaration",
|
|
14956
14956
|
declarations: [],
|
|
@@ -14976,10 +14976,10 @@ async function sizeBasedPRE(state, func) {
|
|
|
14976
14976
|
declMap.set(decl, name);
|
|
14977
14977
|
const s = candidates.get(decl);
|
|
14978
14978
|
variableDecl.declarations.push(
|
|
14979
|
-
(0,
|
|
14979
|
+
(0, import_chunk_JDC43A3I.withLoc)(
|
|
14980
14980
|
{
|
|
14981
14981
|
type: "VariableDeclarator",
|
|
14982
|
-
id: (0,
|
|
14982
|
+
id: (0, import_chunk_JDC43A3I.withLoc)({ type: "Identifier", name }, variableDecl),
|
|
14983
14983
|
kind: "var"
|
|
14984
14984
|
},
|
|
14985
14985
|
variableDecl
|
|
@@ -15410,14 +15410,14 @@ function computeAttributes(state, head) {
|
|
|
15410
15410
|
}
|
|
15411
15411
|
function applyReplacements(func, nodeMap, declMap) {
|
|
15412
15412
|
const ident = (name, node) => {
|
|
15413
|
-
return (0,
|
|
15413
|
+
return (0, import_chunk_JDC43A3I.withLoc)({ type: "Identifier", name }, node);
|
|
15414
15414
|
};
|
|
15415
15415
|
const pendingMap = /* @__PURE__ */ new Map();
|
|
15416
15416
|
const stmtStack = [func];
|
|
15417
|
-
(0,
|
|
15417
|
+
(0, import_chunk_JDC43A3I.traverseAst)(
|
|
15418
15418
|
func,
|
|
15419
15419
|
(node) => {
|
|
15420
|
-
if ((0,
|
|
15420
|
+
if ((0, import_chunk_JDC43A3I.isStatement)(node)) {
|
|
15421
15421
|
stmtStack.push(node);
|
|
15422
15422
|
}
|
|
15423
15423
|
},
|
|
@@ -15470,7 +15470,7 @@ function applyReplacements(func, nodeMap, declMap) {
|
|
|
15470
15470
|
);
|
|
15471
15471
|
}
|
|
15472
15472
|
const id = ident(name, target);
|
|
15473
|
-
const assign = (0,
|
|
15473
|
+
const assign = (0, import_chunk_JDC43A3I.withLoc)(
|
|
15474
15474
|
{
|
|
15475
15475
|
type: "AssignmentExpression",
|
|
15476
15476
|
left: target,
|
|
@@ -15484,7 +15484,7 @@ function applyReplacements(func, nodeMap, declMap) {
|
|
|
15484
15484
|
} else {
|
|
15485
15485
|
node.argument = id;
|
|
15486
15486
|
}
|
|
15487
|
-
return (0,
|
|
15487
|
+
return (0, import_chunk_JDC43A3I.withLoc)(
|
|
15488
15488
|
{ type: "SequenceExpression", expressions: [node, assign] },
|
|
15489
15489
|
node
|
|
15490
15490
|
);
|
|
@@ -15539,15 +15539,15 @@ function applyReplacements(func, nodeMap, declMap) {
|
|
|
15539
15539
|
)
|
|
15540
15540
|
);
|
|
15541
15541
|
}
|
|
15542
|
-
const rhs = (0,
|
|
15542
|
+
const rhs = (0, import_chunk_JDC43A3I.withLocDeep)(event.id, locNode, locNode);
|
|
15543
15543
|
rhs.end = rhs.start;
|
|
15544
15544
|
if (rhs.loc) {
|
|
15545
15545
|
rhs.loc.end = rhs.loc.start;
|
|
15546
15546
|
}
|
|
15547
|
-
const insertion = (0,
|
|
15547
|
+
const insertion = (0, import_chunk_JDC43A3I.withLoc)(
|
|
15548
15548
|
{
|
|
15549
15549
|
type: "ExpressionStatement",
|
|
15550
|
-
expression: (0,
|
|
15550
|
+
expression: (0, import_chunk_JDC43A3I.withLoc)(
|
|
15551
15551
|
{
|
|
15552
15552
|
type: "AssignmentExpression",
|
|
15553
15553
|
left: ident(name, rhs),
|
|
@@ -15593,7 +15593,7 @@ var init_pre = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
15593
15593
|
"src/pre.ts"() {
|
|
15594
15594
|
"use strict";
|
|
15595
15595
|
init_api();
|
|
15596
|
-
(0,
|
|
15596
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
15597
15597
|
init_control_flow();
|
|
15598
15598
|
init_data_flow();
|
|
15599
15599
|
init_function_info();
|
|
@@ -15712,9 +15712,9 @@ function minimizeModules(ast, state) {
|
|
|
15712
15712
|
delete repl.computed;
|
|
15713
15713
|
});
|
|
15714
15714
|
mappedNames.forEach((name, module2) => {
|
|
15715
|
-
const id = (0,
|
|
15716
|
-
const as = name !== (id.type === "Identifier" ? id : id.property).name && (0,
|
|
15717
|
-
const using = (0,
|
|
15715
|
+
const id = (0, import_chunk_JDC43A3I.makeScopedName)(module2.fullName.slice(2));
|
|
15716
|
+
const as = name !== (id.type === "Identifier" ? id : id.property).name && (0, import_chunk_JDC43A3I.makeIdentifier)(name);
|
|
15717
|
+
const using = (0, import_chunk_JDC43A3I.withLocDeep)(
|
|
15718
15718
|
as ? { type: "Using", id, as } : { type: "Using", id },
|
|
15719
15719
|
ast,
|
|
15720
15720
|
false,
|
|
@@ -15782,7 +15782,7 @@ var init_minimize_modules = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
15782
15782
|
"src/type-flow/minimize-modules.ts"() {
|
|
15783
15783
|
"use strict";
|
|
15784
15784
|
init_api();
|
|
15785
|
-
(0,
|
|
15785
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
15786
15786
|
}
|
|
15787
15787
|
});
|
|
15788
15788
|
function beforeEvaluate(istate, node) {
|
|
@@ -15793,7 +15793,7 @@ function beforeEvaluate(istate, node) {
|
|
|
15793
15793
|
if (expression.embeddedEffects) {
|
|
15794
15794
|
istate.stack.push(expression);
|
|
15795
15795
|
} else {
|
|
15796
|
-
const rep = (0,
|
|
15796
|
+
const rep = (0, import_chunk_JDC43A3I.withLoc)(
|
|
15797
15797
|
{ type: "Literal", value: null, raw: "null" },
|
|
15798
15798
|
node,
|
|
15799
15799
|
node
|
|
@@ -15834,7 +15834,7 @@ function beforeEvaluate(istate, node) {
|
|
|
15834
15834
|
}
|
|
15835
15835
|
if (test.value.type === 6 && (consequent.value.type === 4 && alternate.value.type === 2 || consequent.value.type === 2 && alternate.value.type === 4) && !consequent.embeddedEffects && !alternate.embeddedEffects) {
|
|
15836
15836
|
if (consequent.value.type === 2) {
|
|
15837
|
-
test.node = (0,
|
|
15837
|
+
test.node = (0, import_chunk_JDC43A3I.wrap)(
|
|
15838
15838
|
{
|
|
15839
15839
|
type: "UnaryExpression",
|
|
15840
15840
|
operator: "!",
|
|
@@ -15856,7 +15856,7 @@ function beforeEvaluate(istate, node) {
|
|
|
15856
15856
|
}
|
|
15857
15857
|
const test = popIstate(istate, node.test);
|
|
15858
15858
|
if (!node.alternate && node.consequent.type === "BlockStatement" && !node.consequent.body.length) {
|
|
15859
|
-
const ret = (0,
|
|
15859
|
+
const ret = (0, import_chunk_JDC43A3I.withLoc)(node.consequent, node.test, node.test);
|
|
15860
15860
|
const u = test.embeddedEffects && unused(istate.state, node.test);
|
|
15861
15861
|
if (u) {
|
|
15862
15862
|
node.consequent.body = u;
|
|
@@ -15869,7 +15869,7 @@ function beforeEvaluate(istate, node) {
|
|
|
15869
15869
|
if (!test.embeddedEffects) {
|
|
15870
15870
|
return rep;
|
|
15871
15871
|
}
|
|
15872
|
-
const estmt = (0,
|
|
15872
|
+
const estmt = (0, import_chunk_JDC43A3I.wrap)(
|
|
15873
15873
|
{ type: "ExpressionStatement", expression: node.test },
|
|
15874
15874
|
node.loc
|
|
15875
15875
|
);
|
|
@@ -15899,7 +15899,7 @@ function beforeEvaluate(istate, node) {
|
|
|
15899
15899
|
}
|
|
15900
15900
|
let ok = true;
|
|
15901
15901
|
let switchDepth = 0;
|
|
15902
|
-
(0,
|
|
15902
|
+
(0, import_chunk_JDC43A3I.traverseAst)(
|
|
15903
15903
|
node.body,
|
|
15904
15904
|
(n) => {
|
|
15905
15905
|
if (!ok)
|
|
@@ -15943,11 +15943,11 @@ function beforeEvaluate(istate, node) {
|
|
|
15943
15943
|
const [arg] = istate.stack.slice(-1);
|
|
15944
15944
|
if ((arg.value.type & 120) === arg.value.type && arg.value.value == null) {
|
|
15945
15945
|
const leftType = { type: 8, value: 0 };
|
|
15946
|
-
const rep = (0,
|
|
15946
|
+
const rep = (0, import_chunk_JDC43A3I.withLoc)(
|
|
15947
15947
|
{
|
|
15948
15948
|
type: "BinaryExpression",
|
|
15949
15949
|
operator: "-",
|
|
15950
|
-
left: (0,
|
|
15950
|
+
left: (0, import_chunk_JDC43A3I.withLoc)(mcExprFromType(leftType), node.argument, false),
|
|
15951
15951
|
right: node.argument
|
|
15952
15952
|
},
|
|
15953
15953
|
node
|
|
@@ -15970,7 +15970,7 @@ function beforeEvaluate(istate, node) {
|
|
|
15970
15970
|
}
|
|
15971
15971
|
const id = node.right.argument;
|
|
15972
15972
|
if ((0, import_chunk_OASVKTK5.every)(left.value.value, (m) => {
|
|
15973
|
-
if ((0,
|
|
15973
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(m.decls, id.name))
|
|
15974
15974
|
return false;
|
|
15975
15975
|
return istate.state.lookup({
|
|
15976
15976
|
type: "MemberExpression",
|
|
@@ -15981,7 +15981,7 @@ function beforeEvaluate(istate, node) {
|
|
|
15981
15981
|
})) {
|
|
15982
15982
|
popIstate(istate, node.right);
|
|
15983
15983
|
popIstate(istate, node.left);
|
|
15984
|
-
const rep = (0,
|
|
15984
|
+
const rep = (0, import_chunk_JDC43A3I.wrap)(
|
|
15985
15985
|
{ type: "Literal", value: false, raw: "false" },
|
|
15986
15986
|
node.loc
|
|
15987
15987
|
);
|
|
@@ -16098,7 +16098,7 @@ function beforeEvaluate(istate, node) {
|
|
|
16098
16098
|
if (selfAssign) {
|
|
16099
16099
|
popIstate(istate, node.right);
|
|
16100
16100
|
popIstate(istate, node.left);
|
|
16101
|
-
const rep = (0,
|
|
16101
|
+
const rep = (0, import_chunk_JDC43A3I.withLoc)(
|
|
16102
16102
|
{ type: "Literal", value: null, raw: "null" },
|
|
16103
16103
|
node,
|
|
16104
16104
|
node
|
|
@@ -16120,13 +16120,13 @@ function beforeEvaluate(istate, node) {
|
|
|
16120
16120
|
return null;
|
|
16121
16121
|
}
|
|
16122
16122
|
function afterEvaluate(istate, node) {
|
|
16123
|
-
if ((0,
|
|
16123
|
+
if ((0, import_chunk_JDC43A3I.isExpression)(node) && node.type !== "Literal") {
|
|
16124
16124
|
const top = istate.stack[istate.stack.length - 1];
|
|
16125
16125
|
if (!top.embeddedEffects && hasValue(top.value)) {
|
|
16126
16126
|
const rep = mcExprFromType(top.value);
|
|
16127
16127
|
if (rep) {
|
|
16128
16128
|
top.node = rep;
|
|
16129
|
-
return (0,
|
|
16129
|
+
return (0, import_chunk_JDC43A3I.withLoc)(rep, node, node);
|
|
16130
16130
|
}
|
|
16131
16131
|
}
|
|
16132
16132
|
}
|
|
@@ -16238,7 +16238,7 @@ function tryCommuteAndAssociate(istate, node) {
|
|
|
16238
16238
|
switch (node.operator) {
|
|
16239
16239
|
case "-":
|
|
16240
16240
|
if (left.value.type === 8 && left.value.value === -1 && (right.value.type & (8 | 16)) === right.value.type || left.value.type === 16 && left.value.value === -1n && right.value.type === 16) {
|
|
16241
|
-
const rep = (0,
|
|
16241
|
+
const rep = (0, import_chunk_JDC43A3I.withLoc)(
|
|
16242
16242
|
{
|
|
16243
16243
|
type: "UnaryExpression",
|
|
16244
16244
|
operator: "~",
|
|
@@ -16285,11 +16285,11 @@ function tryReAssociate(istate, node, left, right) {
|
|
|
16285
16285
|
if (node.left.type !== "BinaryExpression" || node.left.operator !== node.operator && !(node.operator === "+" && node.left.operator === "-") && !(node.operator === "-" && node.left.operator === "+")) {
|
|
16286
16286
|
return false;
|
|
16287
16287
|
}
|
|
16288
|
-
let leftLit = (0,
|
|
16288
|
+
let leftLit = (0, import_chunk_JDC43A3I.getLiteralNode)(node.left.right);
|
|
16289
16289
|
if (!leftLit) {
|
|
16290
16290
|
if (node.left.operator !== "-")
|
|
16291
16291
|
return false;
|
|
16292
|
-
leftLit = (0,
|
|
16292
|
+
leftLit = (0, import_chunk_JDC43A3I.getLiteralNode)(node.left.left);
|
|
16293
16293
|
if (!leftLit)
|
|
16294
16294
|
return false;
|
|
16295
16295
|
const leftLeft = evaluate(istate, leftLit);
|
|
@@ -16357,7 +16357,7 @@ function tryReAssociate(istate, node, left, right) {
|
|
|
16357
16357
|
return false;
|
|
16358
16358
|
}
|
|
16359
16359
|
if (node.right.type === "BinaryExpression" && (node.right.operator === node.operator || (node.operator === "+" || node.operator === "-") && (node.right.operator === "+" || node.right.operator === "-"))) {
|
|
16360
|
-
const rr = (0,
|
|
16360
|
+
const rr = (0, import_chunk_JDC43A3I.getLiteralNode)(node.right.right);
|
|
16361
16361
|
if (!rr)
|
|
16362
16362
|
return false;
|
|
16363
16363
|
const rightRight = evaluate(istate, rr);
|
|
@@ -16412,7 +16412,7 @@ function tryDeEnumerate(istate, node, elem) {
|
|
|
16412
16412
|
var init_optimize = (0, import_chunk_ABYVSU2C.__esm)({
|
|
16413
16413
|
"src/type-flow/optimize.ts"() {
|
|
16414
16414
|
"use strict";
|
|
16415
|
-
(0,
|
|
16415
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
16416
16416
|
init_inliner();
|
|
16417
16417
|
init_type_flow();
|
|
16418
16418
|
(0, import_chunk_OASVKTK5.init_util)();
|
|
@@ -16447,7 +16447,7 @@ function cleanupUnusedVars(state, node) {
|
|
|
16447
16447
|
const stack = [];
|
|
16448
16448
|
const activeRemove = {};
|
|
16449
16449
|
let changes = false;
|
|
16450
|
-
(0,
|
|
16450
|
+
(0, import_chunk_JDC43A3I.traverseAst)(
|
|
16451
16451
|
node,
|
|
16452
16452
|
(node2) => {
|
|
16453
16453
|
switch (node2.type) {
|
|
@@ -16468,7 +16468,7 @@ function cleanupUnusedVars(state, node) {
|
|
|
16468
16468
|
case "VariableDeclaration": {
|
|
16469
16469
|
node2.declarations.forEach((decl, i) => {
|
|
16470
16470
|
const name = variableDeclarationName(decl.id);
|
|
16471
|
-
if ((0,
|
|
16471
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(toRemove, name) && toRemove[name].node === decl) {
|
|
16472
16472
|
activeRemove[name] = toRemove[name];
|
|
16473
16473
|
const info = varDeclarations.get(node2);
|
|
16474
16474
|
if (info) {
|
|
@@ -16485,11 +16485,11 @@ function cleanupUnusedVars(state, node) {
|
|
|
16485
16485
|
}
|
|
16486
16486
|
case "ExpressionStatement":
|
|
16487
16487
|
if (node2.expression.type === "AssignmentExpression") {
|
|
16488
|
-
if (node2.expression.left.type === "Identifier" && (0,
|
|
16488
|
+
if (node2.expression.left.type === "Identifier" && (0, import_chunk_JDC43A3I.hasProperty)(activeRemove, node2.expression.left.name)) {
|
|
16489
16489
|
changes = true;
|
|
16490
16490
|
return unused(state, node2.expression.right);
|
|
16491
16491
|
}
|
|
16492
|
-
} else if (node2.expression.type === "UpdateExpression" && node2.expression.argument.type === "Identifier" && (0,
|
|
16492
|
+
} else if (node2.expression.type === "UpdateExpression" && node2.expression.argument.type === "Identifier" && (0, import_chunk_JDC43A3I.hasProperty)(activeRemove, node2.expression.argument.name)) {
|
|
16493
16493
|
return false;
|
|
16494
16494
|
}
|
|
16495
16495
|
break;
|
|
@@ -16497,7 +16497,7 @@ function cleanupUnusedVars(state, node) {
|
|
|
16497
16497
|
for (let i = node2.expressions.length; i--; ) {
|
|
16498
16498
|
const expr = node2.expressions[i];
|
|
16499
16499
|
if (expr.type === "AssignmentExpression") {
|
|
16500
|
-
if (expr.left.type === "Identifier" && (0,
|
|
16500
|
+
if (expr.left.type === "Identifier" && (0, import_chunk_JDC43A3I.hasProperty)(activeRemove, expr.left.name)) {
|
|
16501
16501
|
const rep = unused(state, expr.right);
|
|
16502
16502
|
if (!rep.length) {
|
|
16503
16503
|
changes = true;
|
|
@@ -16507,7 +16507,7 @@ function cleanupUnusedVars(state, node) {
|
|
|
16507
16507
|
expr.operator = "=";
|
|
16508
16508
|
}
|
|
16509
16509
|
}
|
|
16510
|
-
} else if (expr.type === "UpdateExpression" && expr.argument.type === "Identifier" && (0,
|
|
16510
|
+
} else if (expr.type === "UpdateExpression" && expr.argument.type === "Identifier" && (0, import_chunk_JDC43A3I.hasProperty)(activeRemove, expr.argument.name)) {
|
|
16511
16511
|
changes = true;
|
|
16512
16512
|
node2.expressions.splice(i, 1);
|
|
16513
16513
|
}
|
|
@@ -16524,7 +16524,7 @@ function cleanupUnusedVars(state, node) {
|
|
|
16524
16524
|
const i = info.indices[ii];
|
|
16525
16525
|
const vdecl = decl.declarations[i];
|
|
16526
16526
|
const name = variableDeclarationName(vdecl.id);
|
|
16527
|
-
if ((0,
|
|
16527
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(activeRemove, name)) {
|
|
16528
16528
|
const rep = vdecl.init ? unused(state, vdecl.init) : [];
|
|
16529
16529
|
if (rep.length) {
|
|
16530
16530
|
if ((state.sdkVersion || 0) < 4001007 && rep.find(
|
|
@@ -16586,7 +16586,7 @@ var init_unused_exprs = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
16586
16586
|
"src/unused-exprs.ts"() {
|
|
16587
16587
|
"use strict";
|
|
16588
16588
|
init_api();
|
|
16589
|
-
(0,
|
|
16589
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
16590
16590
|
init_inliner();
|
|
16591
16591
|
}
|
|
16592
16592
|
});
|
|
@@ -16610,7 +16610,7 @@ function collectDeclarationsByName(state) {
|
|
|
16610
16610
|
}
|
|
16611
16611
|
});
|
|
16612
16612
|
if (keyed.length) {
|
|
16613
|
-
if (!(0,
|
|
16613
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(allDecls, key)) {
|
|
16614
16614
|
allDecls[key] = keyed;
|
|
16615
16615
|
} else {
|
|
16616
16616
|
allDecls[key].push(...keyed);
|
|
@@ -16682,7 +16682,7 @@ function collectClassInfo(state) {
|
|
|
16682
16682
|
}
|
|
16683
16683
|
Object.values(c.decls).forEach((funcs) => {
|
|
16684
16684
|
funcs.forEach((f) => {
|
|
16685
|
-
if (f.type === "FunctionDeclaration" && (0,
|
|
16685
|
+
if (f.type === "FunctionDeclaration" && (0, import_chunk_JDC43A3I.hasProperty)(cls.decls, f.name)) {
|
|
16686
16686
|
f.node.hasOverride = true;
|
|
16687
16687
|
}
|
|
16688
16688
|
});
|
|
@@ -16772,7 +16772,7 @@ async function analyze(fnMap, resourcesMap, manifestXML, config, allowParseError
|
|
|
16772
16772
|
return drop;
|
|
16773
16773
|
if (attr.argument.type !== "Identifier")
|
|
16774
16774
|
return drop;
|
|
16775
|
-
if ((0,
|
|
16775
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(excludeAnnotations, attr.argument.name)) {
|
|
16776
16776
|
return true;
|
|
16777
16777
|
}
|
|
16778
16778
|
if (attr.argument.name === "test") {
|
|
@@ -16799,7 +16799,7 @@ async function analyze(fnMap, resourcesMap, manifestXML, config, allowParseError
|
|
|
16799
16799
|
scope.info = getApiFunctionInfo(state2, scope);
|
|
16800
16800
|
}
|
|
16801
16801
|
const allFuncs = state2.allFunctions;
|
|
16802
|
-
if (!(0,
|
|
16802
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(allFuncs, scope.name)) {
|
|
16803
16803
|
allFuncs[scope.name] = [scope];
|
|
16804
16804
|
} else {
|
|
16805
16805
|
allFuncs[scope.name].push(scope);
|
|
@@ -16933,10 +16933,10 @@ function evaluateFunction(istate, func, args) {
|
|
|
16933
16933
|
])
|
|
16934
16934
|
);
|
|
16935
16935
|
let ret = null;
|
|
16936
|
-
const body = args ? (0,
|
|
16936
|
+
const body = args ? (0, import_chunk_JDC43A3I.cloneDeep)(func.body) : func.body;
|
|
16937
16937
|
const depth2 = istate.stack.length;
|
|
16938
16938
|
try {
|
|
16939
|
-
(0,
|
|
16939
|
+
(0, import_chunk_JDC43A3I.traverseAst)(
|
|
16940
16940
|
body,
|
|
16941
16941
|
(node) => {
|
|
16942
16942
|
switch (node.type) {
|
|
@@ -16961,7 +16961,7 @@ function evaluateFunction(istate, func, args) {
|
|
|
16961
16961
|
case "BlockStatement":
|
|
16962
16962
|
return null;
|
|
16963
16963
|
case "Identifier":
|
|
16964
|
-
if ((0,
|
|
16964
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(paramValues, node.name)) {
|
|
16965
16965
|
istate.stack.push(
|
|
16966
16966
|
evaluate(istate, node = paramValues[node.name])
|
|
16967
16967
|
);
|
|
@@ -16986,7 +16986,7 @@ function evaluateFunction(istate, func, args) {
|
|
|
16986
16986
|
}
|
|
16987
16987
|
}
|
|
16988
16988
|
function markFunctionCalled(state, func) {
|
|
16989
|
-
if (!(0,
|
|
16989
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(state.calledFunctions, func.id.name)) {
|
|
16990
16990
|
state.calledFunctions[func.id.name] = [func];
|
|
16991
16991
|
return;
|
|
16992
16992
|
}
|
|
@@ -17013,7 +17013,7 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17013
17013
|
const optimizeCallHelper = (istate2, call, node) => {
|
|
17014
17014
|
const result = optimizeCall(istate2, call, node);
|
|
17015
17015
|
if (result) {
|
|
17016
|
-
if ((0,
|
|
17016
|
+
if ((0, import_chunk_JDC43A3I.isExpression)(result)) {
|
|
17017
17017
|
const elem = istate2.stack[istate2.stack.length - 1];
|
|
17018
17018
|
elem.node = result;
|
|
17019
17019
|
if (result.type === "Literal") {
|
|
@@ -17027,7 +17027,7 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17027
17027
|
};
|
|
17028
17028
|
const topLocals = () => state.localsStack[state.localsStack.length - 1];
|
|
17029
17029
|
const checkInherited = (elm, name) => elm.superClass === true || elm.superClass != null && elm.superClass.some(
|
|
17030
|
-
(sc) => (0,
|
|
17030
|
+
(sc) => (0, import_chunk_JDC43A3I.hasProperty)(sc.decls, name) && sc.decls[name].some(
|
|
17031
17031
|
(f) => isStateNode(f) && f.type === "FunctionDeclaration" && maybeCalled(state, f.node)
|
|
17032
17032
|
) || sc.superClass && checkInherited(sc, name)
|
|
17033
17033
|
);
|
|
@@ -17055,10 +17055,10 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17055
17055
|
throw new Error(`No parent in lookup of local ${declName2}`);
|
|
17056
17056
|
}
|
|
17057
17057
|
const decls = parent.decls;
|
|
17058
|
-
if (!decls || !(0,
|
|
17058
|
+
if (!decls || !(0, import_chunk_JDC43A3I.hasProperty)(decls, declName2)) {
|
|
17059
17059
|
throw new Error(`Missing decls in lookup of local ${declName2}`);
|
|
17060
17060
|
}
|
|
17061
|
-
if ((0,
|
|
17061
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(decls, name)) {
|
|
17062
17062
|
throw new Error(
|
|
17063
17063
|
`While renaming ${declName2} to ${name}, there was already a variable ${name}`
|
|
17064
17064
|
);
|
|
@@ -17127,7 +17127,7 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17127
17127
|
break;
|
|
17128
17128
|
case "Identifier": {
|
|
17129
17129
|
const map2 = topLocals().map;
|
|
17130
|
-
if ((0,
|
|
17130
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(map2, node.name)) {
|
|
17131
17131
|
const name = map2[node.name];
|
|
17132
17132
|
if (typeof name === "string") {
|
|
17133
17133
|
renameIdentifier(node, name);
|
|
@@ -17161,7 +17161,7 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17161
17161
|
if (lhs.type === "Identifier") {
|
|
17162
17162
|
const map2 = topLocals().map;
|
|
17163
17163
|
if (map2) {
|
|
17164
|
-
if ((0,
|
|
17164
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(map2, lhs.name)) {
|
|
17165
17165
|
const name = map2[lhs.name];
|
|
17166
17166
|
if (typeof name === "string") {
|
|
17167
17167
|
renameIdentifier(lhs, name);
|
|
@@ -17285,14 +17285,14 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17285
17285
|
}
|
|
17286
17286
|
break;
|
|
17287
17287
|
case "Identifier":
|
|
17288
|
-
if ((0,
|
|
17288
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(state.index, node.name)) {
|
|
17289
17289
|
state.usedByName[node.name] = true;
|
|
17290
17290
|
}
|
|
17291
17291
|
break;
|
|
17292
17292
|
case "MemberExpression": {
|
|
17293
17293
|
const property = isLookupCandidate(node);
|
|
17294
17294
|
if (property) {
|
|
17295
|
-
if ((0,
|
|
17295
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(state.index, property.name)) {
|
|
17296
17296
|
state.usedByName[property.name] = true;
|
|
17297
17297
|
}
|
|
17298
17298
|
}
|
|
@@ -17345,7 +17345,7 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17345
17345
|
}
|
|
17346
17346
|
delete decl.init;
|
|
17347
17347
|
results.push(
|
|
17348
|
-
(0,
|
|
17348
|
+
(0, import_chunk_JDC43A3I.withLoc)(
|
|
17349
17349
|
{
|
|
17350
17350
|
...node,
|
|
17351
17351
|
declarations: declarations.slice(j, i)
|
|
@@ -17378,7 +17378,7 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17378
17378
|
if (call) {
|
|
17379
17379
|
let ok = false;
|
|
17380
17380
|
if (node.expression.left.type === "Identifier") {
|
|
17381
|
-
if ((0,
|
|
17381
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(topLocals().map, node.expression.left.type)) {
|
|
17382
17382
|
ok = true;
|
|
17383
17383
|
}
|
|
17384
17384
|
}
|
|
@@ -17398,7 +17398,7 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17398
17398
|
const n = node;
|
|
17399
17399
|
n.type = "AssignmentExpression";
|
|
17400
17400
|
n.left = node.argument;
|
|
17401
|
-
n.right = (0,
|
|
17401
|
+
n.right = (0, import_chunk_JDC43A3I.withLoc)(
|
|
17402
17402
|
mcExprFromType({ type: 8, value: 1 }),
|
|
17403
17403
|
n.left
|
|
17404
17404
|
);
|
|
@@ -17510,7 +17510,7 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17510
17510
|
state.diagnostics = state.inlineDiagnostics;
|
|
17511
17511
|
} else {
|
|
17512
17512
|
Object.entries(state.inlineDiagnostics).forEach(([key, diags]) => {
|
|
17513
|
-
if (!(0,
|
|
17513
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(state.diagnostics, key)) {
|
|
17514
17514
|
state.diagnostics[key] = diags;
|
|
17515
17515
|
} else {
|
|
17516
17516
|
state.diagnostics[key].push(...diags);
|
|
@@ -17581,7 +17581,7 @@ function maybeCalled(state, func) {
|
|
|
17581
17581
|
if (!func.body) {
|
|
17582
17582
|
return true;
|
|
17583
17583
|
}
|
|
17584
|
-
if ((0,
|
|
17584
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(state.exposed, func.id.name))
|
|
17585
17585
|
return true;
|
|
17586
17586
|
if (func.attrs && func.attrs.attributes && func.attrs.attributes.elements.some((attr) => {
|
|
17587
17587
|
if (attr.type !== "UnaryExpression")
|
|
@@ -17592,7 +17592,7 @@ function maybeCalled(state, func) {
|
|
|
17592
17592
|
})) {
|
|
17593
17593
|
return true;
|
|
17594
17594
|
}
|
|
17595
|
-
if ((0,
|
|
17595
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(state.calledFunctions, func.id.name)) {
|
|
17596
17596
|
return state.calledFunctions[func.id.name].find((f) => f === func) !== null;
|
|
17597
17597
|
}
|
|
17598
17598
|
return false;
|
|
@@ -17607,7 +17607,7 @@ function cleanup(state, node, ast, usedNodes) {
|
|
|
17607
17607
|
if (usedNodes.has(m))
|
|
17608
17608
|
return false;
|
|
17609
17609
|
const name = "name" in m ? m.name : m.id.name;
|
|
17610
|
-
return (0,
|
|
17610
|
+
return (0, import_chunk_JDC43A3I.hasProperty)(state.index, name) && !(0, import_chunk_JDC43A3I.hasProperty)(state.exposed, name) && !(0, import_chunk_JDC43A3I.hasProperty)(state.usedByName, name);
|
|
17611
17611
|
})) {
|
|
17612
17612
|
break;
|
|
17613
17613
|
}
|
|
@@ -17615,7 +17615,7 @@ function cleanup(state, node, ast, usedNodes) {
|
|
|
17615
17615
|
node.body.members.map((m) => {
|
|
17616
17616
|
if (!("init" in m))
|
|
17617
17617
|
return "Number";
|
|
17618
|
-
const [node2, type] = (0,
|
|
17618
|
+
const [node2, type] = (0, import_chunk_JDC43A3I.getNodeValue)(m.init);
|
|
17619
17619
|
return node2 ? type : null;
|
|
17620
17620
|
})
|
|
17621
17621
|
);
|
|
@@ -17624,7 +17624,7 @@ function cleanup(state, node, ast, usedNodes) {
|
|
|
17624
17624
|
if (!node.id)
|
|
17625
17625
|
return false;
|
|
17626
17626
|
state.removeNodeComments(node, ast);
|
|
17627
|
-
const typedefDecl = (0,
|
|
17627
|
+
const typedefDecl = (0, import_chunk_JDC43A3I.withLocDeep)(
|
|
17628
17628
|
{
|
|
17629
17629
|
type: "TypedefDeclaration",
|
|
17630
17630
|
id: node.id,
|
|
@@ -17634,7 +17634,7 @@ function cleanup(state, node, ast, usedNodes) {
|
|
|
17634
17634
|
type: "TypeSpecList",
|
|
17635
17635
|
ts: Array.from(enumType).map((t) => ({
|
|
17636
17636
|
type: "TypeSpecPart",
|
|
17637
|
-
name: t === "Null" ? t : (0,
|
|
17637
|
+
name: t === "Null" ? t : (0, import_chunk_JDC43A3I.makeScopedName)(`Toybox.Lang.${t}`)
|
|
17638
17638
|
}))
|
|
17639
17639
|
},
|
|
17640
17640
|
prefix: true,
|
|
@@ -17662,7 +17662,7 @@ function cleanup(state, node, ast, usedNodes) {
|
|
|
17662
17662
|
}
|
|
17663
17663
|
case "VariableDeclarator": {
|
|
17664
17664
|
const name = variableDeclarationName(node.id);
|
|
17665
|
-
return !(0,
|
|
17665
|
+
return !(0, import_chunk_JDC43A3I.hasProperty)(state.index, name) || (0, import_chunk_JDC43A3I.hasProperty)(state.exposed, name) || (0, import_chunk_JDC43A3I.hasProperty)(state.usedByName, name) ? null : false;
|
|
17666
17666
|
}
|
|
17667
17667
|
case "VariableDeclaration": {
|
|
17668
17668
|
if (!node.declarations.length) {
|
|
@@ -17704,7 +17704,7 @@ function optimizeCall(istate, node, context) {
|
|
|
17704
17704
|
if (!callees || !callees.length) {
|
|
17705
17705
|
const n = name || "name" in node.callee && node.callee.name || "property" in node.callee && node.callee.property && "name" in node.callee.property && node.callee.property.name;
|
|
17706
17706
|
if (n) {
|
|
17707
|
-
if ((0,
|
|
17707
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(state.allFunctions, n)) {
|
|
17708
17708
|
if (state.currentFunction) {
|
|
17709
17709
|
recordCalledFuncs(state.currentFunction, state.allFunctions[n]);
|
|
17710
17710
|
}
|
|
@@ -17723,11 +17723,11 @@ function optimizeCall(istate, node, context) {
|
|
|
17723
17723
|
if (callees.length === 1) {
|
|
17724
17724
|
const callee = callees[0].node;
|
|
17725
17725
|
if (callees[0].type === "FunctionDeclaration" && !callee.hasOverride) {
|
|
17726
|
-
if (!context && callee.optimizable && node.arguments.every((n) => (0,
|
|
17726
|
+
if (!context && callee.optimizable && node.arguments.every((n) => (0, import_chunk_JDC43A3I.getNodeValue)(n)[0] !== null)) {
|
|
17727
17727
|
const ret = evaluateFunction(istate, callee, node.arguments);
|
|
17728
17728
|
if (ret) {
|
|
17729
17729
|
inlineDiagnostic(state, callees[0], node, null);
|
|
17730
|
-
return (0,
|
|
17730
|
+
return (0, import_chunk_JDC43A3I.withLoc)(ret, node, node);
|
|
17731
17731
|
}
|
|
17732
17732
|
}
|
|
17733
17733
|
if (shouldInline(state, callees[0], node, context)) {
|
|
@@ -17745,7 +17745,7 @@ var init_mc_rewrite = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
17745
17745
|
"src/mc-rewrite.ts"() {
|
|
17746
17746
|
"use strict";
|
|
17747
17747
|
init_api();
|
|
17748
|
-
(0,
|
|
17748
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
17749
17749
|
init_data_flow();
|
|
17750
17750
|
init_function_info();
|
|
17751
17751
|
init_inliner();
|
|
@@ -17966,8 +17966,8 @@ function add_resources_to_ast(state, ast, resources, manifestXML) {
|
|
|
17966
17966
|
loc: outerLoc
|
|
17967
17967
|
});
|
|
17968
17968
|
const makeImport = (type, module2, as) => {
|
|
17969
|
-
const id = (0,
|
|
17970
|
-
return type === "Using" && as ? { type, id, as: (0,
|
|
17969
|
+
const id = (0, import_chunk_JDC43A3I.makeScopedName)(module2);
|
|
17970
|
+
return type === "Using" && as ? { type, id, as: (0, import_chunk_JDC43A3I.makeIdentifier)(as) } : { type, id };
|
|
17971
17971
|
};
|
|
17972
17972
|
ast.body.push(
|
|
17973
17973
|
makeImport("ImportModule", "Toybox.Lang"),
|
|
@@ -17976,8 +17976,15 @@ function add_resources_to_ast(state, ast, resources, manifestXML) {
|
|
|
17976
17976
|
makeImport("Using", "Toybox.Graphics"),
|
|
17977
17977
|
makeImport("Using", "Toybox.Graphics", "Gfx")
|
|
17978
17978
|
);
|
|
17979
|
+
const barrelName = manifestXML && manifestXML.body instanceof xml_util_exports.Nodes && manifestXML?.body.children("iq:barrel").attrs()[0]?.module?.value.value;
|
|
17980
|
+
const barrelNames = new Set(
|
|
17981
|
+
Object.keys(resources).map((k) => k || barrelName).filter((e) => !!e)
|
|
17982
|
+
);
|
|
17979
17983
|
Object.entries(resources).forEach(([barrel, resourceMap]) => {
|
|
17980
17984
|
let body = ast.body;
|
|
17985
|
+
if (barrel === "" && barrelName) {
|
|
17986
|
+
barrel = barrelName;
|
|
17987
|
+
}
|
|
17981
17988
|
if (barrel !== "") {
|
|
17982
17989
|
const module2 = makeModule(barrel);
|
|
17983
17990
|
body.push(module2);
|
|
@@ -17989,7 +17996,7 @@ function add_resources_to_ast(state, ast, resources, manifestXML) {
|
|
|
17989
17996
|
rez.body.body.push(hiddenRez);
|
|
17990
17997
|
if (barrel === "" && manifestXML && manifestXML.body instanceof xml_util_exports.Nodes) {
|
|
17991
17998
|
manifestXML.body.children("iq:application").elements.forEach(
|
|
17992
|
-
(e) => add_one_resource(state, manifestXML, rez, e,
|
|
17999
|
+
(e) => add_one_resource(state, manifestXML, rez, e, barrelNames)
|
|
17993
18000
|
);
|
|
17994
18001
|
}
|
|
17995
18002
|
const rezModules = Object.fromEntries(
|
|
@@ -18005,10 +18012,10 @@ function add_resources_to_ast(state, ast, resources, manifestXML) {
|
|
|
18005
18012
|
visit_resources(rez2.body.elements, null, (e, s) => {
|
|
18006
18013
|
if (!s)
|
|
18007
18014
|
return;
|
|
18008
|
-
if (!(0,
|
|
18015
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(rezModules, s))
|
|
18009
18016
|
return;
|
|
18010
18017
|
const module2 = rezModules[s];
|
|
18011
|
-
add_one_resource(state, rez2, module2, e,
|
|
18018
|
+
add_one_resource(state, rez2, module2, e, barrelNames);
|
|
18012
18019
|
});
|
|
18013
18020
|
});
|
|
18014
18021
|
});
|
|
@@ -18024,30 +18031,39 @@ function addPositions(base, pos) {
|
|
|
18024
18031
|
result.offset += pos.offset;
|
|
18025
18032
|
return result;
|
|
18026
18033
|
}
|
|
18027
|
-
function visit_resource_refs(state, doc, e,
|
|
18034
|
+
function visit_resource_refs(state, doc, e, barrelNames) {
|
|
18028
18035
|
const result = [];
|
|
18029
18036
|
const parseArg = (name, loc, skip) => {
|
|
18037
|
+
let base;
|
|
18030
18038
|
if (name.startsWith("@")) {
|
|
18031
18039
|
name = name.substring(1);
|
|
18032
|
-
|
|
18033
|
-
|
|
18040
|
+
loc = (0, import_chunk_JDC43A3I.adjustLoc)(loc, 1, 0);
|
|
18041
|
+
if (barrelNames.size) {
|
|
18042
|
+
const dot = name.indexOf(".");
|
|
18043
|
+
if (dot > 0 && dot < name.length - 1) {
|
|
18044
|
+
const start = name.substring(0, dot);
|
|
18045
|
+
if (barrelNames.has(start)) {
|
|
18046
|
+
base = (0, import_chunk_JDC43A3I.makeScopedName)(`${start}.Rez`, loc);
|
|
18047
|
+
loc = (0, import_chunk_JDC43A3I.adjustLoc)(loc, dot + 1, 0);
|
|
18048
|
+
name = name.substring(dot + 1);
|
|
18049
|
+
}
|
|
18050
|
+
}
|
|
18034
18051
|
}
|
|
18035
|
-
loc = (0, import_chunk_MBTLUWXR.adjustLoc)(loc, 1, 0);
|
|
18036
18052
|
}
|
|
18037
|
-
if ((0,
|
|
18053
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(skip, name) || /^\d+(\.\d+)?%?$/.test(name)) {
|
|
18038
18054
|
return;
|
|
18039
18055
|
}
|
|
18040
18056
|
if (/^([-\w_$]+\s*\.\s*)*[-\w_$]+$/.test(name)) {
|
|
18041
|
-
result.push((0,
|
|
18057
|
+
result.push((0, import_chunk_JDC43A3I.makeScopedName)(name, loc, base));
|
|
18042
18058
|
return;
|
|
18043
18059
|
}
|
|
18044
|
-
const startPos = (0,
|
|
18060
|
+
const startPos = (0, import_chunk_JDC43A3I.adjustLoc)(loc, -1, 0).start;
|
|
18045
18061
|
try {
|
|
18046
18062
|
const expr = import_prettier_plugin_monkeyc3.default.parsers.monkeyc.parse(`(${name})`, null, {
|
|
18047
18063
|
filepath: loc.source || void 0,
|
|
18048
18064
|
singleExpression: true
|
|
18049
18065
|
});
|
|
18050
|
-
(0,
|
|
18066
|
+
(0, import_chunk_JDC43A3I.traverseAst)(expr, (node) => {
|
|
18051
18067
|
if (node.loc) {
|
|
18052
18068
|
node.loc = {
|
|
18053
18069
|
source: node.loc.source,
|
|
@@ -18099,16 +18115,16 @@ function visit_resource_refs(state, doc, e, barrel) {
|
|
|
18099
18115
|
loc.start.offset -= name.length;
|
|
18100
18116
|
}
|
|
18101
18117
|
} else {
|
|
18102
|
-
const base = (0,
|
|
18103
|
-
const idLoc = (0,
|
|
18118
|
+
const base = (0, import_chunk_JDC43A3I.makeScopedName)(`Rez.Styles`);
|
|
18119
|
+
const idLoc = (0, import_chunk_JDC43A3I.adjustLoc)(loc, 0, 0);
|
|
18104
18120
|
idLoc.end = { ...idLoc.start };
|
|
18105
18121
|
idLoc.end.column += name.length;
|
|
18106
18122
|
idLoc.end.offset += name.length;
|
|
18107
|
-
const id2 = (0,
|
|
18108
|
-
result.push((0,
|
|
18123
|
+
const id2 = (0, import_chunk_JDC43A3I.makeIdentifier)(name, idLoc);
|
|
18124
|
+
result.push((0, import_chunk_JDC43A3I.makeMemberExpression)((0, import_chunk_JDC43A3I.withLoc)(base, id2, false), id2));
|
|
18109
18125
|
}
|
|
18110
|
-
return (0,
|
|
18111
|
-
}, (0,
|
|
18126
|
+
return (0, import_chunk_JDC43A3I.adjustLoc)(loc, name.length, 0);
|
|
18127
|
+
}, (0, import_chunk_JDC43A3I.adjustLoc)(l, 0, 0));
|
|
18112
18128
|
return;
|
|
18113
18129
|
}
|
|
18114
18130
|
if (/^\s*(true|false|null|NaN|(0x|#)[0-9a-f]+|[-+]?\d+%?)\s*$/i.test(dotted)) {
|
|
@@ -18121,7 +18137,7 @@ function visit_resource_refs(state, doc, e, barrel) {
|
|
|
18121
18137
|
parseArg(
|
|
18122
18138
|
dotted,
|
|
18123
18139
|
l,
|
|
18124
|
-
name && (0,
|
|
18140
|
+
name && (0, import_chunk_JDC43A3I.hasProperty)(drawableSkips, name) ? drawableSkips[name] : null
|
|
18125
18141
|
);
|
|
18126
18142
|
}
|
|
18127
18143
|
return;
|
|
@@ -18135,7 +18151,7 @@ function visit_resource_refs(state, doc, e, barrel) {
|
|
|
18135
18151
|
case "drawable-list":
|
|
18136
18152
|
case "text-area":
|
|
18137
18153
|
case "label":
|
|
18138
|
-
if (id && (0,
|
|
18154
|
+
if (id && (0, import_chunk_JDC43A3I.hasProperty)(drawableSkips, id)) {
|
|
18139
18155
|
parseArg(dotted, l, drawableSkips[id]);
|
|
18140
18156
|
}
|
|
18141
18157
|
return;
|
|
@@ -18155,7 +18171,7 @@ function visit_resource_refs(state, doc, e, barrel) {
|
|
|
18155
18171
|
Object.values(node.attr).forEach((attr) => {
|
|
18156
18172
|
if (!attr || !attr.value.loc)
|
|
18157
18173
|
return;
|
|
18158
|
-
const loc = (0,
|
|
18174
|
+
const loc = (0, import_chunk_JDC43A3I.adjustLoc)(attr.value.loc);
|
|
18159
18175
|
stringToScopedName(node, attr.name.value, attr.value.value, loc);
|
|
18160
18176
|
});
|
|
18161
18177
|
const content = doc.textContent(node);
|
|
@@ -18169,7 +18185,7 @@ function visit_resource_refs(state, doc, e, barrel) {
|
|
|
18169
18185
|
node,
|
|
18170
18186
|
null,
|
|
18171
18187
|
content,
|
|
18172
|
-
(0,
|
|
18188
|
+
(0, import_chunk_JDC43A3I.locRange)(
|
|
18173
18189
|
node.children[0].loc,
|
|
18174
18190
|
node.children[node.children.length - 1].loc
|
|
18175
18191
|
)
|
|
@@ -18182,29 +18198,29 @@ function visit_resource_refs(state, doc, e, barrel) {
|
|
|
18182
18198
|
});
|
|
18183
18199
|
return result;
|
|
18184
18200
|
}
|
|
18185
|
-
function add_one_resource(state, doc, module2, e,
|
|
18201
|
+
function add_one_resource(state, doc, module2, e, barrelNames) {
|
|
18186
18202
|
let id;
|
|
18187
18203
|
let func;
|
|
18188
18204
|
const makeVarDecl = (id2, outer) => {
|
|
18189
|
-
const loc = id2 && (0,
|
|
18190
|
-
return (0,
|
|
18205
|
+
const loc = id2 && (0, import_chunk_JDC43A3I.adjustLoc)(id2.value.loc);
|
|
18206
|
+
return (0, import_chunk_JDC43A3I.wrap)(
|
|
18191
18207
|
{
|
|
18192
18208
|
type: "VariableDeclaration",
|
|
18193
18209
|
declarations: [
|
|
18194
|
-
(0,
|
|
18210
|
+
(0, import_chunk_JDC43A3I.wrap)(
|
|
18195
18211
|
{
|
|
18196
18212
|
type: "VariableDeclarator",
|
|
18197
18213
|
kind: "var",
|
|
18198
18214
|
id: {
|
|
18199
18215
|
type: "BinaryExpression",
|
|
18200
18216
|
operator: "as",
|
|
18201
|
-
left: (0,
|
|
18217
|
+
left: (0, import_chunk_JDC43A3I.makeIdentifier)(id2 ? id2.value.value : "*invalid*", loc),
|
|
18202
18218
|
right: {
|
|
18203
18219
|
type: "TypeSpecList",
|
|
18204
18220
|
ts: [
|
|
18205
18221
|
{
|
|
18206
18222
|
type: "TypeSpecPart",
|
|
18207
|
-
name: (0,
|
|
18223
|
+
name: (0, import_chunk_JDC43A3I.makeScopedName)(
|
|
18208
18224
|
(state?.sdkVersion ?? 0) >= 7e6 ? "Toybox.Lang.ResourceId" : "Toybox.Lang.Symbol"
|
|
18209
18225
|
)
|
|
18210
18226
|
}
|
|
@@ -18237,7 +18253,7 @@ function add_one_resource(state, doc, module2, e, barrel) {
|
|
|
18237
18253
|
type: "ClassElement",
|
|
18238
18254
|
item: {
|
|
18239
18255
|
type: "FunctionDeclaration",
|
|
18240
|
-
id: (0,
|
|
18256
|
+
id: (0, import_chunk_JDC43A3I.makeIdentifier)("initialize", loc),
|
|
18241
18257
|
body: null,
|
|
18242
18258
|
params: [],
|
|
18243
18259
|
loc: e.loc
|
|
@@ -18246,8 +18262,8 @@ function add_one_resource(state, doc, module2, e, barrel) {
|
|
|
18246
18262
|
return {
|
|
18247
18263
|
type: "ClassDeclaration",
|
|
18248
18264
|
body: { type: "ClassBody", body: items, loc: e.loc },
|
|
18249
|
-
id: (0,
|
|
18250
|
-
superClass: (0,
|
|
18265
|
+
id: (0, import_chunk_JDC43A3I.makeIdentifier)(id.value.value, loc),
|
|
18266
|
+
superClass: (0, import_chunk_JDC43A3I.makeScopedName)(parent),
|
|
18251
18267
|
loc: e.loc
|
|
18252
18268
|
};
|
|
18253
18269
|
};
|
|
@@ -18259,18 +18275,18 @@ function add_one_resource(state, doc, module2, e, barrel) {
|
|
|
18259
18275
|
return {
|
|
18260
18276
|
type: "FunctionDeclaration",
|
|
18261
18277
|
body: { type: "BlockStatement", body: items, loc: e.loc },
|
|
18262
|
-
id: (0,
|
|
18278
|
+
id: (0, import_chunk_JDC43A3I.makeIdentifier)(id.value.value, loc),
|
|
18263
18279
|
params: [
|
|
18264
18280
|
{
|
|
18265
18281
|
type: "BinaryExpression",
|
|
18266
18282
|
operator: "as",
|
|
18267
|
-
left: (0,
|
|
18283
|
+
left: (0, import_chunk_JDC43A3I.makeIdentifier)("dc"),
|
|
18268
18284
|
right: {
|
|
18269
18285
|
type: "TypeSpecList",
|
|
18270
18286
|
ts: [
|
|
18271
18287
|
{
|
|
18272
18288
|
type: "TypeSpecPart",
|
|
18273
|
-
name: (0,
|
|
18289
|
+
name: (0, import_chunk_JDC43A3I.makeScopedName)("Graphics.Dc")
|
|
18274
18290
|
}
|
|
18275
18291
|
]
|
|
18276
18292
|
}
|
|
@@ -18285,14 +18301,14 @@ function add_one_resource(state, doc, module2, e, barrel) {
|
|
|
18285
18301
|
ts: [
|
|
18286
18302
|
{
|
|
18287
18303
|
type: "TypeSpecPart",
|
|
18288
|
-
name: (0,
|
|
18304
|
+
name: (0, import_chunk_JDC43A3I.makeScopedName)("$.Toybox.Lang.Array"),
|
|
18289
18305
|
generics: [
|
|
18290
18306
|
{
|
|
18291
18307
|
type: "TypeSpecList",
|
|
18292
18308
|
ts: [
|
|
18293
18309
|
{
|
|
18294
18310
|
type: "TypeSpecPart",
|
|
18295
|
-
name: (0,
|
|
18311
|
+
name: (0, import_chunk_JDC43A3I.makeScopedName)("$.Toybox.WatchUi.Drawable")
|
|
18296
18312
|
}
|
|
18297
18313
|
]
|
|
18298
18314
|
}
|
|
@@ -18346,12 +18362,12 @@ function add_one_resource(state, doc, module2, e, barrel) {
|
|
|
18346
18362
|
}
|
|
18347
18363
|
if (!func)
|
|
18348
18364
|
return;
|
|
18349
|
-
const elements = visit_resource_refs(state, doc, e,
|
|
18365
|
+
const elements = visit_resource_refs(state, doc, e, barrelNames);
|
|
18350
18366
|
const startLoc = elements[0]?.loc;
|
|
18351
18367
|
const endLoc = elements[elements.length - 1]?.loc;
|
|
18352
|
-
const init = elements.length ? (0,
|
|
18368
|
+
const init = elements.length ? (0, import_chunk_JDC43A3I.wrap)(
|
|
18353
18369
|
{ type: "ArrayExpression", elements },
|
|
18354
|
-
startLoc && endLoc && (0,
|
|
18370
|
+
startLoc && endLoc && (0, import_chunk_JDC43A3I.locRange)(startLoc, endLoc)
|
|
18355
18371
|
) : void 0;
|
|
18356
18372
|
if (!id) {
|
|
18357
18373
|
if (!init)
|
|
@@ -18367,7 +18383,7 @@ var init_resources = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
18367
18383
|
"src/resources.ts"() {
|
|
18368
18384
|
"use strict";
|
|
18369
18385
|
init_api();
|
|
18370
|
-
(0,
|
|
18386
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
18371
18387
|
init_sdk_util();
|
|
18372
18388
|
drawableSkips = {
|
|
18373
18389
|
x: { center: true, left: true, right: true, start: true },
|
|
@@ -18649,7 +18665,7 @@ async function getApiMapping(state, resourcesMap, manifestXML) {
|
|
|
18649
18665
|
if (!value2 || value2.type !== "EnumStringMember" && (value2.type !== "VariableDeclarator" || value2.kind !== "const")) {
|
|
18650
18666
|
throw `Negative constant ${fixup} did not refer to a constant`;
|
|
18651
18667
|
}
|
|
18652
|
-
const init = (0,
|
|
18668
|
+
const init = (0, import_chunk_JDC43A3I.getLiteralNode)(value2.init);
|
|
18653
18669
|
if (!init || init.type !== "Literal") {
|
|
18654
18670
|
throw `Negative constant ${fixup} was not a Literal`;
|
|
18655
18671
|
}
|
|
@@ -18664,7 +18680,7 @@ async function getApiMapping(state, resourcesMap, manifestXML) {
|
|
|
18664
18680
|
return result;
|
|
18665
18681
|
}
|
|
18666
18682
|
function isStateNode(node) {
|
|
18667
|
-
return (0,
|
|
18683
|
+
return (0, import_chunk_JDC43A3I.hasProperty)(node, "node");
|
|
18668
18684
|
}
|
|
18669
18685
|
function variableDeclarationName(node) {
|
|
18670
18686
|
return ("left" in node ? node.left : node).name;
|
|
@@ -18700,7 +18716,7 @@ function checkOne(state, ns, decls, node) {
|
|
|
18700
18716
|
}
|
|
18701
18717
|
return cls.superClass.reduce((result, sup) => {
|
|
18702
18718
|
const sdecls = sup[decls];
|
|
18703
|
-
const next = (0,
|
|
18719
|
+
const next = (0, import_chunk_JDC43A3I.hasProperty)(sdecls, node.name) ? sdecls[node.name] : superChain(sup);
|
|
18704
18720
|
return next ? result ? result.concat(next) : next : result;
|
|
18705
18721
|
}, null);
|
|
18706
18722
|
};
|
|
@@ -18721,7 +18737,7 @@ function checkOne(state, ns, decls, node) {
|
|
|
18721
18737
|
}, null);
|
|
18722
18738
|
};
|
|
18723
18739
|
const ndecls = ns[decls];
|
|
18724
|
-
if ((0,
|
|
18740
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(ndecls, node.name)) {
|
|
18725
18741
|
return ndecls[node.name];
|
|
18726
18742
|
}
|
|
18727
18743
|
switch (ns.type) {
|
|
@@ -18774,7 +18790,7 @@ function lookupNext(state, results, decls, property) {
|
|
|
18774
18790
|
return;
|
|
18775
18791
|
}
|
|
18776
18792
|
if (module2.init.type === "Literal") {
|
|
18777
|
-
const [, type] = (0,
|
|
18793
|
+
const [, type] = (0, import_chunk_JDC43A3I.getNodeValue)(module2.init);
|
|
18778
18794
|
switch (type) {
|
|
18779
18795
|
case "Null":
|
|
18780
18796
|
break;
|
|
@@ -18895,7 +18911,7 @@ function lookup(state, decls, node, name, maybeStack, nonlocal, ignoreImports) {
|
|
|
18895
18911
|
case "ClassDeclaration":
|
|
18896
18912
|
if (inStatic && state.config?.enforceStatic !== "NO") {
|
|
18897
18913
|
inStatic = false;
|
|
18898
|
-
if ((0,
|
|
18914
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(si[decls], node.name)) {
|
|
18899
18915
|
const r = si[decls][node.name].filter((s) => {
|
|
18900
18916
|
switch (s.type) {
|
|
18901
18917
|
case "FunctionDeclaration":
|
|
@@ -18986,7 +19002,7 @@ function lookup(state, decls, node, name, maybeStack, nonlocal, ignoreImports) {
|
|
|
18986
19002
|
return [null, null];
|
|
18987
19003
|
}
|
|
18988
19004
|
case "Literal": {
|
|
18989
|
-
const [, type] = (0,
|
|
19005
|
+
const [, type] = (0, import_chunk_JDC43A3I.getNodeValue)(node);
|
|
18990
19006
|
if (type === "Null")
|
|
18991
19007
|
break;
|
|
18992
19008
|
return [
|
|
@@ -19090,7 +19106,7 @@ function stateFuncs() {
|
|
|
19090
19106
|
return this.stack[this.stack.length - 1];
|
|
19091
19107
|
},
|
|
19092
19108
|
traverse(root) {
|
|
19093
|
-
return (0,
|
|
19109
|
+
return (0, import_chunk_JDC43A3I.traverseAst)(
|
|
19094
19110
|
root,
|
|
19095
19111
|
(node) => {
|
|
19096
19112
|
try {
|
|
@@ -19200,7 +19216,7 @@ function stateFuncs() {
|
|
|
19200
19216
|
if (name) {
|
|
19201
19217
|
if (!parent.decls)
|
|
19202
19218
|
parent.decls = {};
|
|
19203
|
-
if ((0,
|
|
19219
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(parent.decls, name)) {
|
|
19204
19220
|
const what = node.type === "ModuleDeclaration" ? "type" : "node";
|
|
19205
19221
|
const e = parent.decls[name].find(
|
|
19206
19222
|
(d) => isStateNode(d) && d[what] === elm[what]
|
|
@@ -19223,7 +19239,7 @@ function stateFuncs() {
|
|
|
19223
19239
|
if (node.type === "ModuleDeclaration" || node.type === "ClassDeclaration") {
|
|
19224
19240
|
if (!parent.type_decls)
|
|
19225
19241
|
parent.type_decls = {};
|
|
19226
|
-
if (!(0,
|
|
19242
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(parent.type_decls, name)) {
|
|
19227
19243
|
parent.type_decls[name] = [];
|
|
19228
19244
|
}
|
|
19229
19245
|
parent.type_decls[name].push(elm);
|
|
@@ -19252,7 +19268,7 @@ function stateFuncs() {
|
|
|
19252
19268
|
const parent = this.top().sn;
|
|
19253
19269
|
if (!parent.type_decls)
|
|
19254
19270
|
parent.type_decls = {};
|
|
19255
|
-
if (!(0,
|
|
19271
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(parent.type_decls, name)) {
|
|
19256
19272
|
parent.type_decls[name] = [];
|
|
19257
19273
|
} else if (parent.type_decls[name].find(
|
|
19258
19274
|
(n) => (isStateNode(n) ? n.node : n) === node
|
|
@@ -19281,7 +19297,7 @@ function stateFuncs() {
|
|
|
19281
19297
|
const stack = this.stackClone();
|
|
19282
19298
|
node.declarations.forEach((decl) => {
|
|
19283
19299
|
const name = variableDeclarationName(decl.id);
|
|
19284
|
-
if (!(0,
|
|
19300
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(decls, name)) {
|
|
19285
19301
|
decls[name] = [];
|
|
19286
19302
|
} else if (decls[name].find(
|
|
19287
19303
|
(n) => (isStateNode(n) ? n.node : n) === decl
|
|
@@ -19298,7 +19314,7 @@ function stateFuncs() {
|
|
|
19298
19314
|
attributes: stateNodeAttrs(node.attrs)
|
|
19299
19315
|
});
|
|
19300
19316
|
if (node.kind === "const") {
|
|
19301
|
-
if (!(0,
|
|
19317
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(this.index, name)) {
|
|
19302
19318
|
this.index[name] = [];
|
|
19303
19319
|
}
|
|
19304
19320
|
(0, import_chunk_OASVKTK5.pushUnique)(this.index[name], parent);
|
|
@@ -19341,7 +19357,7 @@ function stateFuncs() {
|
|
|
19341
19357
|
};
|
|
19342
19358
|
}
|
|
19343
19359
|
const name = m.id.name;
|
|
19344
|
-
const init = (0,
|
|
19360
|
+
const init = (0, import_chunk_JDC43A3I.getLiteralNode)(m.init);
|
|
19345
19361
|
if (init) {
|
|
19346
19362
|
if (init !== m.init) {
|
|
19347
19363
|
if (m.init.enumType) {
|
|
@@ -19353,7 +19369,7 @@ function stateFuncs() {
|
|
|
19353
19369
|
prev = init.value;
|
|
19354
19370
|
}
|
|
19355
19371
|
}
|
|
19356
|
-
if (!(0,
|
|
19372
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(values, name)) {
|
|
19357
19373
|
values[name] = [];
|
|
19358
19374
|
}
|
|
19359
19375
|
if ((0, import_chunk_OASVKTK5.pushUnique)(values[name], m) && currentEnum) {
|
|
@@ -19361,7 +19377,7 @@ function stateFuncs() {
|
|
|
19361
19377
|
this.enumMap = /* @__PURE__ */ new Map();
|
|
19362
19378
|
this.enumMap.set(m, currentEnum);
|
|
19363
19379
|
}
|
|
19364
|
-
if (!(0,
|
|
19380
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(this.index, name)) {
|
|
19365
19381
|
this.index[name] = [];
|
|
19366
19382
|
}
|
|
19367
19383
|
(0, import_chunk_OASVKTK5.pushUnique)(this.index[name], parent);
|
|
@@ -19679,7 +19695,7 @@ function findUsing(state, stack, using) {
|
|
|
19679
19695
|
find(node.object);
|
|
19680
19696
|
name = node.property.name;
|
|
19681
19697
|
}
|
|
19682
|
-
if ((0,
|
|
19698
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(module2.decls, name)) {
|
|
19683
19699
|
const decls = module2.decls[name];
|
|
19684
19700
|
if (decls && decls.length === 1 && decls[0].type === "ModuleDeclaration") {
|
|
19685
19701
|
module2 = decls[0];
|
|
@@ -19708,7 +19724,7 @@ function findUsingForNode(state, stack, i, node) {
|
|
|
19708
19724
|
let imports = null;
|
|
19709
19725
|
while (i >= 0) {
|
|
19710
19726
|
const si = stack[i--];
|
|
19711
|
-
if ((0,
|
|
19727
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(si.usings, node.name)) {
|
|
19712
19728
|
const using = si.usings[node.name];
|
|
19713
19729
|
return findUsing(state, stack, using);
|
|
19714
19730
|
}
|
|
@@ -19717,7 +19733,7 @@ function findUsingForNode(state, stack, i, node) {
|
|
|
19717
19733
|
const using = si.imports[j];
|
|
19718
19734
|
const module2 = findUsing(state, stack, using);
|
|
19719
19735
|
if (module2) {
|
|
19720
|
-
if ((0,
|
|
19736
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(module2.type_decls, node.name)) {
|
|
19721
19737
|
if (!imports)
|
|
19722
19738
|
imports = [];
|
|
19723
19739
|
imports.push({
|
|
@@ -19811,7 +19827,7 @@ function diagnosticHelper(diagnostics, node, message, type = "INFO", extra) {
|
|
|
19811
19827
|
if (!loc || !loc.source)
|
|
19812
19828
|
return;
|
|
19813
19829
|
const source = loc.source;
|
|
19814
|
-
if (!(0,
|
|
19830
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(diagnostics, source)) {
|
|
19815
19831
|
if (!message)
|
|
19816
19832
|
return;
|
|
19817
19833
|
diagnostics[source] = [];
|
|
@@ -19856,7 +19872,7 @@ function getSuperClasses(klass) {
|
|
|
19856
19872
|
}
|
|
19857
19873
|
var init_api = (0, import_chunk_ABYVSU2C.__esm)({
|
|
19858
19874
|
"src/api.ts"() {
|
|
19859
|
-
(0,
|
|
19875
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
19860
19876
|
init_data_flow();
|
|
19861
19877
|
init_mc_rewrite();
|
|
19862
19878
|
init_negative_fixups();
|
|
@@ -20072,7 +20088,7 @@ function buildDataFlowGraph(state, func, wantsLiteral, trackInsertionPoints, wan
|
|
|
20072
20088
|
break;
|
|
20073
20089
|
case "Literal":
|
|
20074
20090
|
if (wantsLiteral(node)) {
|
|
20075
|
-
const result = (0,
|
|
20091
|
+
const result = (0, import_chunk_JDC43A3I.getNodeValue)(node);
|
|
20076
20092
|
const key = result[1] + (result[0].value === null ? "" : "-" + result[0].value.toString());
|
|
20077
20093
|
let decl = literals.get(key);
|
|
20078
20094
|
if (!decl) {
|
|
@@ -20225,7 +20241,7 @@ function buildDataFlowGraph(state, func, wantsLiteral, trackInsertionPoints, wan
|
|
|
20225
20241
|
return { type: "mod", node, mayThrow: mayThrow2, callees };
|
|
20226
20242
|
}
|
|
20227
20243
|
default:
|
|
20228
|
-
if (!(0,
|
|
20244
|
+
if (!(0, import_chunk_JDC43A3I.isExpression)(node))
|
|
20229
20245
|
break;
|
|
20230
20246
|
unhandledType(node);
|
|
20231
20247
|
}
|
|
@@ -20340,7 +20356,7 @@ var init_data_flow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
20340
20356
|
"src/data-flow.ts"() {
|
|
20341
20357
|
"use strict";
|
|
20342
20358
|
init_api();
|
|
20343
|
-
(0,
|
|
20359
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
20344
20360
|
init_control_flow();
|
|
20345
20361
|
init_function_info();
|
|
20346
20362
|
init_type_flow_util();
|
|
@@ -24097,7 +24113,7 @@ function groupBlocks(func) {
|
|
|
24097
24113
|
}
|
|
24098
24114
|
});
|
|
24099
24115
|
const isCfgNode = (node) => {
|
|
24100
|
-
return (0,
|
|
24116
|
+
return (0, import_chunk_JDC43A3I.hasProperty)(node, "items");
|
|
24101
24117
|
};
|
|
24102
24118
|
const sortHelper = (node) => {
|
|
24103
24119
|
const itemsToSort = /* @__PURE__ */ new Set();
|
|
@@ -24232,7 +24248,7 @@ function getLocalsInfo(func) {
|
|
|
24232
24248
|
var init_emit = (0, import_chunk_ABYVSU2C.__esm)({
|
|
24233
24249
|
"src/readprg/emit.ts"() {
|
|
24234
24250
|
"use strict";
|
|
24235
|
-
(0,
|
|
24251
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
24236
24252
|
init_cflow();
|
|
24237
24253
|
init_opcodes();
|
|
24238
24254
|
init_optimize2();
|
|
@@ -24793,7 +24809,7 @@ function bytecodeToString(bytecode, symbolTable) {
|
|
|
24793
24809
|
arg = `${bytecode.arg.argc} ${bytecode.arg.incsp}`;
|
|
24794
24810
|
break;
|
|
24795
24811
|
}
|
|
24796
|
-
if (arg == null && (0,
|
|
24812
|
+
if (arg == null && (0, import_chunk_JDC43A3I.hasProperty)(bytecode, "arg")) {
|
|
24797
24813
|
arg = `${bytecode.arg}`;
|
|
24798
24814
|
}
|
|
24799
24815
|
if (arg != null) {
|
|
@@ -25124,7 +25140,7 @@ var SectionKinds;
|
|
|
25124
25140
|
var init_bytecode = (0, import_chunk_ABYVSU2C.__esm)({
|
|
25125
25141
|
"src/readprg/bytecode.ts"() {
|
|
25126
25142
|
"use strict";
|
|
25127
|
-
(0,
|
|
25143
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
25128
25144
|
init_sdk_util();
|
|
25129
25145
|
(0, import_chunk_OASVKTK5.init_util)();
|
|
25130
25146
|
init_data();
|
|
@@ -28092,7 +28108,7 @@ var init_manifest = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
28092
28108
|
}
|
|
28093
28109
|
});
|
|
28094
28110
|
function isJNode(obj) {
|
|
28095
|
-
return (0,
|
|
28111
|
+
return (0, import_chunk_JDC43A3I.hasProperty)(obj, "type");
|
|
28096
28112
|
}
|
|
28097
28113
|
async function default_jungle() {
|
|
28098
28114
|
const assignments = [];
|
|
@@ -28134,11 +28150,11 @@ async function default_jungle() {
|
|
|
28134
28150
|
);
|
|
28135
28151
|
}
|
|
28136
28152
|
const shape = match[1];
|
|
28137
|
-
if (!(0,
|
|
28153
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(done, shape)) {
|
|
28138
28154
|
rezAndLang(shape, `resources-${shape}`, "base");
|
|
28139
28155
|
done[shape] = true;
|
|
28140
28156
|
}
|
|
28141
|
-
if (!(0,
|
|
28157
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(done, deviceFamily)) {
|
|
28142
28158
|
rezAndLang(deviceFamily, `resources-${deviceFamily}`, shape);
|
|
28143
28159
|
done[deviceFamily] = true;
|
|
28144
28160
|
}
|
|
@@ -28151,7 +28167,7 @@ function process_assignments(assignments, current) {
|
|
|
28151
28167
|
return assignments.reduce((state, a) => {
|
|
28152
28168
|
const { node, dot, dotnames } = a.names.reduce(
|
|
28153
28169
|
(r, name) => {
|
|
28154
|
-
if (!(0,
|
|
28170
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(r.node, name))
|
|
28155
28171
|
r.node[name] = {};
|
|
28156
28172
|
r.dotnames.push(name);
|
|
28157
28173
|
r.node = r.node[name];
|
|
@@ -28222,7 +28238,7 @@ function evaluate_locals(assignments) {
|
|
|
28222
28238
|
value: v.values.map((s) => s.type === "Literal" ? s.value : "").join("")
|
|
28223
28239
|
};
|
|
28224
28240
|
}
|
|
28225
|
-
} else if (v.type === "QualifiedName" && v.names.length === 1 && (0,
|
|
28241
|
+
} else if (v.type === "QualifiedName" && v.names.length === 1 && (0, import_chunk_JDC43A3I.hasProperty)(locals, v.names[0])) {
|
|
28226
28242
|
values.splice(i, 1, ...locals[v.names[0]]);
|
|
28227
28243
|
} else if (v.type === "SubList") {
|
|
28228
28244
|
process_list(v.values);
|
|
@@ -28390,7 +28406,7 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
|
28390
28406
|
/[\\/]\*\*([^\\/])/g,
|
|
28391
28407
|
"/**/*$1"
|
|
28392
28408
|
);
|
|
28393
|
-
if (!(0,
|
|
28409
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(cache.resolvedPaths, resolved)) {
|
|
28394
28410
|
if (/[*?[\]{}]/.test(resolved)) {
|
|
28395
28411
|
cache.resolvedPaths[resolved] = (0, import_chunk_OASVKTK5.globSome)(resolved, () => true);
|
|
28396
28412
|
} else {
|
|
@@ -28447,7 +28463,7 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
|
28447
28463
|
resolve_literal_list(qualifier, "excludeAnnotations");
|
|
28448
28464
|
const annotations = {};
|
|
28449
28465
|
Object.entries(qualifier).forEach(([k, v]) => {
|
|
28450
|
-
if ((0,
|
|
28466
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(v, "annotations")) {
|
|
28451
28467
|
annotations[k] = v["annotations"];
|
|
28452
28468
|
resolve_literal_list(annotations, k);
|
|
28453
28469
|
delete qualifier[k];
|
|
@@ -28468,7 +28484,7 @@ async function read_resource_files(targets, cache) {
|
|
|
28468
28484
|
if (!p.qualifier.resourcePath)
|
|
28469
28485
|
return null;
|
|
28470
28486
|
const key = p.qualifier.resourcePath.join(";");
|
|
28471
|
-
if (!(0,
|
|
28487
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(resourceGroupPromises, key)) {
|
|
28472
28488
|
resourceGroupPromises[key] = Promise.all(
|
|
28473
28489
|
p.qualifier.resourcePath.map(
|
|
28474
28490
|
(pattern) => (0, import_chunk_OASVKTK5.globa)(pattern, { mark: true })
|
|
@@ -28482,7 +28498,7 @@ async function read_resource_files(targets, cache) {
|
|
|
28482
28498
|
).then(
|
|
28483
28499
|
(paths) => Promise.all(
|
|
28484
28500
|
paths.flat().filter((file) => file.endsWith(".xml")).map((file) => {
|
|
28485
|
-
if (!(0,
|
|
28501
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(cache.resources, file)) {
|
|
28486
28502
|
cache.resources[file] = fs5.readFile(file).then((data) => xml_util_exports.parseXml(data.toString(), file));
|
|
28487
28503
|
}
|
|
28488
28504
|
return Promise.resolve(cache.resources[file]).then((rez) => {
|
|
@@ -28548,9 +28564,9 @@ async function find_build_instructions(targets, resourceGroups, buildDependencie
|
|
|
28548
28564
|
if (!p.qualifier.resourcePath)
|
|
28549
28565
|
return;
|
|
28550
28566
|
const key = p.qualifier.resourcePath.join(";");
|
|
28551
|
-
if (!(0,
|
|
28567
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(resourceGroups, key))
|
|
28552
28568
|
return;
|
|
28553
|
-
if (!(0,
|
|
28569
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(resourceGroups[key], "buildInstructions")) {
|
|
28554
28570
|
resourceGroups[key].buildInstructions = (await Promise.all(
|
|
28555
28571
|
resourceGroups[key].resourceFiles.map(
|
|
28556
28572
|
({ path: path7, resources }) => find_build_instructions_in_resource(
|
|
@@ -28587,7 +28603,7 @@ function identify_optimizer_groups(targets, options) {
|
|
|
28587
28603
|
if (option === "*") {
|
|
28588
28604
|
return [];
|
|
28589
28605
|
} else {
|
|
28590
|
-
return strs.filter((a) => !(0,
|
|
28606
|
+
return strs.filter((a) => !(0, import_chunk_JDC43A3I.hasProperty)(option, a));
|
|
28591
28607
|
}
|
|
28592
28608
|
};
|
|
28593
28609
|
const ignoreRegExpOption = (str) => {
|
|
@@ -28630,7 +28646,7 @@ function identify_optimizer_groups(targets, options) {
|
|
|
28630
28646
|
target.qualifier.sourcePath.forEach((path7) => {
|
|
28631
28647
|
const m = path7.match(ignoredSourcePathsRe);
|
|
28632
28648
|
const key2 = m ? "key-" + m.slice(1).join("") : path7;
|
|
28633
|
-
if (!(0,
|
|
28649
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(state.keys, key2)) {
|
|
28634
28650
|
state.keys[key2] = {};
|
|
28635
28651
|
}
|
|
28636
28652
|
state.keys[key2][path7] = true;
|
|
@@ -28696,7 +28712,7 @@ function identify_optimizer_groups(targets, options) {
|
|
|
28696
28712
|
}
|
|
28697
28713
|
return toSortedEntries(value2);
|
|
28698
28714
|
});
|
|
28699
|
-
if (!(0,
|
|
28715
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(groups, serialized)) {
|
|
28700
28716
|
groups[serialized] = {
|
|
28701
28717
|
key: "group" + key.toString().padStart(3, "0"),
|
|
28702
28718
|
optimizerConfig
|
|
@@ -28738,7 +28754,7 @@ function find_barrels(barrelPath, buildDependencies) {
|
|
|
28738
28754
|
});
|
|
28739
28755
|
}
|
|
28740
28756
|
function resolve_barrel(barrel, barrelDir, products, options, cache, buildDependencies) {
|
|
28741
|
-
if ((0,
|
|
28757
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(cache.barrels, barrel)) {
|
|
28742
28758
|
return cache.barrels[barrel];
|
|
28743
28759
|
}
|
|
28744
28760
|
let promise = Promise.resolve(null);
|
|
@@ -28806,7 +28822,7 @@ function resolve_barrels(jungle, product, qualifier, barrels, products, options,
|
|
|
28806
28822
|
return result;
|
|
28807
28823
|
}, {});
|
|
28808
28824
|
};
|
|
28809
|
-
if ((0,
|
|
28825
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(cache.barrelMap, barrelMapKey)) {
|
|
28810
28826
|
setBarrelMap(cache.barrelMap[barrelMapKey]);
|
|
28811
28827
|
return null;
|
|
28812
28828
|
}
|
|
@@ -28838,7 +28854,7 @@ function resolve_barrels(jungle, product, qualifier, barrels, products, options,
|
|
|
28838
28854
|
resolvedBarrel.manifest,
|
|
28839
28855
|
resolvedBarrel.xml
|
|
28840
28856
|
);
|
|
28841
|
-
if (!(0,
|
|
28857
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(barrelMap, name))
|
|
28842
28858
|
return;
|
|
28843
28859
|
const bmapName = barrelMap[name];
|
|
28844
28860
|
if (bmapName) {
|
|
@@ -28896,7 +28912,7 @@ async function get_jungle_and_barrels(jungleFiles, defaultProducts, options, cac
|
|
|
28896
28912
|
if (!options.workspace) {
|
|
28897
28913
|
options.workspace = path2.dirname(manifest);
|
|
28898
28914
|
}
|
|
28899
|
-
if (!(0,
|
|
28915
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(cache.resources, manifest)) {
|
|
28900
28916
|
cache.resources[manifest] = readManifest(manifest);
|
|
28901
28917
|
}
|
|
28902
28918
|
const xml = await Promise.resolve(cache.resources[manifest]);
|
|
@@ -28939,7 +28955,7 @@ async function get_jungle_and_barrels(jungleFiles, defaultProducts, options, cac
|
|
|
28939
28955
|
});
|
|
28940
28956
|
};
|
|
28941
28957
|
products.forEach((product) => {
|
|
28942
|
-
if ((0,
|
|
28958
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(state, product)) {
|
|
28943
28959
|
const sp = state[product];
|
|
28944
28960
|
if (sp && !Array.isArray(sp) && sp.products) {
|
|
28945
28961
|
sp.products.forEach((p) => add_one(p, product));
|
|
@@ -29125,7 +29141,7 @@ async function getCodeWorkspaceSettings(folder) {
|
|
|
29125
29141
|
return {};
|
|
29126
29142
|
}
|
|
29127
29143
|
function isErrorWithLocation(e) {
|
|
29128
|
-
return (0,
|
|
29144
|
+
return (0, import_chunk_JDC43A3I.hasProperty)(e, "location");
|
|
29129
29145
|
}
|
|
29130
29146
|
function getConfig(options) {
|
|
29131
29147
|
const config = { ...defaultConfig, ...options || {} };
|
|
@@ -29163,7 +29179,7 @@ async function buildOptimizedProject(product, options) {
|
|
|
29163
29179
|
config.products = [product];
|
|
29164
29180
|
} else {
|
|
29165
29181
|
delete config.testBuild;
|
|
29166
|
-
if (!(0,
|
|
29182
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(config, "releaseBuild")) {
|
|
29167
29183
|
config.releaseBuild = true;
|
|
29168
29184
|
}
|
|
29169
29185
|
}
|
|
@@ -29219,7 +29235,7 @@ async function createLocalBarrels(targets, options) {
|
|
|
29219
29235
|
);
|
|
29220
29236
|
const sha1 = crypto3.createHash("sha1").update(rawBarrelDir, "binary").digest("base64").replace(/[/=+]/g, "");
|
|
29221
29237
|
const optBarrelDir = path4.resolve(barrelDir, `${barrel}-${sha1}`);
|
|
29222
|
-
if (!(0,
|
|
29238
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(optBarrels, barrel)) {
|
|
29223
29239
|
optBarrels[barrel] = {
|
|
29224
29240
|
rawBarrelDir,
|
|
29225
29241
|
manifest,
|
|
@@ -29302,7 +29318,7 @@ async function generateOptimizedProject(options) {
|
|
|
29302
29318
|
throw new Error(`Missing group in build target ${p.product}`);
|
|
29303
29319
|
}
|
|
29304
29320
|
const key = configKey(p);
|
|
29305
|
-
if (!(0,
|
|
29321
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(buildConfigs, key)) {
|
|
29306
29322
|
p.group.dir = key;
|
|
29307
29323
|
if (p.group.optimizerConfig.barrelMap && !p.group.optimizerConfig.optBarrels) {
|
|
29308
29324
|
dropBarrels = true;
|
|
@@ -29476,7 +29492,7 @@ async function generateOptimizedProject(options) {
|
|
|
29476
29492
|
if (qLang) {
|
|
29477
29493
|
const devLang = devices[product].languages;
|
|
29478
29494
|
const unsupportedLangs = Object.keys(qLang).sort().map((key) => {
|
|
29479
|
-
if ((0,
|
|
29495
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(devLang, key) || !(0, import_chunk_JDC43A3I.hasProperty)(languagesToInclude, key)) {
|
|
29480
29496
|
return null;
|
|
29481
29497
|
}
|
|
29482
29498
|
const mapped = map_field(qLang, key, quoted_relative_path);
|
|
@@ -29487,7 +29503,7 @@ async function generateOptimizedProject(options) {
|
|
|
29487
29503
|
let keysToSkip = null;
|
|
29488
29504
|
if (unsupportedLangs.length) {
|
|
29489
29505
|
const key = JSON.stringify(unsupportedLangs);
|
|
29490
|
-
if (!(0,
|
|
29506
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(unsupportedLangsCache, key)) {
|
|
29491
29507
|
const base = nextAvailableDefault();
|
|
29492
29508
|
if (base) {
|
|
29493
29509
|
unsupportedLangs.forEach(
|
|
@@ -29496,13 +29512,13 @@ async function generateOptimizedProject(options) {
|
|
|
29496
29512
|
unsupportedLangsCache[key] = `${base}.lang`;
|
|
29497
29513
|
}
|
|
29498
29514
|
}
|
|
29499
|
-
if ((0,
|
|
29515
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(unsupportedLangsCache, key)) {
|
|
29500
29516
|
keysToSkip = Object.fromEntries(unsupportedLangs);
|
|
29501
29517
|
parts.push(`${prefix}lang = $(${unsupportedLangsCache[key]})`);
|
|
29502
29518
|
}
|
|
29503
29519
|
}
|
|
29504
29520
|
Object.keys(qLang).forEach((key) => {
|
|
29505
|
-
(0,
|
|
29521
|
+
(0, import_chunk_JDC43A3I.hasProperty)(keysToSkip, key) || !(0, import_chunk_JDC43A3I.hasProperty)(languagesToInclude, key) || process_field(`${prefix}lang.`, qLang, key, relative_path);
|
|
29506
29522
|
});
|
|
29507
29523
|
}
|
|
29508
29524
|
});
|
|
@@ -29655,7 +29671,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29655
29671
|
);
|
|
29656
29672
|
barrelFnMaps.forEach(
|
|
29657
29673
|
(barrelFnMap) => Object.entries(barrelFnMap).forEach(([key2, value2]) => {
|
|
29658
|
-
if (!(0,
|
|
29674
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(fnMap, key2)) {
|
|
29659
29675
|
fnMap[key2] = value2;
|
|
29660
29676
|
}
|
|
29661
29677
|
})
|
|
@@ -29683,7 +29699,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29683
29699
|
const opt_time = await (0, import_chunk_OASVKTK5.first_modified)(
|
|
29684
29700
|
Object.values(fnMap).map((v) => v.output)
|
|
29685
29701
|
);
|
|
29686
|
-
if (source_time < opt_time &&
|
|
29702
|
+
if (source_time < opt_time && 1721003959168 < opt_time) {
|
|
29687
29703
|
return {
|
|
29688
29704
|
hasTests,
|
|
29689
29705
|
diagnostics: prevDiagnostics,
|
|
@@ -29721,7 +29737,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29721
29737
|
hasTests: hasTests2,
|
|
29722
29738
|
diagnostics,
|
|
29723
29739
|
sdkVersion,
|
|
29724
|
-
optimizerVersion: "1.1.
|
|
29740
|
+
optimizerVersion: "1.1.69",
|
|
29725
29741
|
...Object.fromEntries(
|
|
29726
29742
|
configOptionsToCheck.map((option) => [option, config[option]])
|
|
29727
29743
|
)
|
|
@@ -29795,7 +29811,7 @@ async function getProjectAnalysisHelper(targets, analysis, manifestXML, options)
|
|
|
29795
29811
|
);
|
|
29796
29812
|
if (analysis) {
|
|
29797
29813
|
Object.entries(fnMap).forEach(([k, v]) => {
|
|
29798
|
-
if ((0,
|
|
29814
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(analysis.fnMap, k)) {
|
|
29799
29815
|
const old = analysis.fnMap[k];
|
|
29800
29816
|
if (old.monkeyCSource)
|
|
29801
29817
|
v.monkeyCSource = old.monkeyCSource;
|
|
@@ -29809,7 +29825,7 @@ async function getProjectAnalysisHelper(targets, analysis, manifestXML, options)
|
|
|
29809
29825
|
const addResources = (name, resources) => {
|
|
29810
29826
|
if (!resources)
|
|
29811
29827
|
return;
|
|
29812
|
-
if (!(0,
|
|
29828
|
+
if (!(0, import_chunk_JDC43A3I.hasProperty)(resourcesMap, name)) {
|
|
29813
29829
|
resourcesMap[name] = { ...resources };
|
|
29814
29830
|
} else {
|
|
29815
29831
|
Object.assign(resourcesMap[name], resources);
|
|
@@ -30185,7 +30201,7 @@ function optimizeProgramBuffer(filepath, view, debugXml, apiDebugXml, key, confi
|
|
|
30185
30201
|
const { sections } = readPrgWithOffsets(view);
|
|
30186
30202
|
(0, import_chunk_OASVKTK5.logger)("readprg", 5, sections);
|
|
30187
30203
|
const symbolTable = new SymbolTable();
|
|
30188
|
-
if ((0,
|
|
30204
|
+
if ((0, import_chunk_JDC43A3I.hasProperty)(sections, 1461170197 .toString())) {
|
|
30189
30205
|
symbolTable.parse(sections[
|
|
30190
30206
|
1461170197
|
|
30191
30207
|
/* SYMBOLS */
|
|
@@ -30473,7 +30489,7 @@ var init_readprg = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
30473
30489
|
"use strict";
|
|
30474
30490
|
yauzl = (0, import_chunk_ABYVSU2C.__toESM)(require_yauzl());
|
|
30475
30491
|
yazl = (0, import_chunk_ABYVSU2C.__toESM)(require_yazl());
|
|
30476
|
-
(0,
|
|
30492
|
+
(0, import_chunk_JDC43A3I.init_ast)();
|
|
30477
30493
|
init_bytecode();
|
|
30478
30494
|
init_data();
|
|
30479
30495
|
init_exceptions();
|