@markw65/monkeyc-optimizer 1.1.26 → 1.1.28
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/README.md +21 -1
- package/bin/cft-font-info.js +63 -0
- package/build/api.cjs +36 -34
- package/build/cftinfo.cjs +112 -0
- package/build/chunk-ABYVSU2C.cjs +74 -0
- package/build/chunk-MBTLUWXR.cjs +375 -0
- package/build/{chunk-YZ44IUV6.cjs → chunk-PVBIKZYZ.cjs} +105 -153
- package/build/{chunk-XO53WBWQ.cjs → chunk-ZI7CGRJC.cjs} +630 -902
- package/build/optimizer.cjs +21 -19
- package/build/sdk-util.cjs +17 -15
- package/build/src/cftinfo.d.ts +32 -0
- package/build/src/mc-rewrite.d.ts +4 -1
- package/build/src/optimizer.d.ts +1 -0
- package/build/src/projects.d.ts +2 -1
- package/build/src/type-flow/interp.d.ts +1 -0
- package/build/src/worker-task.d.ts +1 -0
- package/build/util.cjs +25 -24
- package/build/worker-thread.cjs +7 -5
- package/package.json +6 -2
|
@@ -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_ZI7CGRJC_exports = {};
|
|
30
|
+
__export(chunk_ZI7CGRJC_exports, {
|
|
31
31
|
EnumTagsConst: () => EnumTagsConst,
|
|
32
32
|
LastTypeTag: () => LastTypeTag,
|
|
33
33
|
ObjectLikeTagsConst: () => ObjectLikeTagsConst,
|
|
@@ -65,9 +65,7 @@ __export(chunk_XO53WBWQ_exports, {
|
|
|
65
65
|
getSdkPath: () => getSdkPath,
|
|
66
66
|
getSuperClasses: () => getSuperClasses,
|
|
67
67
|
get_jungle: () => get_jungle,
|
|
68
|
-
hasProperty: () => hasProperty,
|
|
69
68
|
init_api: () => init_api,
|
|
70
|
-
init_ast: () => init_ast,
|
|
71
69
|
init_bytecode: () => init_bytecode,
|
|
72
70
|
init_could_be: () => init_could_be,
|
|
73
71
|
init_intersection_type: () => init_intersection_type,
|
|
@@ -99,7 +97,7 @@ __export(chunk_XO53WBWQ_exports, {
|
|
|
99
97
|
manifestProducts: () => manifestProducts,
|
|
100
98
|
mapVarDeclsByType: () => mapVarDeclsByType,
|
|
101
99
|
markInvokeClassMethod: () => markInvokeClassMethod,
|
|
102
|
-
mctree: () =>
|
|
100
|
+
mctree: () => import_prettier_plugin_monkeyc5.mctree,
|
|
103
101
|
mustBeFalse: () => mustBeFalse,
|
|
104
102
|
mustBeTrue: () => mustBeTrue,
|
|
105
103
|
opcodeSize: () => opcodeSize,
|
|
@@ -116,7 +114,6 @@ __export(chunk_XO53WBWQ_exports, {
|
|
|
116
114
|
startPool: () => startPool,
|
|
117
115
|
stopPool: () => stopPool,
|
|
118
116
|
subtypeOf: () => subtypeOf,
|
|
119
|
-
traverseAst: () => traverseAst,
|
|
120
117
|
typeFromTypeStateNode: () => typeFromTypeStateNode,
|
|
121
118
|
unionInto: () => unionInto,
|
|
122
119
|
variableDeclarationName: () => variableDeclarationName,
|
|
@@ -125,19 +122,20 @@ __export(chunk_XO53WBWQ_exports, {
|
|
|
125
122
|
visitorNode: () => visitorNode,
|
|
126
123
|
xml_util_exports: () => xml_util_exports
|
|
127
124
|
});
|
|
128
|
-
module.exports = __toCommonJS(
|
|
129
|
-
var
|
|
130
|
-
var
|
|
125
|
+
module.exports = __toCommonJS(chunk_ZI7CGRJC_exports);
|
|
126
|
+
var import_chunk_PVBIKZYZ = require("./chunk-PVBIKZYZ.cjs");
|
|
127
|
+
var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
|
|
128
|
+
var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
|
|
131
129
|
var import_node_assert = __toESM(require("node:assert"));
|
|
132
|
-
var
|
|
130
|
+
var import_prettier_plugin_monkeyc = require("@markw65/prettier-plugin-monkeyc");
|
|
133
131
|
var import_node_assert2 = __toESM(require("node:assert"));
|
|
134
132
|
var import_node_assert3 = __toESM(require("node:assert"));
|
|
135
133
|
var import_node_assert4 = __toESM(require("node:assert"));
|
|
136
134
|
var import_node_assert5 = __toESM(require("node:assert"));
|
|
137
|
-
var
|
|
135
|
+
var import_prettier_plugin_monkeyc2 = __toESM(require("@markw65/prettier-plugin-monkeyc"));
|
|
138
136
|
var fs = __toESM(require("fs/promises"));
|
|
137
|
+
var import_prettier_plugin_monkeyc3 = __toESM(require("@markw65/prettier-plugin-monkeyc"));
|
|
139
138
|
var import_prettier_plugin_monkeyc4 = __toESM(require("@markw65/prettier-plugin-monkeyc"));
|
|
140
|
-
var import_prettier_plugin_monkeyc5 = __toESM(require("@markw65/prettier-plugin-monkeyc"));
|
|
141
139
|
var fs2 = __toESM(require("fs/promises"));
|
|
142
140
|
var Prettier = __toESM(require("prettier"));
|
|
143
141
|
var import_node_assert6 = __toESM(require("node:assert"));
|
|
@@ -161,7 +159,7 @@ var path2 = __toESM(require("path"));
|
|
|
161
159
|
var net = __toESM(require("net"));
|
|
162
160
|
var path3 = __toESM(require("path"));
|
|
163
161
|
var import_child_process = require("child_process");
|
|
164
|
-
var
|
|
162
|
+
var import_prettier_plugin_monkeyc5 = require("@markw65/prettier-plugin-monkeyc");
|
|
165
163
|
var crypto3 = __toESM(require("crypto"));
|
|
166
164
|
var fs6 = __toESM(require("fs/promises"));
|
|
167
165
|
var path4 = __toESM(require("path"));
|
|
@@ -5152,7 +5150,7 @@ function peg$parse(input, options) {
|
|
|
5152
5150
|
);
|
|
5153
5151
|
}
|
|
5154
5152
|
}
|
|
5155
|
-
var init_xml = (0,
|
|
5153
|
+
var init_xml = (0, import_chunk_ABYVSU2C.__esm)({
|
|
5156
5154
|
"src/xml.peggy"() {
|
|
5157
5155
|
"use strict";
|
|
5158
5156
|
peg$subclass(peg$SyntaxError, Error);
|
|
@@ -5253,322 +5251,8 @@ var init_xml = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
5253
5251
|
};
|
|
5254
5252
|
}
|
|
5255
5253
|
});
|
|
5256
|
-
function isMCTreeNode(node) {
|
|
5257
|
-
return node ? typeof node === "object" && "type" in node : false;
|
|
5258
|
-
}
|
|
5259
|
-
function traverseAst(node, pre, post, parent) {
|
|
5260
|
-
const nodes = pre && pre(node);
|
|
5261
|
-
if (nodes === false)
|
|
5262
|
-
return;
|
|
5263
|
-
if (!mctreeTypeInfo[node.type]) {
|
|
5264
|
-
throw new Error("what?");
|
|
5265
|
-
}
|
|
5266
|
-
for (const key of nodes || mctreeTypeInfo[node.type].keys) {
|
|
5267
|
-
const value2 = node[key];
|
|
5268
|
-
if (!value2)
|
|
5269
|
-
continue;
|
|
5270
|
-
if (Array.isArray(value2)) {
|
|
5271
|
-
const values = value2;
|
|
5272
|
-
const deletions = values.reduce(
|
|
5273
|
-
(state, obj, i) => {
|
|
5274
|
-
if (isMCTreeNode(obj)) {
|
|
5275
|
-
const repl = traverseAst(obj, pre, post, node);
|
|
5276
|
-
if (repl === false) {
|
|
5277
|
-
if (!state)
|
|
5278
|
-
state = {};
|
|
5279
|
-
state[i] = true;
|
|
5280
|
-
} else if (repl != null) {
|
|
5281
|
-
if (!state)
|
|
5282
|
-
state = {};
|
|
5283
|
-
values[i] = repl;
|
|
5284
|
-
}
|
|
5285
|
-
}
|
|
5286
|
-
return state;
|
|
5287
|
-
},
|
|
5288
|
-
null
|
|
5289
|
-
);
|
|
5290
|
-
if (deletions) {
|
|
5291
|
-
values.splice(
|
|
5292
|
-
0,
|
|
5293
|
-
values.length,
|
|
5294
|
-
...values.filter((obj, i) => deletions[i] !== true).flat(1)
|
|
5295
|
-
);
|
|
5296
|
-
}
|
|
5297
|
-
} else if (isMCTreeNode(value2)) {
|
|
5298
|
-
let repl = traverseAst(value2, pre, post, node);
|
|
5299
|
-
if (repl === false) {
|
|
5300
|
-
delete node[key];
|
|
5301
|
-
} else if (repl != null) {
|
|
5302
|
-
if (Array.isArray(repl)) {
|
|
5303
|
-
if (isStatement(value2) && repl.every((s) => isStatement(s))) {
|
|
5304
|
-
repl = withLoc(
|
|
5305
|
-
{
|
|
5306
|
-
type: "BlockStatement",
|
|
5307
|
-
body: repl
|
|
5308
|
-
},
|
|
5309
|
-
repl[0],
|
|
5310
|
-
repl[repl.length - 1]
|
|
5311
|
-
);
|
|
5312
|
-
} else {
|
|
5313
|
-
throw new Error("Array returned by traverseAst in Node context");
|
|
5314
|
-
}
|
|
5315
|
-
}
|
|
5316
|
-
node[key] = repl;
|
|
5317
|
-
}
|
|
5318
|
-
}
|
|
5319
|
-
}
|
|
5320
|
-
return post && post(node, parent);
|
|
5321
|
-
}
|
|
5322
|
-
function isStatement(node) {
|
|
5323
|
-
return hasProperty(mctreeTypeInfo[node.type], "stmt");
|
|
5324
|
-
}
|
|
5325
|
-
function isExpression(node) {
|
|
5326
|
-
return hasProperty(mctreeTypeInfo[node.type], "expr");
|
|
5327
|
-
}
|
|
5328
|
-
function mayThrow(node) {
|
|
5329
|
-
switch (node.type) {
|
|
5330
|
-
case "BinaryExpression":
|
|
5331
|
-
case "CallExpression":
|
|
5332
|
-
case "NewExpression":
|
|
5333
|
-
case "ThrowStatement":
|
|
5334
|
-
case "UnaryExpression":
|
|
5335
|
-
case "UpdateExpression":
|
|
5336
|
-
return true;
|
|
5337
|
-
default:
|
|
5338
|
-
return false;
|
|
5339
|
-
}
|
|
5340
|
-
}
|
|
5341
|
-
function hasProperty(obj, prop) {
|
|
5342
|
-
return obj ? Object.prototype.hasOwnProperty.call(obj, prop) : false;
|
|
5343
|
-
}
|
|
5344
|
-
function withLoc(node, start, end) {
|
|
5345
|
-
if (start && start.loc) {
|
|
5346
|
-
node.start = start.start;
|
|
5347
|
-
if (!node.end)
|
|
5348
|
-
node.end = start.end;
|
|
5349
|
-
node.loc = { ...node.loc || start.loc, start: start.loc.start };
|
|
5350
|
-
if (end === start && start.origins) {
|
|
5351
|
-
node.origins = start.origins;
|
|
5352
|
-
}
|
|
5353
|
-
}
|
|
5354
|
-
if (end === false) {
|
|
5355
|
-
if (node.loc) {
|
|
5356
|
-
node.loc.end = node.loc.start;
|
|
5357
|
-
node.end = node.start;
|
|
5358
|
-
}
|
|
5359
|
-
} else if (end && end.loc) {
|
|
5360
|
-
node.end = end.end;
|
|
5361
|
-
node.loc = { ...node.loc || end.loc, end: end.loc.end };
|
|
5362
|
-
}
|
|
5363
|
-
return node;
|
|
5364
|
-
}
|
|
5365
|
-
function withLocDeep(node, start, end, inplace) {
|
|
5366
|
-
node = withLoc(inplace ? node : { ...node }, start, end);
|
|
5367
|
-
if (!inplace && node.origins) {
|
|
5368
|
-
node.origins = [...node.origins];
|
|
5369
|
-
}
|
|
5370
|
-
for (const key of mctreeTypeInfo[node.type].keys) {
|
|
5371
|
-
const value2 = node[key];
|
|
5372
|
-
if (!value2)
|
|
5373
|
-
continue;
|
|
5374
|
-
const fix = (v) => isMCTreeNode(v) ? withLocDeep(v, start, end, inplace) : v;
|
|
5375
|
-
const repl = Array.isArray(value2) ? value2.map(fix) : fix(value2);
|
|
5376
|
-
inplace || (node[key] = repl);
|
|
5377
|
-
}
|
|
5378
|
-
return node;
|
|
5379
|
-
}
|
|
5380
|
-
function cloneDeep(node) {
|
|
5381
|
-
return withLocDeep(node, null);
|
|
5382
|
-
}
|
|
5383
|
-
function getNodeValue(node) {
|
|
5384
|
-
if (node.type === "BinaryExpression" && node.operator === "as" && node.right.type === "TypeSpecList" && node.right.ts.length === 1 && typeof node.right.ts[0] === "string") {
|
|
5385
|
-
return getNodeValue(node.left);
|
|
5386
|
-
}
|
|
5387
|
-
if (node.type !== "Literal") {
|
|
5388
|
-
return [null, null];
|
|
5389
|
-
}
|
|
5390
|
-
if (node.value === null) {
|
|
5391
|
-
return [node, "Null"];
|
|
5392
|
-
}
|
|
5393
|
-
const type = typeof node.value;
|
|
5394
|
-
if (type === "number") {
|
|
5395
|
-
const match = import_prettier_plugin_monkeyc.LiteralIntegerRe.exec(node.raw);
|
|
5396
|
-
if (match) {
|
|
5397
|
-
return match[2] === "l" || match[2] === "L" ? [node, "Long"] : [node, "Number"];
|
|
5398
|
-
}
|
|
5399
|
-
return [node, node.raw.endsWith("d") ? "Double" : "Float"];
|
|
5400
|
-
}
|
|
5401
|
-
if (type === "bigint") {
|
|
5402
|
-
return [node, "Long"];
|
|
5403
|
-
}
|
|
5404
|
-
if (type === "string") {
|
|
5405
|
-
return node.raw.startsWith("'") ? [node, "Char"] : [node, "String"];
|
|
5406
|
-
}
|
|
5407
|
-
if (type === "boolean") {
|
|
5408
|
-
return [node, "Boolean"];
|
|
5409
|
-
}
|
|
5410
|
-
throw new Error(`Literal has unknown type '${type}'`);
|
|
5411
|
-
}
|
|
5412
|
-
function wrap(node, loc) {
|
|
5413
|
-
if (loc) {
|
|
5414
|
-
node.loc = loc;
|
|
5415
|
-
node.start = loc.start.offset;
|
|
5416
|
-
node.end = loc.end.offset;
|
|
5417
|
-
}
|
|
5418
|
-
return node;
|
|
5419
|
-
}
|
|
5420
|
-
function locRange(start, end) {
|
|
5421
|
-
return {
|
|
5422
|
-
source: start.source || end.source,
|
|
5423
|
-
start: start.start,
|
|
5424
|
-
end: end.end
|
|
5425
|
-
};
|
|
5426
|
-
}
|
|
5427
|
-
function adjustLoc(loc, start = 1, end = -1) {
|
|
5428
|
-
return {
|
|
5429
|
-
source: loc.source,
|
|
5430
|
-
start: {
|
|
5431
|
-
offset: loc.start.offset + start,
|
|
5432
|
-
line: loc.start.line,
|
|
5433
|
-
column: loc.start.column + start
|
|
5434
|
-
},
|
|
5435
|
-
end: {
|
|
5436
|
-
offset: loc.end.offset + end,
|
|
5437
|
-
line: loc.end.line,
|
|
5438
|
-
column: loc.end.column + end
|
|
5439
|
-
}
|
|
5440
|
-
};
|
|
5441
|
-
}
|
|
5442
|
-
function makeIdentifier(name, loc) {
|
|
5443
|
-
return wrap({ type: "Identifier", name }, loc);
|
|
5444
|
-
}
|
|
5445
|
-
function makeMemberExpression(object, property) {
|
|
5446
|
-
return wrap(
|
|
5447
|
-
{
|
|
5448
|
-
type: "MemberExpression",
|
|
5449
|
-
object,
|
|
5450
|
-
property,
|
|
5451
|
-
computed: false
|
|
5452
|
-
},
|
|
5453
|
-
object.loc && locRange(object.loc, property.loc)
|
|
5454
|
-
);
|
|
5455
|
-
}
|
|
5456
|
-
function makeScopedName(dotted, l) {
|
|
5457
|
-
const loc = l && adjustLoc(l, 0, l.start.offset - l.end.offset);
|
|
5458
|
-
const result = dotted.split(/\s*\.\s*/).reduce(
|
|
5459
|
-
({ cur, offset }, next) => {
|
|
5460
|
-
const id = makeIdentifier(
|
|
5461
|
-
next,
|
|
5462
|
-
loc && adjustLoc(loc, offset, offset + next.length)
|
|
5463
|
-
);
|
|
5464
|
-
if (!cur) {
|
|
5465
|
-
cur = id;
|
|
5466
|
-
} else {
|
|
5467
|
-
cur = makeMemberExpression(cur, id);
|
|
5468
|
-
}
|
|
5469
|
-
offset += next.length + 1;
|
|
5470
|
-
return { cur, offset };
|
|
5471
|
-
},
|
|
5472
|
-
{ cur: null, offset: 0 }
|
|
5473
|
-
).cur;
|
|
5474
|
-
if (!result)
|
|
5475
|
-
throw new Error("Failed to make a ScopedName");
|
|
5476
|
-
return result;
|
|
5477
|
-
}
|
|
5478
|
-
function getLiteralNode(node) {
|
|
5479
|
-
if (node == null)
|
|
5480
|
-
return null;
|
|
5481
|
-
if (node.type === "Literal")
|
|
5482
|
-
return node;
|
|
5483
|
-
if (node.type === "BinaryExpression" && node.operator === "as") {
|
|
5484
|
-
return getLiteralNode(node.left) && node;
|
|
5485
|
-
}
|
|
5486
|
-
if (node.type === "UnaryExpression") {
|
|
5487
|
-
if (node.argument.type !== "Literal")
|
|
5488
|
-
return null;
|
|
5489
|
-
switch (node.operator) {
|
|
5490
|
-
case "-": {
|
|
5491
|
-
const [arg, type] = getNodeValue(node.argument);
|
|
5492
|
-
if (type === "Number" || type === "Long") {
|
|
5493
|
-
return { ...arg, value: -arg.value, raw: `-${arg.raw}` };
|
|
5494
|
-
}
|
|
5495
|
-
}
|
|
5496
|
-
}
|
|
5497
|
-
}
|
|
5498
|
-
return null;
|
|
5499
|
-
}
|
|
5500
|
-
var mctreeTypeInfo;
|
|
5501
|
-
var init_ast = (0, import_chunk_YZ44IUV6.__esm)({
|
|
5502
|
-
"src/ast.ts"() {
|
|
5503
|
-
"use strict";
|
|
5504
|
-
mctreeTypeInfo = {
|
|
5505
|
-
ArrayExpression: { keys: ["elements"], expr: true },
|
|
5506
|
-
AssignmentExpression: { keys: ["left", "right"], expr: true },
|
|
5507
|
-
AttributeList: { keys: ["attributes"] },
|
|
5508
|
-
Attributes: { keys: ["elements"] },
|
|
5509
|
-
BinaryExpression: { keys: ["left", "right"], expr: true },
|
|
5510
|
-
Block: { keys: [] },
|
|
5511
|
-
BlockStatement: { keys: ["body", "innerComments"], stmt: true },
|
|
5512
|
-
BreakStatement: { keys: [], stmt: true },
|
|
5513
|
-
CallExpression: { keys: ["callee", "arguments"], expr: true },
|
|
5514
|
-
CatchClause: { keys: ["param", "body"] },
|
|
5515
|
-
CatchClauses: { keys: ["catches"] },
|
|
5516
|
-
ClassBody: { keys: ["body"] },
|
|
5517
|
-
ClassDeclaration: { keys: ["attrs", "id", "superClass", "body"], stmt: true },
|
|
5518
|
-
ClassElement: { keys: ["item"] },
|
|
5519
|
-
ConditionalExpression: {
|
|
5520
|
-
keys: ["test", "consequent", "alternate"],
|
|
5521
|
-
expr: true
|
|
5522
|
-
},
|
|
5523
|
-
ContinueStatement: { keys: [], stmt: true },
|
|
5524
|
-
DoWhileStatement: { keys: ["body", "test"], stmt: true },
|
|
5525
|
-
EnumDeclaration: { keys: ["attrs", "id", "body"], stmt: true },
|
|
5526
|
-
EnumStringBody: { keys: ["members"] },
|
|
5527
|
-
EnumStringMember: { keys: ["id", "init"] },
|
|
5528
|
-
ExpressionStatement: { keys: ["expression"], stmt: true },
|
|
5529
|
-
ForStatement: { keys: ["init", "test", "body", "update"], stmt: true },
|
|
5530
|
-
FunctionDeclaration: {
|
|
5531
|
-
keys: ["attrs", "id", "params", "returnType", "body"],
|
|
5532
|
-
stmt: true
|
|
5533
|
-
},
|
|
5534
|
-
Identifier: { keys: [], expr: true },
|
|
5535
|
-
IfStatement: { keys: ["test", "consequent", "alternate"], stmt: true },
|
|
5536
|
-
ImportModule: { keys: ["id"] },
|
|
5537
|
-
InstanceOfCase: { keys: ["id"] },
|
|
5538
|
-
Line: { keys: [] },
|
|
5539
|
-
Literal: { keys: [], expr: true },
|
|
5540
|
-
LogicalExpression: { keys: ["left", "right"], expr: true },
|
|
5541
|
-
MemberExpression: { keys: ["object", "property"], expr: true },
|
|
5542
|
-
MethodDefinition: { keys: ["params", "returnType"] },
|
|
5543
|
-
ModuleDeclaration: { keys: ["attrs", "id", "body"], stmt: true },
|
|
5544
|
-
MultiLine: { keys: [] },
|
|
5545
|
-
NewExpression: { keys: ["callee", "arguments"], expr: true },
|
|
5546
|
-
ObjectExpression: { keys: ["properties"], expr: true },
|
|
5547
|
-
ParenthesizedExpression: { keys: ["expression"], expr: true },
|
|
5548
|
-
Program: { keys: ["body", "comments"] },
|
|
5549
|
-
Property: { keys: ["key", "value"] },
|
|
5550
|
-
ReturnStatement: { keys: ["argument"], stmt: true },
|
|
5551
|
-
SequenceExpression: { keys: ["expressions"], expr: true },
|
|
5552
|
-
SizedArrayExpression: { keys: ["size", "ts"], expr: true },
|
|
5553
|
-
SwitchCase: { keys: ["test", "consequent"] },
|
|
5554
|
-
SwitchStatement: { keys: ["discriminant", "cases"], stmt: true },
|
|
5555
|
-
ThisExpression: { keys: [], expr: true },
|
|
5556
|
-
ThrowStatement: { keys: ["argument"], stmt: true },
|
|
5557
|
-
TryStatement: { keys: ["block", "handler", "finalizer"], stmt: true },
|
|
5558
|
-
TypedefDeclaration: { keys: ["attrs", "id", "ts"], stmt: true },
|
|
5559
|
-
TypeSpecList: { keys: ["ts"] },
|
|
5560
|
-
TypeSpecPart: { keys: ["name", "body", "callspec", "generics"] },
|
|
5561
|
-
UnaryExpression: { keys: ["argument"], expr: true },
|
|
5562
|
-
UpdateExpression: { keys: ["argument"], expr: true },
|
|
5563
|
-
Using: { keys: ["id", "as"] },
|
|
5564
|
-
VariableDeclaration: { keys: ["attrs", "declarations"], stmt: true },
|
|
5565
|
-
VariableDeclarator: { keys: ["id", "init"] },
|
|
5566
|
-
WhileStatement: { keys: ["test", "body"], stmt: true }
|
|
5567
|
-
};
|
|
5568
|
-
}
|
|
5569
|
-
});
|
|
5570
5254
|
var xml_util_exports = {};
|
|
5571
|
-
(0,
|
|
5255
|
+
(0, import_chunk_ABYVSU2C.__export)(xml_util_exports, {
|
|
5572
5256
|
Document: () => Document,
|
|
5573
5257
|
Nodes: () => Nodes,
|
|
5574
5258
|
PeggyError: () => PeggyError,
|
|
@@ -5701,11 +5385,11 @@ function visit_xml(contents, visitor) {
|
|
|
5701
5385
|
});
|
|
5702
5386
|
}
|
|
5703
5387
|
var PeggyError, entities, Document, Nodes;
|
|
5704
|
-
var init_xml_util = (0,
|
|
5388
|
+
var init_xml_util = (0, import_chunk_ABYVSU2C.__esm)({
|
|
5705
5389
|
"src/xml-util.ts"() {
|
|
5706
5390
|
"use strict";
|
|
5707
5391
|
init_xml();
|
|
5708
|
-
init_ast();
|
|
5392
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
5709
5393
|
PeggyError = class extends Error {
|
|
5710
5394
|
constructor(message, location) {
|
|
5711
5395
|
super(message);
|
|
@@ -5753,11 +5437,11 @@ var init_xml_util = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
5753
5437
|
result.push(String.fromCharCode(child.value));
|
|
5754
5438
|
return true;
|
|
5755
5439
|
case "entityref":
|
|
5756
|
-
if (hasProperty(entities, child.name)) {
|
|
5440
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(entities, child.name)) {
|
|
5757
5441
|
result.push(entities[child.name]);
|
|
5758
5442
|
return true;
|
|
5759
5443
|
}
|
|
5760
|
-
if (hasProperty(this.entities, child.name)) {
|
|
5444
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(this.entities, child.name)) {
|
|
5761
5445
|
result.push(
|
|
5762
5446
|
this.processRefs(referenceList(this.entities[child.name].value))
|
|
5763
5447
|
);
|
|
@@ -5782,13 +5466,13 @@ var init_xml_util = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
5782
5466
|
} else if (hexref) {
|
|
5783
5467
|
return String.fromCharCode(parseInt(decref, 16));
|
|
5784
5468
|
} else if (entref) {
|
|
5785
|
-
if (hasProperty(entities, entref)) {
|
|
5469
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(entities, entref)) {
|
|
5786
5470
|
return entities[entref];
|
|
5787
5471
|
}
|
|
5788
|
-
if (hasProperty(this.entities, entref)) {
|
|
5472
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(this.entities, entref)) {
|
|
5789
5473
|
return referenceList(this.entities[entref].value);
|
|
5790
5474
|
}
|
|
5791
|
-
} else if (hasProperty(this.pentities, peref)) {
|
|
5475
|
+
} else if ((0, import_chunk_MBTLUWXR.hasProperty)(this.pentities, peref)) {
|
|
5792
5476
|
return referenceList(this.pentities[peref].value);
|
|
5793
5477
|
}
|
|
5794
5478
|
return "";
|
|
@@ -5871,7 +5555,7 @@ var init_xml_util = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
5871
5555
|
};
|
|
5872
5556
|
}
|
|
5873
5557
|
});
|
|
5874
|
-
var require_pend = (0,
|
|
5558
|
+
var require_pend = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
5875
5559
|
"node_modules/pend/index.js"(exports, module2) {
|
|
5876
5560
|
module2.exports = Pend;
|
|
5877
5561
|
function Pend() {
|
|
@@ -5925,16 +5609,16 @@ var require_pend = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
5925
5609
|
}
|
|
5926
5610
|
}
|
|
5927
5611
|
});
|
|
5928
|
-
var require_fd_slicer = (0,
|
|
5612
|
+
var require_fd_slicer = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
5929
5613
|
"node_modules/fd-slicer/index.js"(exports) {
|
|
5930
|
-
var fs9 = (0,
|
|
5931
|
-
var util = (0,
|
|
5932
|
-
var stream = (0,
|
|
5614
|
+
var fs9 = (0, import_chunk_ABYVSU2C.__require)("fs");
|
|
5615
|
+
var util = (0, import_chunk_ABYVSU2C.__require)("util");
|
|
5616
|
+
var stream = (0, import_chunk_ABYVSU2C.__require)("stream");
|
|
5933
5617
|
var Readable = stream.Readable;
|
|
5934
5618
|
var Writable = stream.Writable;
|
|
5935
5619
|
var PassThrough = stream.PassThrough;
|
|
5936
5620
|
var Pend = require_pend();
|
|
5937
|
-
var EventEmitter2 = (0,
|
|
5621
|
+
var EventEmitter2 = (0, import_chunk_ABYVSU2C.__require)("events").EventEmitter;
|
|
5938
5622
|
exports.createFromBuffer = createFromBuffer;
|
|
5939
5623
|
exports.createFromFd = createFromFd;
|
|
5940
5624
|
exports.BufferSlicer = BufferSlicer;
|
|
@@ -6191,9 +5875,9 @@ var require_fd_slicer = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
6191
5875
|
}
|
|
6192
5876
|
}
|
|
6193
5877
|
});
|
|
6194
|
-
var require_buffer_crc32 = (0,
|
|
5878
|
+
var require_buffer_crc32 = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
6195
5879
|
"node_modules/buffer-crc32/index.js"(exports, module2) {
|
|
6196
|
-
var Buffer2 = (0,
|
|
5880
|
+
var Buffer2 = (0, import_chunk_ABYVSU2C.__require)("buffer").Buffer;
|
|
6197
5881
|
var CRC_TABLE = [
|
|
6198
5882
|
0,
|
|
6199
5883
|
1996959894,
|
|
@@ -6496,17 +6180,17 @@ var require_buffer_crc32 = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
6496
6180
|
module2.exports = crc32;
|
|
6497
6181
|
}
|
|
6498
6182
|
});
|
|
6499
|
-
var require_yauzl = (0,
|
|
6183
|
+
var require_yauzl = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
6500
6184
|
"node_modules/yauzl/index.js"(exports) {
|
|
6501
|
-
var fs9 = (0,
|
|
6502
|
-
var zlib = (0,
|
|
6185
|
+
var fs9 = (0, import_chunk_ABYVSU2C.__require)("fs");
|
|
6186
|
+
var zlib = (0, import_chunk_ABYVSU2C.__require)("zlib");
|
|
6503
6187
|
var fd_slicer = require_fd_slicer();
|
|
6504
6188
|
var crc32 = require_buffer_crc32();
|
|
6505
|
-
var util = (0,
|
|
6506
|
-
var EventEmitter2 = (0,
|
|
6507
|
-
var Transform = (0,
|
|
6508
|
-
var PassThrough = (0,
|
|
6509
|
-
var Writable = (0,
|
|
6189
|
+
var util = (0, import_chunk_ABYVSU2C.__require)("util");
|
|
6190
|
+
var EventEmitter2 = (0, import_chunk_ABYVSU2C.__require)("events").EventEmitter;
|
|
6191
|
+
var Transform = (0, import_chunk_ABYVSU2C.__require)("stream").Transform;
|
|
6192
|
+
var PassThrough = (0, import_chunk_ABYVSU2C.__require)("stream").PassThrough;
|
|
6193
|
+
var Writable = (0, import_chunk_ABYVSU2C.__require)("stream").Writable;
|
|
6510
6194
|
exports.open = open2;
|
|
6511
6195
|
exports.fromFd = fromFd;
|
|
6512
6196
|
exports.fromBuffer = fromBuffer;
|
|
@@ -7195,14 +6879,14 @@ var require_yauzl = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
7195
6879
|
}
|
|
7196
6880
|
}
|
|
7197
6881
|
});
|
|
7198
|
-
var require_yazl = (0,
|
|
6882
|
+
var require_yazl = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
7199
6883
|
"node_modules/yazl/index.js"(exports) {
|
|
7200
|
-
var fs9 = (0,
|
|
7201
|
-
var Transform = (0,
|
|
7202
|
-
var PassThrough = (0,
|
|
7203
|
-
var zlib = (0,
|
|
7204
|
-
var util = (0,
|
|
7205
|
-
var EventEmitter2 = (0,
|
|
6884
|
+
var fs9 = (0, import_chunk_ABYVSU2C.__require)("fs");
|
|
6885
|
+
var Transform = (0, import_chunk_ABYVSU2C.__require)("stream").Transform;
|
|
6886
|
+
var PassThrough = (0, import_chunk_ABYVSU2C.__require)("stream").PassThrough;
|
|
6887
|
+
var zlib = (0, import_chunk_ABYVSU2C.__require)("zlib");
|
|
6888
|
+
var util = (0, import_chunk_ABYVSU2C.__require)("util");
|
|
6889
|
+
var EventEmitter2 = (0, import_chunk_ABYVSU2C.__require)("events").EventEmitter;
|
|
7206
6890
|
var crc32 = require_buffer_crc32();
|
|
7207
6891
|
exports.ZipFile = ZipFile2;
|
|
7208
6892
|
exports.dateToDosDateTime = dateToDosDateTime;
|
|
@@ -7904,7 +7588,7 @@ function fixupClassDef(view, current, offsetMap) {
|
|
|
7904
7588
|
}
|
|
7905
7589
|
return current;
|
|
7906
7590
|
}
|
|
7907
|
-
var init_data = (0,
|
|
7591
|
+
var init_data = (0, import_chunk_ABYVSU2C.__esm)({
|
|
7908
7592
|
"src/readprg/data.ts"() {
|
|
7909
7593
|
"use strict";
|
|
7910
7594
|
init_bytecode();
|
|
@@ -8017,7 +7701,7 @@ function findCallees(lookupDefs) {
|
|
|
8017
7701
|
}
|
|
8018
7702
|
function findCalleesForNew(lookupDefs) {
|
|
8019
7703
|
const initializer = (decl) => {
|
|
8020
|
-
if (hasProperty(decl.decls, "initialize")) {
|
|
7704
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(decl.decls, "initialize")) {
|
|
8021
7705
|
return decl.decls["initialize"];
|
|
8022
7706
|
}
|
|
8023
7707
|
if (decl.superClass && decl.superClass !== true) {
|
|
@@ -8045,12 +7729,12 @@ function findCalleesByNode(state, callee) {
|
|
|
8045
7729
|
const name = callee.type === "Identifier" ? callee.name : callee.type === "MemberExpression" && !callee.computed ? callee.property.name : null;
|
|
8046
7730
|
if (!name)
|
|
8047
7731
|
return null;
|
|
8048
|
-
return hasProperty(state.allFunctions, name) && state.allFunctions[name] || null;
|
|
7732
|
+
return (0, import_chunk_MBTLUWXR.hasProperty)(state.allFunctions, name) && state.allFunctions[name] || null;
|
|
8049
7733
|
}
|
|
8050
|
-
var init_function_info = (0,
|
|
7734
|
+
var init_function_info = (0, import_chunk_ABYVSU2C.__esm)({
|
|
8051
7735
|
"src/function-info.ts"() {
|
|
8052
7736
|
"use strict";
|
|
8053
|
-
init_ast();
|
|
7737
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
8054
7738
|
}
|
|
8055
7739
|
});
|
|
8056
7740
|
function renameIdentifier(ident, newName) {
|
|
@@ -8062,7 +7746,7 @@ function renameIdentifier(ident, newName) {
|
|
|
8062
7746
|
function renameVariable(state, locals, declName2) {
|
|
8063
7747
|
const map2 = locals.map;
|
|
8064
7748
|
if (declName2) {
|
|
8065
|
-
if (!hasProperty(map2, declName2))
|
|
7749
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(map2, declName2))
|
|
8066
7750
|
return null;
|
|
8067
7751
|
} else {
|
|
8068
7752
|
declName2 = "tmp";
|
|
@@ -8077,7 +7761,7 @@ function renameVariable(state, locals, declName2) {
|
|
|
8077
7761
|
if (!locals.inners) {
|
|
8078
7762
|
locals.inners = {};
|
|
8079
7763
|
const inners = locals.inners;
|
|
8080
|
-
traverseAst(locals.node, (node) => {
|
|
7764
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(locals.node, (node) => {
|
|
8081
7765
|
if (node.type === "VariableDeclarator") {
|
|
8082
7766
|
inners[variableDeclarationName(node.id)] = true;
|
|
8083
7767
|
}
|
|
@@ -8086,13 +7770,13 @@ function renameVariable(state, locals, declName2) {
|
|
|
8086
7770
|
let name;
|
|
8087
7771
|
while (true) {
|
|
8088
7772
|
name = `pmcr_${node_name}_${suffix}`;
|
|
8089
|
-
if (!hasProperty(map2, name) && !hasProperty(locals.inners, name)) {
|
|
7773
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(map2, name) && !(0, import_chunk_MBTLUWXR.hasProperty)(locals.inners, name)) {
|
|
8090
7774
|
let ok = false;
|
|
8091
7775
|
let i;
|
|
8092
7776
|
for (i = state.stack.length; i--; ) {
|
|
8093
7777
|
const elm = state.stack[i].sn;
|
|
8094
7778
|
if (ok) {
|
|
8095
|
-
if (hasProperty(elm.decls, name)) {
|
|
7779
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(elm.decls, name)) {
|
|
8096
7780
|
break;
|
|
8097
7781
|
}
|
|
8098
7782
|
} else if (elm.node && elm.node.type === "FunctionDeclaration") {
|
|
@@ -8109,11 +7793,11 @@ function renameVariable(state, locals, declName2) {
|
|
|
8109
7793
|
map2[name] = true;
|
|
8110
7794
|
return name;
|
|
8111
7795
|
}
|
|
8112
|
-
var init_variable_renamer = (0,
|
|
7796
|
+
var init_variable_renamer = (0, import_chunk_ABYVSU2C.__esm)({
|
|
8113
7797
|
"src/variable-renamer.ts"() {
|
|
8114
7798
|
"use strict";
|
|
8115
7799
|
init_api();
|
|
8116
|
-
init_ast();
|
|
7800
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
8117
7801
|
}
|
|
8118
7802
|
});
|
|
8119
7803
|
function inlinableSubExpression(expr) {
|
|
@@ -8249,7 +7933,7 @@ function getArgSafety(state, func, args, requireAll) {
|
|
|
8249
7933
|
case "AssignmentExpression":
|
|
8250
7934
|
case "UpdateExpression": {
|
|
8251
7935
|
const v = node.type === "UpdateExpression" ? node.argument : node.left;
|
|
8252
|
-
if (v.type === "Identifier" && hasProperty(params, v.name)) {
|
|
7936
|
+
if (v.type === "Identifier" && (0, import_chunk_MBTLUWXR.hasProperty)(params, v.name)) {
|
|
8253
7937
|
safeArgs[params[v.name]] = null;
|
|
8254
7938
|
break;
|
|
8255
7939
|
}
|
|
@@ -8295,7 +7979,7 @@ function getArgSafety(state, func, args, requireAll) {
|
|
|
8295
7979
|
}
|
|
8296
7980
|
break;
|
|
8297
7981
|
case "Identifier":
|
|
8298
|
-
if (hasProperty(params, node.name) && !safeArgs[params[node.name]] && (modifiedUnknown || !argDecls[params[node.name]] || modifiedDecls.has(argDecls[params[node.name]]) || Array.from(callsSeen).some(
|
|
7982
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(params, node.name) && !safeArgs[params[node.name]] && (modifiedUnknown || !argDecls[params[node.name]] || modifiedDecls.has(argDecls[params[node.name]]) || Array.from(callsSeen).some(
|
|
8299
7983
|
(callee) => functionMayModify(state, callee, argDecls[params[node.name]])
|
|
8300
7984
|
))) {
|
|
8301
7985
|
safeArgs[params[node.name]] = null;
|
|
@@ -8342,7 +8026,7 @@ function inliningLooksUseful(func, node) {
|
|
|
8342
8026
|
function inlineRequested(state, func) {
|
|
8343
8027
|
const excludeAnnotations = func.node.loc?.source && state.fnMap[func.node.loc?.source]?.excludeAnnotations || {};
|
|
8344
8028
|
if (func.node.attrs && func.node.attrs.attributes && func.node.attrs.attributes.elements.some(
|
|
8345
|
-
(attr) => attr.type === "UnaryExpression" && (attr.argument.name === "inline" || attr.argument.name.startsWith("inline_") && !hasProperty(excludeAnnotations, attr.argument.name.substring(7)))
|
|
8029
|
+
(attr) => attr.type === "UnaryExpression" && (attr.argument.name === "inline" || attr.argument.name.startsWith("inline_") && !(0, import_chunk_MBTLUWXR.hasProperty)(excludeAnnotations, attr.argument.name.substring(7)))
|
|
8346
8030
|
)) {
|
|
8347
8031
|
return true;
|
|
8348
8032
|
}
|
|
@@ -8439,7 +8123,7 @@ function processInlineBody(state, func, call, root, params) {
|
|
|
8439
8123
|
const fixId = (node) => {
|
|
8440
8124
|
if (state.inType)
|
|
8441
8125
|
return null;
|
|
8442
|
-
if (hasProperty(params, node.name)) {
|
|
8126
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(params, node.name)) {
|
|
8443
8127
|
const ix = params[node.name];
|
|
8444
8128
|
if (ix >= 0) {
|
|
8445
8129
|
const replacement2 = { ...call.arguments[ix] };
|
|
@@ -8509,7 +8193,7 @@ function processInlineBody(state, func, call, root, params) {
|
|
|
8509
8193
|
}
|
|
8510
8194
|
}
|
|
8511
8195
|
function unused(state, expression, top) {
|
|
8512
|
-
const estmt = (expression2) => withLoc(
|
|
8196
|
+
const estmt = (expression2) => (0, import_chunk_MBTLUWXR.withLoc)(
|
|
8513
8197
|
{
|
|
8514
8198
|
type: "ExpressionStatement",
|
|
8515
8199
|
expression: expression2
|
|
@@ -8534,7 +8218,7 @@ function unused(state, expression, top) {
|
|
|
8534
8218
|
const right = unused(state, expression.right);
|
|
8535
8219
|
if (!right.length)
|
|
8536
8220
|
return unused(state, expression.left);
|
|
8537
|
-
const consequent = withLoc(
|
|
8221
|
+
const consequent = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
8538
8222
|
{
|
|
8539
8223
|
type: "BlockStatement",
|
|
8540
8224
|
body: [estmt(expression.right)]
|
|
@@ -8547,7 +8231,7 @@ function unused(state, expression, top) {
|
|
|
8547
8231
|
consequent.body = [];
|
|
8548
8232
|
}
|
|
8549
8233
|
return [
|
|
8550
|
-
withLoc(
|
|
8234
|
+
(0, import_chunk_MBTLUWXR.withLoc)(
|
|
8551
8235
|
{
|
|
8552
8236
|
type: "IfStatement",
|
|
8553
8237
|
test: expression.left,
|
|
@@ -8565,18 +8249,18 @@ function unused(state, expression, top) {
|
|
|
8565
8249
|
return unused(state, expression.test);
|
|
8566
8250
|
}
|
|
8567
8251
|
return [
|
|
8568
|
-
withLoc(
|
|
8252
|
+
(0, import_chunk_MBTLUWXR.withLoc)(
|
|
8569
8253
|
{
|
|
8570
8254
|
type: "IfStatement",
|
|
8571
8255
|
test: expression.test,
|
|
8572
|
-
consequent: withLoc(
|
|
8256
|
+
consequent: (0, import_chunk_MBTLUWXR.withLoc)(
|
|
8573
8257
|
{
|
|
8574
8258
|
type: "BlockStatement",
|
|
8575
8259
|
body: consequentExprs
|
|
8576
8260
|
},
|
|
8577
8261
|
expression.consequent
|
|
8578
8262
|
),
|
|
8579
|
-
alternate: withLoc(
|
|
8263
|
+
alternate: (0, import_chunk_MBTLUWXR.withLoc)(
|
|
8580
8264
|
{
|
|
8581
8265
|
type: "BlockStatement",
|
|
8582
8266
|
body: alternateExprs
|
|
@@ -8645,7 +8329,7 @@ function inlineWithArgs(state, func, call, context) {
|
|
|
8645
8329
|
return null;
|
|
8646
8330
|
}
|
|
8647
8331
|
} else {
|
|
8648
|
-
traverseAst(func.node.body, (node) => {
|
|
8332
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(func.node.body, (node) => {
|
|
8649
8333
|
node.type === "ReturnStatement" && retStmtCount++;
|
|
8650
8334
|
});
|
|
8651
8335
|
if (retStmtCount > 1) {
|
|
@@ -8679,7 +8363,7 @@ function inlineWithArgs(state, func, call, context) {
|
|
|
8679
8363
|
}
|
|
8680
8364
|
}
|
|
8681
8365
|
}
|
|
8682
|
-
const body = cloneDeep(func.node.body);
|
|
8366
|
+
const body = (0, import_chunk_MBTLUWXR.cloneDeep)(func.node.body);
|
|
8683
8367
|
const safeArgs = getArgSafety(state, func, call.arguments, false);
|
|
8684
8368
|
const params = Object.fromEntries(
|
|
8685
8369
|
func.node.params.map((param, i) => {
|
|
@@ -8767,7 +8451,7 @@ function updateLocationForInline(node, original, context, func) {
|
|
|
8767
8451
|
if (!loc) {
|
|
8768
8452
|
throw new Error("Internal error: Inlined call had no location info");
|
|
8769
8453
|
}
|
|
8770
|
-
traverseAst(node, (node2) => {
|
|
8454
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(node, (node2) => {
|
|
8771
8455
|
if (!node2.loc || node2.loc.source !== loc.source || node2.loc.start.offset > loc.end.offset || node2.loc.end.offset <= loc.start.offset) {
|
|
8772
8456
|
if (node2.loc) {
|
|
8773
8457
|
if (!node2.origins) {
|
|
@@ -8775,7 +8459,7 @@ function updateLocationForInline(node, original, context, func) {
|
|
|
8775
8459
|
}
|
|
8776
8460
|
node2.origins.unshift({ loc: node2.loc, func: func.fullName });
|
|
8777
8461
|
}
|
|
8778
|
-
withLoc(node2, context, context === original ? context : false);
|
|
8462
|
+
(0, import_chunk_MBTLUWXR.withLoc)(node2, context, context === original ? context : false);
|
|
8779
8463
|
}
|
|
8780
8464
|
});
|
|
8781
8465
|
return node;
|
|
@@ -8787,7 +8471,7 @@ function inlineFunctionHelper(state, func, call, context) {
|
|
|
8787
8471
|
if (context) {
|
|
8788
8472
|
return inlineWithArgs(state, func, call, context);
|
|
8789
8473
|
}
|
|
8790
|
-
const retArg = cloneDeep(
|
|
8474
|
+
const retArg = (0, import_chunk_MBTLUWXR.cloneDeep)(
|
|
8791
8475
|
func.node.body.body[0].argument
|
|
8792
8476
|
);
|
|
8793
8477
|
const params = Object.fromEntries(
|
|
@@ -8824,7 +8508,7 @@ function inlineFunction(state, func, call, context) {
|
|
|
8824
8508
|
return ret;
|
|
8825
8509
|
}
|
|
8826
8510
|
if (!caller.attrs) {
|
|
8827
|
-
caller.attrs = withLoc(
|
|
8511
|
+
caller.attrs = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
8828
8512
|
{
|
|
8829
8513
|
type: "AttributeList"
|
|
8830
8514
|
},
|
|
@@ -8833,7 +8517,7 @@ function inlineFunction(state, func, call, context) {
|
|
|
8833
8517
|
);
|
|
8834
8518
|
}
|
|
8835
8519
|
if (!caller.attrs.attributes) {
|
|
8836
|
-
caller.attrs.attributes = withLoc(
|
|
8520
|
+
caller.attrs.attributes = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
8837
8521
|
{ type: "Attributes", elements: [] },
|
|
8838
8522
|
caller.attrs,
|
|
8839
8523
|
false
|
|
@@ -8841,7 +8525,7 @@ function inlineFunction(state, func, call, context) {
|
|
|
8841
8525
|
}
|
|
8842
8526
|
caller.attrs.attributes.elements.unshift(
|
|
8843
8527
|
...typecheckAttrs.map(
|
|
8844
|
-
(typecheck) => withLocDeep({ ...typecheck }, caller.attrs, false)
|
|
8528
|
+
(typecheck) => (0, import_chunk_MBTLUWXR.withLocDeep)({ ...typecheck }, caller.attrs, false)
|
|
8845
8529
|
)
|
|
8846
8530
|
);
|
|
8847
8531
|
return ret;
|
|
@@ -8863,7 +8547,7 @@ function fixNodeScope(state, lookupNode, nodeStack) {
|
|
|
8863
8547
|
const { map: map2 } = locals;
|
|
8864
8548
|
if (!map2)
|
|
8865
8549
|
throw new Error("No local variable map!");
|
|
8866
|
-
if (hasProperty(map2, lookupNode.name) && map2[lookupNode.name] !== false) {
|
|
8550
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(map2, lookupNode.name) && map2[lookupNode.name] !== false) {
|
|
8867
8551
|
return lookupNode;
|
|
8868
8552
|
}
|
|
8869
8553
|
}
|
|
@@ -8942,17 +8626,17 @@ function fixNodeScope(state, lookupNode, nodeStack) {
|
|
|
8942
8626
|
}
|
|
8943
8627
|
return null;
|
|
8944
8628
|
}
|
|
8945
|
-
var init_inliner = (0,
|
|
8629
|
+
var init_inliner = (0, import_chunk_ABYVSU2C.__esm)({
|
|
8946
8630
|
"src/inliner.ts"() {
|
|
8947
8631
|
"use strict";
|
|
8948
8632
|
init_api();
|
|
8949
|
-
init_ast();
|
|
8633
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
8950
8634
|
init_function_info();
|
|
8951
8635
|
init_variable_renamer();
|
|
8952
8636
|
}
|
|
8953
8637
|
});
|
|
8954
8638
|
var StateNodeAttributes;
|
|
8955
|
-
var init_optimizer_types = (0,
|
|
8639
|
+
var init_optimizer_types = (0, import_chunk_ABYVSU2C.__esm)({
|
|
8956
8640
|
"src/optimizer-types.ts"() {
|
|
8957
8641
|
"use strict";
|
|
8958
8642
|
StateNodeAttributes = /* @__PURE__ */ ((StateNodeAttributes2) => {
|
|
@@ -9028,7 +8712,7 @@ function pragmaChecker(state, ast, diagnostics) {
|
|
|
9028
8712
|
return re.test(haystack);
|
|
9029
8713
|
};
|
|
9030
8714
|
next();
|
|
9031
|
-
traverseAst(ast, (node) => {
|
|
8715
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(ast, (node) => {
|
|
9032
8716
|
if (index >= comments.length || node.type === "Line" || node.type === "Block" || node.type === "MultiLine") {
|
|
9033
8717
|
return false;
|
|
9034
8718
|
}
|
|
@@ -9099,11 +8783,11 @@ function pragmaChecker(state, ast, diagnostics) {
|
|
|
9099
8783
|
return null;
|
|
9100
8784
|
});
|
|
9101
8785
|
}
|
|
9102
|
-
var init_pragma_checker = (0,
|
|
8786
|
+
var init_pragma_checker = (0, import_chunk_ABYVSU2C.__esm)({
|
|
9103
8787
|
"src/pragma-checker.ts"() {
|
|
9104
8788
|
"use strict";
|
|
9105
8789
|
init_api();
|
|
9106
|
-
init_ast();
|
|
8790
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
9107
8791
|
}
|
|
9108
8792
|
});
|
|
9109
8793
|
function buildReducedGraph(state, func, refsForUpdate, notice) {
|
|
@@ -9122,14 +8806,14 @@ function buildReducedGraph(state, func, refsForUpdate, notice) {
|
|
|
9122
8806
|
if (state.inType || localState.unreachable) {
|
|
9123
8807
|
return [];
|
|
9124
8808
|
}
|
|
9125
|
-
if (!localState.curBlock.node && (isStatement(node) || isExpression(node))) {
|
|
8809
|
+
if (!localState.curBlock.node && ((0, import_chunk_MBTLUWXR.isStatement)(node) || (0, import_chunk_MBTLUWXR.isExpression)(node))) {
|
|
9126
8810
|
localState.curBlock.node = node;
|
|
9127
8811
|
}
|
|
9128
8812
|
let topTest = testStack[testStack.length - 1];
|
|
9129
8813
|
if (topTest.node !== node && topTest.true) {
|
|
9130
8814
|
testStack.push(topTest = { node });
|
|
9131
8815
|
}
|
|
9132
|
-
if (isStatement(node)) {
|
|
8816
|
+
if ((0, import_chunk_MBTLUWXR.isStatement)(node)) {
|
|
9133
8817
|
stmtStack.push(node);
|
|
9134
8818
|
}
|
|
9135
8819
|
switch (node.type) {
|
|
@@ -9451,7 +9135,7 @@ function buildReducedGraph(state, func, refsForUpdate, notice) {
|
|
|
9451
9135
|
const curStmt = stmtStack[stmtStack.length - 1];
|
|
9452
9136
|
const topTest = testStack[testStack.length - 1];
|
|
9453
9137
|
if (!state.inType) {
|
|
9454
|
-
const throws = tryActive > 0 && mayThrow(node);
|
|
9138
|
+
const throws = tryActive > 0 && (0, import_chunk_MBTLUWXR.mayThrow)(node);
|
|
9455
9139
|
const events = notice(node, curStmt, throws, getContainedEvents);
|
|
9456
9140
|
if (throws) {
|
|
9457
9141
|
if (!events) {
|
|
@@ -9460,9 +9144,9 @@ function buildReducedGraph(state, func, refsForUpdate, notice) {
|
|
|
9460
9144
|
);
|
|
9461
9145
|
}
|
|
9462
9146
|
} else {
|
|
9463
|
-
(0,
|
|
9147
|
+
(0, import_chunk_PVBIKZYZ.forEach)(events, (e) => e.mayThrow = false);
|
|
9464
9148
|
}
|
|
9465
|
-
(0,
|
|
9149
|
+
(0, import_chunk_PVBIKZYZ.forEach)(events, (event) => {
|
|
9466
9150
|
if (event.mayThrow) {
|
|
9467
9151
|
for (let i = localState.stack.length; i--; ) {
|
|
9468
9152
|
const target = localState.stack[i].throw;
|
|
@@ -9512,7 +9196,7 @@ function buildReducedGraph(state, func, refsForUpdate, notice) {
|
|
|
9512
9196
|
}
|
|
9513
9197
|
if (curStmt === node) {
|
|
9514
9198
|
stmtStack.pop();
|
|
9515
|
-
} else if (localState.unreachable && curStmt.type === "BlockStatement" && isStatement(node)) {
|
|
9199
|
+
} else if (localState.unreachable && curStmt.type === "BlockStatement" && (0, import_chunk_MBTLUWXR.isStatement)(node)) {
|
|
9516
9200
|
return false;
|
|
9517
9201
|
}
|
|
9518
9202
|
return null;
|
|
@@ -9603,11 +9287,11 @@ function getPostOrder(head) {
|
|
|
9603
9287
|
return blocks;
|
|
9604
9288
|
}
|
|
9605
9289
|
var Terminals, LocalState;
|
|
9606
|
-
var init_control_flow = (0,
|
|
9290
|
+
var init_control_flow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
9607
9291
|
"src/control-flow.ts"() {
|
|
9608
9292
|
"use strict";
|
|
9609
|
-
init_ast();
|
|
9610
|
-
(0,
|
|
9293
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
9294
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
9611
9295
|
Terminals = {
|
|
9612
9296
|
BreakStatement: "break",
|
|
9613
9297
|
ContinueStatement: "continue",
|
|
@@ -9637,12 +9321,12 @@ var init_control_flow = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
9637
9321
|
if (!from.succs) {
|
|
9638
9322
|
from.succs = [to];
|
|
9639
9323
|
} else {
|
|
9640
|
-
(0,
|
|
9324
|
+
(0, import_chunk_PVBIKZYZ.pushUnique)(from.succs, to);
|
|
9641
9325
|
}
|
|
9642
9326
|
if (!to.preds) {
|
|
9643
9327
|
to.preds = [from];
|
|
9644
9328
|
} else {
|
|
9645
|
-
(0,
|
|
9329
|
+
(0, import_chunk_PVBIKZYZ.pushUnique)(to.preds, from);
|
|
9646
9330
|
}
|
|
9647
9331
|
}
|
|
9648
9332
|
newBlock(block) {
|
|
@@ -9893,7 +9577,7 @@ function mergeObjectValues(to, from) {
|
|
|
9893
9577
|
let empty = true;
|
|
9894
9578
|
let result = to;
|
|
9895
9579
|
Object.entries(to).forEach(([key, value2]) => {
|
|
9896
|
-
if (!hasProperty(from, key)) {
|
|
9580
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(from, key)) {
|
|
9897
9581
|
if (result === to)
|
|
9898
9582
|
result = { ...result };
|
|
9899
9583
|
delete result[key];
|
|
@@ -9915,8 +9599,8 @@ function mergeObjectValues(to, from) {
|
|
|
9915
9599
|
function mergeStateDecls(to, from) {
|
|
9916
9600
|
let changed = false;
|
|
9917
9601
|
let result = to;
|
|
9918
|
-
(0,
|
|
9919
|
-
if ((0,
|
|
9602
|
+
(0, import_chunk_PVBIKZYZ.forEach)(from, (v) => {
|
|
9603
|
+
if ((0, import_chunk_PVBIKZYZ.some)(to, (t) => t === v)) {
|
|
9920
9604
|
return;
|
|
9921
9605
|
}
|
|
9922
9606
|
if (Array.isArray(result)) {
|
|
@@ -10042,12 +9726,12 @@ function widenTypeHelper(t, depth) {
|
|
|
10042
9726
|
function widenType(t) {
|
|
10043
9727
|
return widenTypeHelper(t, 0);
|
|
10044
9728
|
}
|
|
10045
|
-
var init_union_type = (0,
|
|
9729
|
+
var init_union_type = (0, import_chunk_ABYVSU2C.__esm)({
|
|
10046
9730
|
"src/type-flow/union-type.ts"() {
|
|
10047
9731
|
"use strict";
|
|
10048
|
-
init_ast();
|
|
9732
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
10049
9733
|
init_data_flow();
|
|
10050
|
-
(0,
|
|
9734
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
10051
9735
|
init_intersection_type();
|
|
10052
9736
|
init_sub_type();
|
|
10053
9737
|
init_types();
|
|
@@ -10061,7 +9745,7 @@ function expandTypedef(t) {
|
|
|
10061
9745
|
);
|
|
10062
9746
|
const tExpanded = cloneType(t);
|
|
10063
9747
|
clearValuesUnder(tExpanded, 262144, true);
|
|
10064
|
-
(0,
|
|
9748
|
+
(0, import_chunk_PVBIKZYZ.forEach)(decls, (decl) => unionInto(tExpanded, decl.resolvedType));
|
|
10065
9749
|
return tExpanded;
|
|
10066
9750
|
}
|
|
10067
9751
|
function intersectEnum(t, e) {
|
|
@@ -10213,9 +9897,9 @@ function intersectionValue(pair) {
|
|
|
10213
9897
|
case 4096:
|
|
10214
9898
|
case 8192: {
|
|
10215
9899
|
const common = [];
|
|
10216
|
-
(0,
|
|
9900
|
+
(0, import_chunk_PVBIKZYZ.forEach)(
|
|
10217
9901
|
pair.avalue,
|
|
10218
|
-
(sna) => (0,
|
|
9902
|
+
(sna) => (0, import_chunk_PVBIKZYZ.some)(pair.bvalue, (snb) => sna === snb) && common.push(sna)
|
|
10219
9903
|
);
|
|
10220
9904
|
if (!common.length)
|
|
10221
9905
|
return null;
|
|
@@ -10223,9 +9907,9 @@ function intersectionValue(pair) {
|
|
|
10223
9907
|
}
|
|
10224
9908
|
case 16384: {
|
|
10225
9909
|
const common = [];
|
|
10226
|
-
(0,
|
|
9910
|
+
(0, import_chunk_PVBIKZYZ.forEach)(pair.avalue, (sna) => {
|
|
10227
9911
|
const superA = getSuperClasses(sna);
|
|
10228
|
-
(0,
|
|
9912
|
+
(0, import_chunk_PVBIKZYZ.forEach)(pair.bvalue, (snb) => {
|
|
10229
9913
|
if (sna === snb || superA && superA.has(snb)) {
|
|
10230
9914
|
common.push(sna);
|
|
10231
9915
|
}
|
|
@@ -10270,7 +9954,7 @@ function intersectObj(to, from) {
|
|
|
10270
9954
|
return to;
|
|
10271
9955
|
let result = to;
|
|
10272
9956
|
Object.entries(from).forEach(([key, value2]) => {
|
|
10273
|
-
if (!hasProperty(to, key)) {
|
|
9957
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(to, key)) {
|
|
10274
9958
|
if (result === to)
|
|
10275
9959
|
result = { ...result };
|
|
10276
9960
|
result[key] = value2;
|
|
@@ -10324,13 +10008,18 @@ function restrictExactTypesByEquality(a, b) {
|
|
|
10324
10008
|
}
|
|
10325
10009
|
case 8: {
|
|
10326
10010
|
let extra_bits = 0;
|
|
10327
|
-
if (
|
|
10011
|
+
if (a.value == null || a.value === 0) {
|
|
10328
10012
|
extra_bits |= 2;
|
|
10329
10013
|
}
|
|
10330
|
-
if (
|
|
10014
|
+
if (a.value == null || a.value === 1) {
|
|
10331
10015
|
extra_bits |= 4;
|
|
10332
10016
|
}
|
|
10333
10017
|
let value_bits = b.type & (120 | 128);
|
|
10018
|
+
if (b.type & 32768 && !getObjectValue(b)) {
|
|
10019
|
+
value_bits |= 120 | 128;
|
|
10020
|
+
} else {
|
|
10021
|
+
extra_bits &= b.type;
|
|
10022
|
+
}
|
|
10334
10023
|
if (a.value != null && value_bits & 32 && roundToFloat(Number(a.value)) !== a.value) {
|
|
10335
10024
|
value_bits -= 32;
|
|
10336
10025
|
}
|
|
@@ -10351,11 +10040,17 @@ function restrictExactTypesByEquality(a, b) {
|
|
|
10351
10040
|
return fixupEnum(a, v, b);
|
|
10352
10041
|
}
|
|
10353
10042
|
case 16: {
|
|
10354
|
-
let value_bits = b.type & 120;
|
|
10043
|
+
let value_bits = b.type & (120 | 128);
|
|
10044
|
+
if (b.type & 32768 && !getObjectValue(b)) {
|
|
10045
|
+
value_bits |= 120 | 128;
|
|
10046
|
+
}
|
|
10355
10047
|
if (a.value != null) {
|
|
10356
10048
|
if (value_bits & 8 && BigInt.asIntN(32, a.value) !== a.value) {
|
|
10357
10049
|
value_bits -= 8;
|
|
10358
10050
|
}
|
|
10051
|
+
if (value_bits & 128 && BigInt.asIntN(32, a.value) !== a.value) {
|
|
10052
|
+
value_bits -= 128;
|
|
10053
|
+
}
|
|
10359
10054
|
if (value_bits & 32 && BigInt(roundToFloat(Number(a.value))) !== a.value) {
|
|
10360
10055
|
value_bits -= 32;
|
|
10361
10056
|
}
|
|
@@ -10381,23 +10076,25 @@ function restrictExactTypesByEquality(a, b) {
|
|
|
10381
10076
|
}
|
|
10382
10077
|
case 64:
|
|
10383
10078
|
case 32: {
|
|
10384
|
-
let value_bits = 120;
|
|
10079
|
+
let value_bits = b.type & (120 | 128);
|
|
10080
|
+
if (b.type & 32768 && !getObjectValue(b)) {
|
|
10081
|
+
value_bits |= 120 | 128;
|
|
10082
|
+
}
|
|
10385
10083
|
if (a.value != null) {
|
|
10386
10084
|
if (!Number.isInteger(a.value)) {
|
|
10387
|
-
value_bits
|
|
10085
|
+
value_bits &= ~(8 | 16 | 128);
|
|
10388
10086
|
} else {
|
|
10389
10087
|
if (Number(BigInt.asIntN(32, BigInt(a.value))) !== a.value) {
|
|
10390
|
-
value_bits
|
|
10088
|
+
value_bits &= ~(8 | 128);
|
|
10391
10089
|
}
|
|
10392
10090
|
}
|
|
10393
10091
|
}
|
|
10394
|
-
value_bits &= b.type;
|
|
10395
10092
|
let v = {
|
|
10396
10093
|
type: value_bits
|
|
10397
10094
|
};
|
|
10398
10095
|
if (value_bits && !(value_bits & value_bits - 1)) {
|
|
10399
10096
|
if (a.value != null) {
|
|
10400
|
-
v.value = value_bits === 16 ? BigInt(a.value) : Number(a.value);
|
|
10097
|
+
v.value = value_bits === 16 ? BigInt(a.value) : value_bits === 128 ? String.fromCharCode(Number(a.value)) : a.value;
|
|
10401
10098
|
if (b.value && !couldBe(v, b)) {
|
|
10402
10099
|
v.type = 0;
|
|
10403
10100
|
delete v.value;
|
|
@@ -10409,13 +10106,25 @@ function restrictExactTypesByEquality(a, b) {
|
|
|
10409
10106
|
return fixupEnum(a, v, b);
|
|
10410
10107
|
}
|
|
10411
10108
|
case 128: {
|
|
10412
|
-
|
|
10109
|
+
let extra_bits = 0;
|
|
10110
|
+
if (a.value == null || a.value.charCodeAt(0) === 0) {
|
|
10111
|
+
extra_bits |= 2;
|
|
10112
|
+
}
|
|
10113
|
+
if (a.value == null || a.value.charCodeAt(0) === 1) {
|
|
10114
|
+
extra_bits |= 4;
|
|
10115
|
+
}
|
|
10116
|
+
let value_bits = b.type & (120 | 128);
|
|
10117
|
+
if (b.type & 32768 && !getObjectValue(b)) {
|
|
10118
|
+
value_bits |= 120 | 128;
|
|
10119
|
+
} else {
|
|
10120
|
+
extra_bits &= b.type;
|
|
10121
|
+
}
|
|
10413
10122
|
let v = {
|
|
10414
|
-
type: value_bits
|
|
10123
|
+
type: value_bits | extra_bits
|
|
10415
10124
|
};
|
|
10416
10125
|
if (value_bits && !(value_bits & value_bits - 1)) {
|
|
10417
10126
|
if (a.value != null) {
|
|
10418
|
-
v.value = value_bits ===
|
|
10127
|
+
v.value = value_bits === 16 ? BigInt(a.value.charCodeAt(0)) : value_bits & 120 ? a.value.charCodeAt(0) : a.value;
|
|
10419
10128
|
if (b.value && !couldBe(v, b)) {
|
|
10420
10129
|
v.type = 0;
|
|
10421
10130
|
delete v.value;
|
|
@@ -10446,7 +10155,7 @@ function restrictExactTypesByEquality(a, b) {
|
|
|
10446
10155
|
}
|
|
10447
10156
|
case 262144:
|
|
10448
10157
|
return restrictByEquality(
|
|
10449
|
-
(0,
|
|
10158
|
+
(0, import_chunk_PVBIKZYZ.reduce)(
|
|
10450
10159
|
a.value,
|
|
10451
10160
|
(cur, decl) => {
|
|
10452
10161
|
unionInto(cur, decl.resolvedType);
|
|
@@ -10508,12 +10217,12 @@ function restrictByEquality(a, b) {
|
|
|
10508
10217
|
}
|
|
10509
10218
|
return restrictByEqualityByComponent(a, b);
|
|
10510
10219
|
}
|
|
10511
|
-
var init_intersection_type = (0,
|
|
10220
|
+
var init_intersection_type = (0, import_chunk_ABYVSU2C.__esm)({
|
|
10512
10221
|
"src/type-flow/intersection-type.ts"() {
|
|
10513
10222
|
"use strict";
|
|
10514
10223
|
init_api();
|
|
10515
10224
|
init_data_flow();
|
|
10516
|
-
(0,
|
|
10225
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
10517
10226
|
init_could_be();
|
|
10518
10227
|
init_interp();
|
|
10519
10228
|
init_types();
|
|
@@ -10599,14 +10308,14 @@ function subtypeOfValue(pair) {
|
|
|
10599
10308
|
case 8192: {
|
|
10600
10309
|
const asd = pair.avalue;
|
|
10601
10310
|
const bsd = pair.bvalue;
|
|
10602
|
-
return (0,
|
|
10311
|
+
return (0, import_chunk_PVBIKZYZ.some)(asd, (sna) => (0, import_chunk_PVBIKZYZ.some)(bsd, (snb) => sna === snb));
|
|
10603
10312
|
}
|
|
10604
10313
|
case 16384: {
|
|
10605
10314
|
const asd = pair.avalue;
|
|
10606
10315
|
const bsd = pair.bvalue;
|
|
10607
|
-
return (0,
|
|
10316
|
+
return (0, import_chunk_PVBIKZYZ.every)(asd, (sna) => {
|
|
10608
10317
|
const superA = getSuperClasses(sna);
|
|
10609
|
-
return (0,
|
|
10318
|
+
return (0, import_chunk_PVBIKZYZ.some)(bsd, (snb) => {
|
|
10610
10319
|
if (sna === snb || superA && superA.has(snb)) {
|
|
10611
10320
|
return true;
|
|
10612
10321
|
}
|
|
@@ -10632,17 +10341,17 @@ function subtypeOfObj(a, b) {
|
|
|
10632
10341
|
if (!a || !b)
|
|
10633
10342
|
return true;
|
|
10634
10343
|
return Object.entries(b).every(([key, value2]) => {
|
|
10635
|
-
if (!hasProperty(a, key))
|
|
10344
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(a, key))
|
|
10636
10345
|
return false;
|
|
10637
10346
|
return subtypeOf(a[key], value2);
|
|
10638
10347
|
});
|
|
10639
10348
|
}
|
|
10640
|
-
var init_sub_type = (0,
|
|
10349
|
+
var init_sub_type = (0, import_chunk_ABYVSU2C.__esm)({
|
|
10641
10350
|
"src/type-flow/sub-type.ts"() {
|
|
10642
10351
|
"use strict";
|
|
10643
10352
|
init_api();
|
|
10644
10353
|
init_data_flow();
|
|
10645
|
-
(0,
|
|
10354
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
10646
10355
|
init_intersection_type();
|
|
10647
10356
|
init_types();
|
|
10648
10357
|
init_union_type();
|
|
@@ -10719,10 +10428,10 @@ function equalsCheck(left, right) {
|
|
|
10719
10428
|
return left.type & 120 && right.type & 120 ? (
|
|
10720
10429
|
// eslint-disable-next-line eqeqeq
|
|
10721
10430
|
left.value == right.value
|
|
10722
|
-
) :
|
|
10723
|
-
// Char vs
|
|
10724
|
-
left.type === 128 ? left.value.charCodeAt(0) === right.value : left.value === right.value.charCodeAt(0)
|
|
10725
|
-
)
|
|
10431
|
+
) : (
|
|
10432
|
+
// Char vs Numeric is true iff the number is the char-code of the char
|
|
10433
|
+
left.type === 128 && right.type & 120 ? left.value.charCodeAt(0) === Number(right.value) : right.type === 128 && left.type & 120 ? Number(left.value) === right.value.charCodeAt(0) : left.type === 128 && right.type & 6 ? left.value.charCodeAt(0) === (right.value ? 1 : 0) : right.type === 128 && left.type & 6 ? right.value.charCodeAt(0) === (left.value ? 1 : 0) : left.type === 8 && right.type & 6 ? left.value === (right.value ? 1 : 0) : right.type === 8 && left.type & 6 ? right.value === (left.value ? 1 : 0) : left.type !== right.type ? lrBits & 1 ? lrBits & (32768 | 512 | 1024) ? void 0 : false : lrBits & (4096 | 8192 | 16384) ? false : void 0 : left.type === 128 || left.type === 131072 ? left.value === right.value : isSingleton(left) ? true : void 0
|
|
10434
|
+
);
|
|
10726
10435
|
}
|
|
10727
10436
|
function evaluateBinaryTypes(op, left, right) {
|
|
10728
10437
|
if (!operators) {
|
|
@@ -10975,7 +10684,7 @@ function evaluateLogicalTypes(op, left, right) {
|
|
|
10975
10684
|
}
|
|
10976
10685
|
}
|
|
10977
10686
|
var operators;
|
|
10978
|
-
var init_interp_binary = (0,
|
|
10687
|
+
var init_interp_binary = (0, import_chunk_ABYVSU2C.__esm)({
|
|
10979
10688
|
"src/type-flow/interp-binary.ts"() {
|
|
10980
10689
|
"use strict";
|
|
10981
10690
|
init_could_be();
|
|
@@ -10990,13 +10699,13 @@ function isTypeStateKey(decl) {
|
|
|
10990
10699
|
return Array.isArray(decl) || decl.type !== "MemberDecl" && decl.type !== "Unknown";
|
|
10991
10700
|
}
|
|
10992
10701
|
function declIsLocal(decl) {
|
|
10993
|
-
return (0,
|
|
10702
|
+
return (0, import_chunk_PVBIKZYZ.some)(
|
|
10994
10703
|
decl,
|
|
10995
10704
|
(d) => d.type === "BinaryExpression" || d.type === "Identifier" || d.type === "VariableDeclarator" && isLocal(d)
|
|
10996
10705
|
);
|
|
10997
10706
|
}
|
|
10998
10707
|
function declIsNonLocal(decl) {
|
|
10999
|
-
return (0,
|
|
10708
|
+
return (0, import_chunk_PVBIKZYZ.some)(decl, (d) => d.type === "VariableDeclarator" && !isLocal(d));
|
|
11000
10709
|
}
|
|
11001
10710
|
function localDeclName(decl) {
|
|
11002
10711
|
if (Array.isArray(decl))
|
|
@@ -11012,7 +10721,7 @@ function localDeclName(decl) {
|
|
|
11012
10721
|
throw new Error(`Invalid local decl: ${declFullName(decl)}`);
|
|
11013
10722
|
}
|
|
11014
10723
|
function tsKey(key) {
|
|
11015
|
-
return `${(0,
|
|
10724
|
+
return `${(0, import_chunk_PVBIKZYZ.map)(key, (k) => {
|
|
11016
10725
|
if (k.type === "Literal") {
|
|
11017
10726
|
return k.raw;
|
|
11018
10727
|
} else if (isStateNode(k)) {
|
|
@@ -11044,7 +10753,7 @@ function describeEvent(event) {
|
|
|
11044
10753
|
}
|
|
11045
10754
|
function printBlockEvents(block, extra) {
|
|
11046
10755
|
console.log("Events:");
|
|
11047
|
-
(0,
|
|
10756
|
+
(0, import_chunk_PVBIKZYZ.forEach)(
|
|
11048
10757
|
block.events,
|
|
11049
10758
|
(event) => console.log(` ${describeEvent(event)} ${extra ? extra(event) : ""}`)
|
|
11050
10759
|
);
|
|
@@ -11093,7 +10802,7 @@ function filterDecls(decls, possible, name) {
|
|
|
11093
10802
|
cur[1].add(poss);
|
|
11094
10803
|
break;
|
|
11095
10804
|
}
|
|
11096
|
-
if (hasProperty(sn.decls, name)) {
|
|
10805
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(sn.decls, name)) {
|
|
11097
10806
|
break;
|
|
11098
10807
|
}
|
|
11099
10808
|
}
|
|
@@ -11119,7 +10828,7 @@ function findObjectDeclsByProperty(state, object, next) {
|
|
|
11119
10828
|
const decls = getStateNodeDeclsFromType(state, object);
|
|
11120
10829
|
if (!decls)
|
|
11121
10830
|
return [null, null];
|
|
11122
|
-
const possibleDecls = hasProperty(state.allDeclarations, next.property.name) && state.allDeclarations[next.property.name];
|
|
10831
|
+
const possibleDecls = (0, import_chunk_MBTLUWXR.hasProperty)(state.allDeclarations, next.property.name) && state.allDeclarations[next.property.name];
|
|
11123
10832
|
return filterDecls(decls, possibleDecls, next.property.name);
|
|
11124
10833
|
}
|
|
11125
10834
|
function refineObjectTypeByDecls(istate, object, trueDecls) {
|
|
@@ -11161,12 +10870,12 @@ function resolveDottedMember(istate, object, next) {
|
|
|
11161
10870
|
const mayThrow2 = !subtypeOf(object, type);
|
|
11162
10871
|
return { mayThrow: mayThrow2, object: type, property };
|
|
11163
10872
|
}
|
|
11164
|
-
var init_type_flow_util = (0,
|
|
10873
|
+
var init_type_flow_util = (0, import_chunk_ABYVSU2C.__esm)({
|
|
11165
10874
|
"src/type-flow/type-flow-util.ts"() {
|
|
11166
10875
|
"use strict";
|
|
11167
10876
|
init_api();
|
|
11168
10877
|
init_data_flow();
|
|
11169
|
-
(0,
|
|
10878
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
11170
10879
|
init_intersection_type();
|
|
11171
10880
|
init_sub_type();
|
|
11172
10881
|
init_types();
|
|
@@ -11218,7 +10927,7 @@ function calleeObjectType(istate, callee) {
|
|
|
11218
10927
|
}
|
|
11219
10928
|
function checkCallArgs(istate, node, callees, args) {
|
|
11220
10929
|
const allDiags = [];
|
|
11221
|
-
const resultType = (0,
|
|
10930
|
+
const resultType = (0, import_chunk_PVBIKZYZ.reduce)(
|
|
11222
10931
|
callees,
|
|
11223
10932
|
(result, cur) => {
|
|
11224
10933
|
const curDiags = [];
|
|
@@ -11367,7 +11076,7 @@ function isOverride(cur, funcs) {
|
|
|
11367
11076
|
const cls = cur.stack?.[cur.stack.length - 1]?.sn;
|
|
11368
11077
|
if (cls?.type === "ClassDeclaration" && cls.superClasses) {
|
|
11369
11078
|
const supers = getSuperClasses(cls);
|
|
11370
|
-
if (supers && (0,
|
|
11079
|
+
if (supers && (0, import_chunk_PVBIKZYZ.some)(funcs, (func) => {
|
|
11371
11080
|
if (func === cur)
|
|
11372
11081
|
return false;
|
|
11373
11082
|
const fcls = func.stack?.[func.stack.length - 1].sn;
|
|
@@ -11380,7 +11089,7 @@ function isOverride(cur, funcs) {
|
|
|
11380
11089
|
}
|
|
11381
11090
|
function sysCallInfo(state, func) {
|
|
11382
11091
|
const info = getSystemCallTable(state);
|
|
11383
|
-
if (hasProperty(info, func.fullName)) {
|
|
11092
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(info, func.fullName)) {
|
|
11384
11093
|
return info[func.fullName];
|
|
11385
11094
|
}
|
|
11386
11095
|
return null;
|
|
@@ -11614,7 +11323,7 @@ function getSystemCallTable(state) {
|
|
|
11614
11323
|
};
|
|
11615
11324
|
const mathHelper = (state2, callee, calleeObj, getArgs, helper) => {
|
|
11616
11325
|
const results = {};
|
|
11617
|
-
const fn = helper && typeof helper === "function" ? helper : hasProperty(Math, helper || callee.name) && Math[helper || callee.name];
|
|
11326
|
+
const fn = helper && typeof helper === "function" ? helper : (0, import_chunk_MBTLUWXR.hasProperty)(Math, helper || callee.name) && Math[helper || callee.name];
|
|
11618
11327
|
if (fn && typeof fn === "function") {
|
|
11619
11328
|
results.effectFree = true;
|
|
11620
11329
|
const args = getArgs();
|
|
@@ -11743,7 +11452,7 @@ function expandKeys(state, table) {
|
|
|
11743
11452
|
);
|
|
11744
11453
|
decls.forEach((decl) => {
|
|
11745
11454
|
if (decl.type === "FunctionDeclaration") {
|
|
11746
|
-
if (!hasProperty(result, decl.fullName)) {
|
|
11455
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(result, decl.fullName)) {
|
|
11747
11456
|
result[decl.fullName] = value2;
|
|
11748
11457
|
}
|
|
11749
11458
|
}
|
|
@@ -11753,12 +11462,12 @@ function expandKeys(state, table) {
|
|
|
11753
11462
|
return result;
|
|
11754
11463
|
}
|
|
11755
11464
|
var systemCallInfo, systemCallVersion;
|
|
11756
|
-
var init_interp_call = (0,
|
|
11465
|
+
var init_interp_call = (0, import_chunk_ABYVSU2C.__esm)({
|
|
11757
11466
|
"src/type-flow/interp-call.ts"() {
|
|
11758
11467
|
"use strict";
|
|
11759
11468
|
init_optimizer_types();
|
|
11760
11469
|
init_api();
|
|
11761
|
-
(0,
|
|
11470
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
11762
11471
|
init_interp();
|
|
11763
11472
|
init_sub_type();
|
|
11764
11473
|
init_types();
|
|
@@ -11926,9 +11635,9 @@ function evaluate(istate, node) {
|
|
|
11926
11635
|
}
|
|
11927
11636
|
return null;
|
|
11928
11637
|
};
|
|
11929
|
-
traverseAst(node, pre, post);
|
|
11638
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(node, pre, post);
|
|
11930
11639
|
const ret = istate.stack.pop();
|
|
11931
|
-
if (isExpression(node)) {
|
|
11640
|
+
if ((0, import_chunk_MBTLUWXR.isExpression)(node)) {
|
|
11932
11641
|
if (!ret || node !== ret.node) {
|
|
11933
11642
|
throw new Error("evaluate failed to produce a value for an expression");
|
|
11934
11643
|
}
|
|
@@ -11979,6 +11688,9 @@ function deEnumerate(t) {
|
|
|
11979
11688
|
return t;
|
|
11980
11689
|
}
|
|
11981
11690
|
function getLhsConstraint(istate, node) {
|
|
11691
|
+
if (istate.localLvals?.has(node)) {
|
|
11692
|
+
return null;
|
|
11693
|
+
}
|
|
11982
11694
|
let lookupDefs = null;
|
|
11983
11695
|
if (node.type === "MemberExpression") {
|
|
11984
11696
|
if (!istate.typeMap) {
|
|
@@ -12661,11 +12373,11 @@ function mustBeIdentical(a, b) {
|
|
|
12661
12373
|
}
|
|
12662
12374
|
return false;
|
|
12663
12375
|
}
|
|
12664
|
-
var init_interp = (0,
|
|
12376
|
+
var init_interp = (0, import_chunk_ABYVSU2C.__esm)({
|
|
12665
12377
|
"src/type-flow/interp.ts"() {
|
|
12666
12378
|
"use strict";
|
|
12667
12379
|
init_api();
|
|
12668
|
-
init_ast();
|
|
12380
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
12669
12381
|
init_data_flow();
|
|
12670
12382
|
init_optimizer_types();
|
|
12671
12383
|
init_could_be();
|
|
@@ -12880,7 +12592,7 @@ function typeFromTypeStateNode(state, sn, classVsObj) {
|
|
|
12880
12592
|
);
|
|
12881
12593
|
if (value2) {
|
|
12882
12594
|
const a = [];
|
|
12883
|
-
(0,
|
|
12595
|
+
(0, import_chunk_PVBIKZYZ.forEach)(value2, (v) => {
|
|
12884
12596
|
if (v !== sn)
|
|
12885
12597
|
a.push(v);
|
|
12886
12598
|
});
|
|
@@ -12905,7 +12617,7 @@ function typeFromTypeStateNode(state, sn, classVsObj) {
|
|
|
12905
12617
|
declared = typeFromTypespec(state, sn.node.id.right, sn.stack);
|
|
12906
12618
|
}
|
|
12907
12619
|
if (sn.node.kind === "const" && sn.node.init) {
|
|
12908
|
-
if (hasProperty(sn, "resolvedType")) {
|
|
12620
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(sn, "resolvedType")) {
|
|
12909
12621
|
return declared ?? {
|
|
12910
12622
|
type: 524287
|
|
12911
12623
|
/* Any */
|
|
@@ -12991,7 +12703,7 @@ function typeFromSingleTypeSpec(state, type, stack) {
|
|
|
12991
12703
|
value: { result, args }
|
|
12992
12704
|
};
|
|
12993
12705
|
}
|
|
12994
|
-
const id = typeof type.name === "string" ? makeScopedName(type.name) : type.name;
|
|
12706
|
+
const id = typeof type.name === "string" ? (0, import_chunk_MBTLUWXR.makeScopedName)(type.name) : type.name;
|
|
12995
12707
|
const [, results] = state.lookupType(id, null, stack);
|
|
12996
12708
|
if (!results) {
|
|
12997
12709
|
if (id.type === "Identifier") {
|
|
@@ -13070,7 +12782,7 @@ function typeFromTypespec(state, ts, stack) {
|
|
|
13070
12782
|
);
|
|
13071
12783
|
}
|
|
13072
12784
|
function typeFromLiteral(literal) {
|
|
13073
|
-
const [value2, type] = getNodeValue(literal);
|
|
12785
|
+
const [value2, type] = (0, import_chunk_MBTLUWXR.getNodeValue)(literal);
|
|
13074
12786
|
switch (type) {
|
|
13075
12787
|
case "Null":
|
|
13076
12788
|
return {
|
|
@@ -13115,7 +12827,7 @@ function mcExprFromType(type) {
|
|
|
13115
12827
|
return { type: "Literal", value: type.value, raw: `${type.value}l` };
|
|
13116
12828
|
case 32: {
|
|
13117
12829
|
let raw = type.value.toString();
|
|
13118
|
-
if (
|
|
12830
|
+
if (import_prettier_plugin_monkeyc.LiteralIntegerRe.test(raw)) {
|
|
13119
12831
|
raw += "f";
|
|
13120
12832
|
} else {
|
|
13121
12833
|
const match = raw.match(/^(-)?(\d*)\.(\d+)(e[-+]?\d+)?/i);
|
|
@@ -13255,7 +12967,7 @@ function mustBeFalse(arg) {
|
|
|
13255
12967
|
return arg.type === 1 || arg.type === 2 || (arg.type === 8 || arg.type === 16) && arg.value != null && Number(arg.value) === 0;
|
|
13256
12968
|
}
|
|
13257
12969
|
function display(type) {
|
|
13258
|
-
const names = (v, fn) => (0,
|
|
12970
|
+
const names = (v, fn) => (0, import_chunk_PVBIKZYZ.map)(v, fn).sort().filter((s, i, arr) => !i || s !== arr[i - 1]).join(" or ");
|
|
13259
12971
|
const parts = [];
|
|
13260
12972
|
const displayOne = (tv) => {
|
|
13261
12973
|
switch (tv.type) {
|
|
@@ -13446,13 +13158,13 @@ function getStateNodeDeclsFromType(state, object) {
|
|
|
13446
13158
|
return decls;
|
|
13447
13159
|
}
|
|
13448
13160
|
var LastTypeTag, SingletonTypeTagsConst, UnionDataTypeTagsConst, ValueTypeTagsConst, ObjectLikeTagsConst, EnumTagsConst, TruthyTypes;
|
|
13449
|
-
var init_types = (0,
|
|
13161
|
+
var init_types = (0, import_chunk_ABYVSU2C.__esm)({
|
|
13450
13162
|
"src/type-flow/types.ts"() {
|
|
13451
13163
|
"use strict";
|
|
13452
13164
|
init_data_flow();
|
|
13453
13165
|
init_api();
|
|
13454
|
-
init_ast();
|
|
13455
|
-
(0,
|
|
13166
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
13167
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
13456
13168
|
init_interp();
|
|
13457
13169
|
init_union_type();
|
|
13458
13170
|
init_intersection_type();
|
|
@@ -13508,7 +13220,7 @@ function couldBeHelper(a, b, shallow) {
|
|
|
13508
13220
|
262144
|
|
13509
13221
|
/* Typedef */
|
|
13510
13222
|
);
|
|
13511
|
-
return typedef && (0,
|
|
13223
|
+
return typedef && (0, import_chunk_PVBIKZYZ.some)(typedef, (td) => {
|
|
13512
13224
|
if (!td.resolvedType) {
|
|
13513
13225
|
throw new Error(`No resolved type for ${td.fullName} in 'couldBe'`);
|
|
13514
13226
|
}
|
|
@@ -13559,15 +13271,15 @@ function couldBeValue(pair, shallow) {
|
|
|
13559
13271
|
}
|
|
13560
13272
|
case 4096:
|
|
13561
13273
|
case 8192: {
|
|
13562
|
-
return (0,
|
|
13274
|
+
return (0, import_chunk_PVBIKZYZ.some)(
|
|
13563
13275
|
pair.avalue,
|
|
13564
|
-
(sna) => (0,
|
|
13276
|
+
(sna) => (0, import_chunk_PVBIKZYZ.some)(pair.bvalue, (snb) => sna === snb)
|
|
13565
13277
|
);
|
|
13566
13278
|
}
|
|
13567
13279
|
case 16384: {
|
|
13568
|
-
return (0,
|
|
13280
|
+
return (0, import_chunk_PVBIKZYZ.some)(pair.avalue, (sna) => {
|
|
13569
13281
|
const superA = getSuperClasses(sna);
|
|
13570
|
-
return (0,
|
|
13282
|
+
return (0, import_chunk_PVBIKZYZ.some)(pair.bvalue, (snb) => {
|
|
13571
13283
|
if (sna === snb || superA && superA.has(snb)) {
|
|
13572
13284
|
return true;
|
|
13573
13285
|
}
|
|
@@ -13590,17 +13302,17 @@ function couldBeObj(a, b) {
|
|
|
13590
13302
|
if (!a || !b)
|
|
13591
13303
|
return true;
|
|
13592
13304
|
return Object.entries(a).every(([key, value2]) => {
|
|
13593
|
-
if (!hasProperty(b, key))
|
|
13305
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(b, key))
|
|
13594
13306
|
return true;
|
|
13595
13307
|
return couldBe(value2, b[key]);
|
|
13596
13308
|
});
|
|
13597
13309
|
}
|
|
13598
|
-
var init_could_be = (0,
|
|
13310
|
+
var init_could_be = (0, import_chunk_ABYVSU2C.__esm)({
|
|
13599
13311
|
"src/type-flow/could-be.ts"() {
|
|
13600
13312
|
"use strict";
|
|
13601
13313
|
init_api();
|
|
13602
13314
|
init_data_flow();
|
|
13603
|
-
(0,
|
|
13315
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
13604
13316
|
init_types();
|
|
13605
13317
|
}
|
|
13606
13318
|
});
|
|
@@ -13882,7 +13594,7 @@ function eliminateDeadStores(state, func, graph, logThisRun) {
|
|
|
13882
13594
|
);
|
|
13883
13595
|
}
|
|
13884
13596
|
let changes = false;
|
|
13885
|
-
traverseAst(func.node.body, null, (node) => {
|
|
13597
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(func.node.body, null, (node) => {
|
|
13886
13598
|
const cleaned = variableCleanup(node);
|
|
13887
13599
|
if (cleaned !== null)
|
|
13888
13600
|
return cleaned;
|
|
@@ -13892,7 +13604,7 @@ function eliminateDeadStores(state, func, graph, logThisRun) {
|
|
|
13892
13604
|
);
|
|
13893
13605
|
changes = true;
|
|
13894
13606
|
if (body.length) {
|
|
13895
|
-
return withLoc({ type: "BlockStatement", body }, node, node);
|
|
13607
|
+
return (0, import_chunk_MBTLUWXR.withLoc)({ type: "BlockStatement", body }, node, node);
|
|
13896
13608
|
}
|
|
13897
13609
|
return false;
|
|
13898
13610
|
}
|
|
@@ -13921,11 +13633,11 @@ function eliminateDeadStores(state, func, graph, logThisRun) {
|
|
|
13921
13633
|
});
|
|
13922
13634
|
return { copyPropStores, changes };
|
|
13923
13635
|
}
|
|
13924
|
-
var init_dead_store = (0,
|
|
13636
|
+
var init_dead_store = (0, import_chunk_ABYVSU2C.__esm)({
|
|
13925
13637
|
"src/type-flow/dead-store.ts"() {
|
|
13926
13638
|
"use strict";
|
|
13927
13639
|
init_api();
|
|
13928
|
-
init_ast();
|
|
13640
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
13929
13641
|
init_control_flow();
|
|
13930
13642
|
init_data_flow();
|
|
13931
13643
|
init_inliner();
|
|
@@ -14364,7 +14076,7 @@ function updateAffected(blockState, objectType, baseDecl, assignedPath, affected
|
|
|
14364
14076
|
type = newType;
|
|
14365
14077
|
} else {
|
|
14366
14078
|
const objValue = getObjectValue(type);
|
|
14367
|
-
if (!objValue || !hasProperty(objValue.obj, pathItem)) {
|
|
14079
|
+
if (!objValue || !(0, import_chunk_MBTLUWXR.hasProperty)(objValue.obj, pathItem)) {
|
|
14368
14080
|
break;
|
|
14369
14081
|
}
|
|
14370
14082
|
type = objValue.obj[pathItem];
|
|
@@ -14414,7 +14126,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14414
14126
|
const value2 = getObjectValue(cur);
|
|
14415
14127
|
if (i === l && newValue) {
|
|
14416
14128
|
next = newValue;
|
|
14417
|
-
} else if (value2 && hasProperty(value2.obj, me.property.name)) {
|
|
14129
|
+
} else if (value2 && (0, import_chunk_MBTLUWXR.hasProperty)(value2.obj, me.property.name)) {
|
|
14418
14130
|
next = value2.obj[me.property.name];
|
|
14419
14131
|
} else {
|
|
14420
14132
|
const [objDecls, trueDecls] = findObjectDeclsByProperty(
|
|
@@ -14517,7 +14229,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14517
14229
|
}
|
|
14518
14230
|
if (selfClassDecl) {
|
|
14519
14231
|
const baseObj = getObjectValue(baseElem.type);
|
|
14520
|
-
if (baseObj && baseObj.klass.type === 16384 && (0,
|
|
14232
|
+
if (baseObj && baseObj.klass.type === 16384 && (0, import_chunk_PVBIKZYZ.some)(
|
|
14521
14233
|
baseObj.klass.value,
|
|
14522
14234
|
(cls) => cls === selfClassDecl || getSuperClasses(cls)?.has(selfClassDecl) || getSuperClasses(selfClassDecl)?.has(cls) || false
|
|
14523
14235
|
)) {
|
|
@@ -14562,7 +14274,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14562
14274
|
return [next, updateAny];
|
|
14563
14275
|
}
|
|
14564
14276
|
function typeConstraint(decls) {
|
|
14565
|
-
return (0,
|
|
14277
|
+
return (0, import_chunk_PVBIKZYZ.reduce)(
|
|
14566
14278
|
decls,
|
|
14567
14279
|
(cur, decl) => {
|
|
14568
14280
|
if (decl.type === "Identifier" || decl.type === "BinaryExpression") {
|
|
@@ -14655,9 +14367,9 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14655
14367
|
stack: [],
|
|
14656
14368
|
func
|
|
14657
14369
|
};
|
|
14658
|
-
const modifiableDecl = (decls, callees) => (0,
|
|
14370
|
+
const modifiableDecl = (decls, callees) => (0, import_chunk_PVBIKZYZ.some)(
|
|
14659
14371
|
decls,
|
|
14660
|
-
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && !isLocal(decl) && (!callees || (0,
|
|
14372
|
+
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && !isLocal(decl) && (!callees || (0, import_chunk_PVBIKZYZ.some)(callees, (callee) => functionMayModify(state, callee, decl)))
|
|
14661
14373
|
);
|
|
14662
14374
|
const mergeSuccState = (top, curState) => {
|
|
14663
14375
|
top.succs?.forEach((succ) => {
|
|
@@ -14678,7 +14390,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
14678
14390
|
type: 0
|
|
14679
14391
|
/* Never */
|
|
14680
14392
|
};
|
|
14681
|
-
const result = (0,
|
|
14393
|
+
const result = (0, import_chunk_PVBIKZYZ.every)(callees, (callee) => {
|
|
14682
14394
|
const info = sysCallInfo(istate.state, callee);
|
|
14683
14395
|
if (!info)
|
|
14684
14396
|
return false;
|
|
@@ -15078,7 +14790,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15078
14790
|
);
|
|
15079
14791
|
}
|
|
15080
14792
|
}
|
|
15081
|
-
if (nodeCopyProp.size && event.node.type === "CallExpression" && (0,
|
|
14793
|
+
if (nodeCopyProp.size && event.node.type === "CallExpression" && (0, import_chunk_PVBIKZYZ.some)(callees, (callee) => inlineRequested(state, callee))) {
|
|
15082
14794
|
event.node.arguments.forEach((arg) => {
|
|
15083
14795
|
const def = nodeCopyProp.get(arg);
|
|
15084
14796
|
if (def && nodeCopyProp.get(def) !== false) {
|
|
@@ -15090,7 +14802,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15090
14802
|
let calleeEffects;
|
|
15091
14803
|
curState.map.forEach((tsv, decl) => {
|
|
15092
14804
|
let type = tsv.curType;
|
|
15093
|
-
if ((type.value == null || !(type.type & (32768 | 512 | 1024))) && !(0,
|
|
14805
|
+
if ((type.value == null || !(type.type & (32768 | 512 | 1024))) && !(0, import_chunk_PVBIKZYZ.some)(decl, (d) => d.type === "VariableDeclarator" && !isLocal(d))) {
|
|
15094
14806
|
return;
|
|
15095
14807
|
}
|
|
15096
14808
|
if (modifiableDecl(decl, callees)) {
|
|
@@ -15103,7 +14815,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15103
14815
|
(0, import_node_assert3.default)(!tsv.copyPropItem);
|
|
15104
14816
|
clearRelatedCopyPropEvents(curState, decl, nodeCopyProp);
|
|
15105
14817
|
curState.map.set(decl, { curType: typeConstraint(decl) });
|
|
15106
|
-
} else if (type.type & (32768 | 512 | 1024) && (calleeEffects == null ? calleeEffects = !callees || !(0,
|
|
14818
|
+
} else if (type.type & (32768 | 512 | 1024) && (calleeEffects == null ? calleeEffects = !callees || !(0, import_chunk_PVBIKZYZ.every)(callees, (callee) => callee.info === false) : calleeEffects)) {
|
|
15107
14819
|
if (type.value != null && type.type & 32768) {
|
|
15108
14820
|
const odata = getObjectValue(tsv.curType);
|
|
15109
14821
|
if (odata?.obj) {
|
|
@@ -15127,6 +14839,12 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15127
14839
|
case "def": {
|
|
15128
14840
|
const lval = event.node.type === "UpdateExpression" ? event.node.argument : event.node.type === "AssignmentExpression" ? event.node.left : null;
|
|
15129
14841
|
if (lval) {
|
|
14842
|
+
if (declIsLocal(event.decl)) {
|
|
14843
|
+
if (!istate.localLvals) {
|
|
14844
|
+
istate.localLvals = /* @__PURE__ */ new Set();
|
|
14845
|
+
}
|
|
14846
|
+
istate.localLvals.add(lval);
|
|
14847
|
+
}
|
|
15130
14848
|
if (nodeEquivs.has(lval)) {
|
|
15131
14849
|
nodeEquivs.delete(lval);
|
|
15132
14850
|
}
|
|
@@ -15151,7 +14869,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15151
14869
|
2
|
|
15152
14870
|
/* Reassign */
|
|
15153
14871
|
);
|
|
15154
|
-
(0,
|
|
14872
|
+
(0, import_chunk_PVBIKZYZ.some)(event.decl, (decl) => {
|
|
15155
14873
|
if (decl.type !== "VariableDeclarator" || decl.node.kind !== "var" || !isClassVariable(decl)) {
|
|
15156
14874
|
return false;
|
|
15157
14875
|
}
|
|
@@ -15159,7 +14877,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15159
14877
|
if (affected) {
|
|
15160
14878
|
const objType = typeFromTypeStateNodes(
|
|
15161
14879
|
istate.state,
|
|
15162
|
-
(0,
|
|
14880
|
+
(0, import_chunk_PVBIKZYZ.map)(
|
|
15163
14881
|
event.decl,
|
|
15164
14882
|
(decl2) => decl2.type === "VariableDeclarator" && decl2.stack[decl2.stack.length - 1].sn
|
|
15165
14883
|
).filter(
|
|
@@ -15180,7 +14898,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15180
14898
|
});
|
|
15181
14899
|
if (wasComputedDecl) {
|
|
15182
14900
|
curState.map.forEach((value2, decls) => {
|
|
15183
|
-
if ((0,
|
|
14901
|
+
if ((0, import_chunk_PVBIKZYZ.some)(
|
|
15184
14902
|
decls,
|
|
15185
14903
|
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && !isLocal(decl)
|
|
15186
14904
|
)) {
|
|
@@ -15224,14 +14942,14 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15224
14942
|
}
|
|
15225
14943
|
if (!copyPropCandidate.ant || // If the ref isn't anticipated, we can't propagate it
|
|
15226
14944
|
// in case it has side effects.
|
|
15227
|
-
(0,
|
|
14945
|
+
(0, import_chunk_PVBIKZYZ.some)(
|
|
15228
14946
|
event2.calleeDecl,
|
|
15229
14947
|
(callee) => callee.type === "FunctionDeclaration" && inlineRequested(state, callee)
|
|
15230
14948
|
)) {
|
|
15231
14949
|
return false;
|
|
15232
14950
|
}
|
|
15233
14951
|
}
|
|
15234
|
-
if (!event2.decl || isTypeStateKey(event2.decl) && (0,
|
|
14952
|
+
if (!event2.decl || isTypeStateKey(event2.decl) && (0, import_chunk_PVBIKZYZ.some)(
|
|
15235
14953
|
event2.decl,
|
|
15236
14954
|
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" || decl.type === "BinaryExpression" || decl.type === "Identifier"
|
|
15237
14955
|
)) {
|
|
@@ -15339,7 +15057,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15339
15057
|
if (!successorsHandled) {
|
|
15340
15058
|
if (logThisRun) {
|
|
15341
15059
|
console.log(
|
|
15342
|
-
` merge to: ${(0,
|
|
15060
|
+
` merge to: ${(0, import_chunk_PVBIKZYZ.map)(
|
|
15343
15061
|
top.succs,
|
|
15344
15062
|
(succ) => succ.order || -1
|
|
15345
15063
|
).join(", ")}`
|
|
@@ -15453,16 +15171,16 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15453
15171
|
}
|
|
15454
15172
|
})
|
|
15455
15173
|
);
|
|
15456
|
-
traverseAst(
|
|
15174
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(
|
|
15457
15175
|
func.node.body,
|
|
15458
15176
|
(node) => {
|
|
15459
15177
|
if (node.type === "AssignmentExpression" && node.operator !== "=" && nodeCopyProp.has(node.left)) {
|
|
15460
|
-
const left = cloneDeep(node.left);
|
|
15461
|
-
const right = withLoc(
|
|
15178
|
+
const left = (0, import_chunk_MBTLUWXR.cloneDeep)(node.left);
|
|
15179
|
+
const right = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
15462
15180
|
{
|
|
15463
15181
|
type: "BinaryExpression",
|
|
15464
15182
|
operator: node.operator.slice(0, -1),
|
|
15465
|
-
left: withLocDeep(node.left, node.right, false, true),
|
|
15183
|
+
left: (0, import_chunk_MBTLUWXR.withLocDeep)(node.left, node.right, false, true),
|
|
15466
15184
|
right: node.right
|
|
15467
15185
|
},
|
|
15468
15186
|
node.left,
|
|
@@ -15482,7 +15200,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15482
15200
|
`Killing copy-prop assignment ${formatAstLongLines(node)}`
|
|
15483
15201
|
);
|
|
15484
15202
|
}
|
|
15485
|
-
return withLoc(
|
|
15203
|
+
return (0, import_chunk_MBTLUWXR.withLoc)(
|
|
15486
15204
|
{ type: "Literal", value: null, raw: "null" },
|
|
15487
15205
|
node,
|
|
15488
15206
|
node
|
|
@@ -15518,7 +15236,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15518
15236
|
)}`
|
|
15519
15237
|
);
|
|
15520
15238
|
}
|
|
15521
|
-
return withLocDeep(replacement2, node, node, false);
|
|
15239
|
+
return (0, import_chunk_MBTLUWXR.withLocDeep)(replacement2, node, node, false);
|
|
15522
15240
|
} else if (copyNode.type === "VariableDeclarator") {
|
|
15523
15241
|
(0, import_node_assert3.default)(copyNode.init);
|
|
15524
15242
|
if (logThisRun) {
|
|
@@ -15528,7 +15246,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15528
15246
|
)}`
|
|
15529
15247
|
);
|
|
15530
15248
|
}
|
|
15531
|
-
return withLocDeep(copyNode.init, node, node, false);
|
|
15249
|
+
return (0, import_chunk_MBTLUWXR.withLocDeep)(copyNode.init, node, node, false);
|
|
15532
15250
|
}
|
|
15533
15251
|
(0, import_node_assert3.default)(false);
|
|
15534
15252
|
}
|
|
@@ -15540,7 +15258,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15540
15258
|
)})`
|
|
15541
15259
|
);
|
|
15542
15260
|
}
|
|
15543
|
-
return withLoc(
|
|
15261
|
+
return (0, import_chunk_MBTLUWXR.withLoc)(
|
|
15544
15262
|
{ type: "Literal", value: null, raw: "null" },
|
|
15545
15263
|
node,
|
|
15546
15264
|
node
|
|
@@ -15576,7 +15294,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15576
15294
|
}, curInfo);
|
|
15577
15295
|
if (rep === curInfo)
|
|
15578
15296
|
return null;
|
|
15579
|
-
const name = (0,
|
|
15297
|
+
const name = (0, import_chunk_PVBIKZYZ.reduce)(
|
|
15580
15298
|
rep.decl,
|
|
15581
15299
|
(cur, decl) => decl.type === "VariableDeclarator" ? decl.name : cur,
|
|
15582
15300
|
null
|
|
@@ -15590,7 +15308,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
15590
15308
|
)}`
|
|
15591
15309
|
);
|
|
15592
15310
|
}
|
|
15593
|
-
const replacement = withLoc({ type: "Identifier", name }, node, node);
|
|
15311
|
+
const replacement = (0, import_chunk_MBTLUWXR.withLoc)({ type: "Identifier", name }, node, node);
|
|
15594
15312
|
const tm = typeMap.get(node);
|
|
15595
15313
|
if (tm)
|
|
15596
15314
|
typeMap.set(replacement, tm);
|
|
@@ -15677,11 +15395,11 @@ function updateByAssocPath(path7, property, union) {
|
|
|
15677
15395
|
return property;
|
|
15678
15396
|
}
|
|
15679
15397
|
var logging, missingNullWorkaround;
|
|
15680
|
-
var init_type_flow = (0,
|
|
15398
|
+
var init_type_flow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
15681
15399
|
"src/type-flow.ts"() {
|
|
15682
15400
|
"use strict";
|
|
15683
15401
|
init_api();
|
|
15684
|
-
init_ast();
|
|
15402
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
15685
15403
|
init_control_flow();
|
|
15686
15404
|
init_data_flow();
|
|
15687
15405
|
init_function_info();
|
|
@@ -15696,7 +15414,7 @@ var init_type_flow = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
15696
15414
|
init_type_flow_util();
|
|
15697
15415
|
init_types();
|
|
15698
15416
|
init_union_type();
|
|
15699
|
-
(0,
|
|
15417
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
15700
15418
|
logging = true;
|
|
15701
15419
|
missingNullWorkaround = true;
|
|
15702
15420
|
}
|
|
@@ -15820,11 +15538,11 @@ function minimizeLocals(state, func) {
|
|
|
15820
15538
|
};
|
|
15821
15539
|
if (sn.node.body.length && sn.node.body[0].type === "VariableDeclaration") {
|
|
15822
15540
|
sn.node.body[0].declarations.unshift(
|
|
15823
|
-
withLocDeep(varDecl, sn.node.body[0], false, true)
|
|
15541
|
+
(0, import_chunk_MBTLUWXR.withLocDeep)(varDecl, sn.node.body[0], false, true)
|
|
15824
15542
|
);
|
|
15825
15543
|
} else {
|
|
15826
15544
|
sn.node.body.unshift(
|
|
15827
|
-
withLocDeep(
|
|
15545
|
+
(0, import_chunk_MBTLUWXR.withLocDeep)(
|
|
15828
15546
|
{
|
|
15829
15547
|
type: "VariableDeclaration",
|
|
15830
15548
|
declarations: [varDecl],
|
|
@@ -15851,7 +15569,7 @@ function minimizeLocals(state, func) {
|
|
|
15851
15569
|
nodeMap.set(event.node, rep);
|
|
15852
15570
|
})
|
|
15853
15571
|
);
|
|
15854
|
-
traverseAst(func.node.body, null, (node) => {
|
|
15572
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(func.node.body, null, (node) => {
|
|
15855
15573
|
const info = nodeMap.get(node);
|
|
15856
15574
|
switch (node.type) {
|
|
15857
15575
|
case "Identifier":
|
|
@@ -15863,7 +15581,7 @@ function minimizeLocals(state, func) {
|
|
|
15863
15581
|
if (info) {
|
|
15864
15582
|
(0, import_node_assert4.default)(node.left.type === "Identifier");
|
|
15865
15583
|
if (node.right.type === "Identifier" && node.right.name === info.name) {
|
|
15866
|
-
return withLoc(
|
|
15584
|
+
return (0, import_chunk_MBTLUWXR.withLoc)(
|
|
15867
15585
|
{ type: "Literal", value: null, raw: "null" },
|
|
15868
15586
|
node,
|
|
15869
15587
|
node
|
|
@@ -15892,11 +15610,11 @@ function minimizeLocals(state, func) {
|
|
|
15892
15610
|
if (node.init.type === "Identifier" && node.init.name === info.name) {
|
|
15893
15611
|
return false;
|
|
15894
15612
|
}
|
|
15895
|
-
return withLoc(
|
|
15613
|
+
return (0, import_chunk_MBTLUWXR.withLoc)(
|
|
15896
15614
|
{
|
|
15897
15615
|
type: "AssignmentExpression",
|
|
15898
15616
|
operator: "=",
|
|
15899
|
-
left: withLoc(
|
|
15617
|
+
left: (0, import_chunk_MBTLUWXR.withLoc)(
|
|
15900
15618
|
{
|
|
15901
15619
|
type: "Identifier",
|
|
15902
15620
|
name: info.name,
|
|
@@ -15932,11 +15650,11 @@ function variableCleanup(node) {
|
|
|
15932
15650
|
const results = [];
|
|
15933
15651
|
node.declarations.forEach(
|
|
15934
15652
|
(decl) => {
|
|
15935
|
-
if (isStatement(decl)) {
|
|
15653
|
+
if ((0, import_chunk_MBTLUWXR.isStatement)(decl)) {
|
|
15936
15654
|
results.push(decl);
|
|
15937
|
-
} else if (isExpression(decl)) {
|
|
15655
|
+
} else if ((0, import_chunk_MBTLUWXR.isExpression)(decl)) {
|
|
15938
15656
|
results.push(
|
|
15939
|
-
withLoc(
|
|
15657
|
+
(0, import_chunk_MBTLUWXR.withLoc)(
|
|
15940
15658
|
{ type: "ExpressionStatement", expression: decl },
|
|
15941
15659
|
decl,
|
|
15942
15660
|
decl
|
|
@@ -15944,14 +15662,14 @@ function variableCleanup(node) {
|
|
|
15944
15662
|
);
|
|
15945
15663
|
} else if (decl.init) {
|
|
15946
15664
|
results.push(
|
|
15947
|
-
withLoc(
|
|
15665
|
+
(0, import_chunk_MBTLUWXR.withLoc)(
|
|
15948
15666
|
{
|
|
15949
15667
|
type: "ExpressionStatement",
|
|
15950
|
-
expression: withLoc(
|
|
15668
|
+
expression: (0, import_chunk_MBTLUWXR.withLoc)(
|
|
15951
15669
|
{
|
|
15952
15670
|
type: "AssignmentExpression",
|
|
15953
15671
|
operator: "=",
|
|
15954
|
-
left: withLoc(
|
|
15672
|
+
left: (0, import_chunk_MBTLUWXR.withLoc)(
|
|
15955
15673
|
{
|
|
15956
15674
|
type: "Identifier",
|
|
15957
15675
|
name: variableDeclarationName(decl.id)
|
|
@@ -15980,7 +15698,7 @@ function variableCleanup(node) {
|
|
|
15980
15698
|
return false;
|
|
15981
15699
|
});
|
|
15982
15700
|
if (node.declarations.length) {
|
|
15983
|
-
withLocDeep(node, node, false);
|
|
15701
|
+
(0, import_chunk_MBTLUWXR.withLocDeep)(node, node, false);
|
|
15984
15702
|
results.unshift(node);
|
|
15985
15703
|
}
|
|
15986
15704
|
return results;
|
|
@@ -16013,11 +15731,11 @@ function variableCleanup(node) {
|
|
|
16013
15731
|
}
|
|
16014
15732
|
return null;
|
|
16015
15733
|
}
|
|
16016
|
-
var init_minimize_locals = (0,
|
|
15734
|
+
var init_minimize_locals = (0, import_chunk_ABYVSU2C.__esm)({
|
|
16017
15735
|
"src/type-flow/minimize-locals.ts"() {
|
|
16018
15736
|
"use strict";
|
|
16019
15737
|
init_api();
|
|
16020
|
-
init_ast();
|
|
15738
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
16021
15739
|
init_control_flow();
|
|
16022
15740
|
init_type_flow();
|
|
16023
15741
|
init_variable_renamer();
|
|
@@ -16055,7 +15773,7 @@ function sizeBasedPRE(state, func) {
|
|
|
16055
15773
|
}
|
|
16056
15774
|
const nodeMap = /* @__PURE__ */ new Map();
|
|
16057
15775
|
const declMap = /* @__PURE__ */ new Map();
|
|
16058
|
-
const variableDecl = withLoc(
|
|
15776
|
+
const variableDecl = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
16059
15777
|
{
|
|
16060
15778
|
type: "VariableDeclaration",
|
|
16061
15779
|
declarations: [],
|
|
@@ -16079,10 +15797,10 @@ function sizeBasedPRE(state, func) {
|
|
|
16079
15797
|
declMap.set(decl, name);
|
|
16080
15798
|
const s = candidates.get(decl);
|
|
16081
15799
|
variableDecl.declarations.push(
|
|
16082
|
-
withLoc(
|
|
15800
|
+
(0, import_chunk_MBTLUWXR.withLoc)(
|
|
16083
15801
|
{
|
|
16084
15802
|
type: "VariableDeclarator",
|
|
16085
|
-
id: withLoc({ type: "Identifier", name }, variableDecl),
|
|
15803
|
+
id: (0, import_chunk_MBTLUWXR.withLoc)({ type: "Identifier", name }, variableDecl),
|
|
16086
15804
|
kind: "var"
|
|
16087
15805
|
},
|
|
16088
15806
|
variableDecl
|
|
@@ -16141,7 +15859,7 @@ function buildPREGraph(state, func) {
|
|
|
16141
15859
|
const event = block.events[i];
|
|
16142
15860
|
switch (event.type) {
|
|
16143
15861
|
case "ref":
|
|
16144
|
-
if ((0,
|
|
15862
|
+
if ((0, import_chunk_PVBIKZYZ.some)(
|
|
16145
15863
|
event.decl,
|
|
16146
15864
|
(decl) => decl.type === "Literal" || decl.type === "VariableDeclarator" && decl.node.kind === "const"
|
|
16147
15865
|
)) {
|
|
@@ -16159,7 +15877,7 @@ function buildPREGraph(state, func) {
|
|
|
16159
15877
|
defs.add(event.decl);
|
|
16160
15878
|
break;
|
|
16161
15879
|
case "mod":
|
|
16162
|
-
if (event.callees && (0,
|
|
15880
|
+
if (event.callees && (0, import_chunk_PVBIKZYZ.every)(event.callees, (callee) => callee.info === false)) {
|
|
16163
15881
|
block.events.splice(i, 1);
|
|
16164
15882
|
break;
|
|
16165
15883
|
}
|
|
@@ -16398,7 +16116,7 @@ function computeAttributes(state, head) {
|
|
|
16398
16116
|
}
|
|
16399
16117
|
case "mod": {
|
|
16400
16118
|
curState.forEach((candidates, decls) => {
|
|
16401
|
-
if ((0,
|
|
16119
|
+
if ((0, import_chunk_PVBIKZYZ.some)(
|
|
16402
16120
|
decls,
|
|
16403
16121
|
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && candidates.live && (!event.callees || event.callees.some(
|
|
16404
16122
|
(callee) => functionMayModify(state, callee, decl)
|
|
@@ -16511,14 +16229,14 @@ function computeAttributes(state, head) {
|
|
|
16511
16229
|
}
|
|
16512
16230
|
function applyReplacements(func, nodeMap, declMap) {
|
|
16513
16231
|
const ident = (name, node) => {
|
|
16514
|
-
return withLoc({ type: "Identifier", name }, node);
|
|
16232
|
+
return (0, import_chunk_MBTLUWXR.withLoc)({ type: "Identifier", name }, node);
|
|
16515
16233
|
};
|
|
16516
16234
|
const pendingMap = /* @__PURE__ */ new Map();
|
|
16517
16235
|
const stmtStack = [func];
|
|
16518
|
-
traverseAst(
|
|
16236
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(
|
|
16519
16237
|
func,
|
|
16520
16238
|
(node) => {
|
|
16521
|
-
if (isStatement(node)) {
|
|
16239
|
+
if ((0, import_chunk_MBTLUWXR.isStatement)(node)) {
|
|
16522
16240
|
stmtStack.push(node);
|
|
16523
16241
|
}
|
|
16524
16242
|
},
|
|
@@ -16565,7 +16283,7 @@ function applyReplacements(func, nodeMap, declMap) {
|
|
|
16565
16283
|
);
|
|
16566
16284
|
}
|
|
16567
16285
|
const id = ident(name, target);
|
|
16568
|
-
const assign = withLoc(
|
|
16286
|
+
const assign = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
16569
16287
|
{
|
|
16570
16288
|
type: "AssignmentExpression",
|
|
16571
16289
|
left: target,
|
|
@@ -16579,7 +16297,7 @@ function applyReplacements(func, nodeMap, declMap) {
|
|
|
16579
16297
|
} else {
|
|
16580
16298
|
node.argument = id;
|
|
16581
16299
|
}
|
|
16582
|
-
return withLoc(
|
|
16300
|
+
return (0, import_chunk_MBTLUWXR.withLoc)(
|
|
16583
16301
|
{ type: "SequenceExpression", expressions: [node, assign] },
|
|
16584
16302
|
node
|
|
16585
16303
|
);
|
|
@@ -16628,15 +16346,15 @@ function applyReplacements(func, nodeMap, declMap) {
|
|
|
16628
16346
|
`Missing id for mod event for "${declFullName(decl)}"`
|
|
16629
16347
|
);
|
|
16630
16348
|
}
|
|
16631
|
-
const rhs = withLocDeep(event.id, locNode, locNode);
|
|
16349
|
+
const rhs = (0, import_chunk_MBTLUWXR.withLocDeep)(event.id, locNode, locNode);
|
|
16632
16350
|
rhs.end = rhs.start;
|
|
16633
16351
|
if (rhs.loc) {
|
|
16634
16352
|
rhs.loc.end = rhs.loc.start;
|
|
16635
16353
|
}
|
|
16636
|
-
const insertion = withLoc(
|
|
16354
|
+
const insertion = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
16637
16355
|
{
|
|
16638
16356
|
type: "ExpressionStatement",
|
|
16639
|
-
expression: withLoc(
|
|
16357
|
+
expression: (0, import_chunk_MBTLUWXR.withLoc)(
|
|
16640
16358
|
{
|
|
16641
16359
|
type: "AssignmentExpression",
|
|
16642
16360
|
left: ident(name, rhs),
|
|
@@ -16678,16 +16396,16 @@ function applyReplacements(func, nodeMap, declMap) {
|
|
|
16678
16396
|
);
|
|
16679
16397
|
}
|
|
16680
16398
|
var logging2, LocalRefCost;
|
|
16681
|
-
var init_pre = (0,
|
|
16399
|
+
var init_pre = (0, import_chunk_ABYVSU2C.__esm)({
|
|
16682
16400
|
"src/pre.ts"() {
|
|
16683
16401
|
"use strict";
|
|
16684
16402
|
init_api();
|
|
16685
|
-
init_ast();
|
|
16403
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
16686
16404
|
init_control_flow();
|
|
16687
16405
|
init_data_flow();
|
|
16688
16406
|
init_function_info();
|
|
16689
16407
|
init_minimize_locals();
|
|
16690
|
-
(0,
|
|
16408
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
16691
16409
|
logging2 = false;
|
|
16692
16410
|
LocalRefCost = 2;
|
|
16693
16411
|
}
|
|
@@ -16801,9 +16519,9 @@ function minimizeModules(ast, state) {
|
|
|
16801
16519
|
delete repl.computed;
|
|
16802
16520
|
});
|
|
16803
16521
|
mappedNames.forEach((name, module2) => {
|
|
16804
|
-
const id = makeScopedName(module2.fullName.slice(2));
|
|
16805
|
-
const as = name !== (id.type === "Identifier" ? id : id.property).name && makeIdentifier(name);
|
|
16806
|
-
const using = withLocDeep(
|
|
16522
|
+
const id = (0, import_chunk_MBTLUWXR.makeScopedName)(module2.fullName.slice(2));
|
|
16523
|
+
const as = name !== (id.type === "Identifier" ? id : id.property).name && (0, import_chunk_MBTLUWXR.makeIdentifier)(name);
|
|
16524
|
+
const using = (0, import_chunk_MBTLUWXR.withLocDeep)(
|
|
16807
16525
|
as ? { type: "Using", id, as } : { type: "Using", id },
|
|
16808
16526
|
ast,
|
|
16809
16527
|
false,
|
|
@@ -16867,11 +16585,11 @@ function isImportCandidate(module2, stack) {
|
|
|
16867
16585
|
);
|
|
16868
16586
|
});
|
|
16869
16587
|
}
|
|
16870
|
-
var init_minimize_modules = (0,
|
|
16588
|
+
var init_minimize_modules = (0, import_chunk_ABYVSU2C.__esm)({
|
|
16871
16589
|
"src/type-flow/minimize-modules.ts"() {
|
|
16872
16590
|
"use strict";
|
|
16873
16591
|
init_api();
|
|
16874
|
-
init_ast();
|
|
16592
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
16875
16593
|
}
|
|
16876
16594
|
});
|
|
16877
16595
|
function beforeEvaluate(istate, node) {
|
|
@@ -16882,7 +16600,7 @@ function beforeEvaluate(istate, node) {
|
|
|
16882
16600
|
if (expression.embeddedEffects) {
|
|
16883
16601
|
istate.stack.push(expression);
|
|
16884
16602
|
} else {
|
|
16885
|
-
const rep = withLoc(
|
|
16603
|
+
const rep = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
16886
16604
|
{ type: "Literal", value: null, raw: "null" },
|
|
16887
16605
|
node,
|
|
16888
16606
|
node
|
|
@@ -16923,7 +16641,7 @@ function beforeEvaluate(istate, node) {
|
|
|
16923
16641
|
}
|
|
16924
16642
|
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) {
|
|
16925
16643
|
if (consequent.value.type === 2) {
|
|
16926
|
-
test.node = wrap(
|
|
16644
|
+
test.node = (0, import_chunk_MBTLUWXR.wrap)(
|
|
16927
16645
|
{
|
|
16928
16646
|
type: "UnaryExpression",
|
|
16929
16647
|
operator: "!",
|
|
@@ -16945,7 +16663,7 @@ function beforeEvaluate(istate, node) {
|
|
|
16945
16663
|
}
|
|
16946
16664
|
const test = popIstate(istate, node.test);
|
|
16947
16665
|
if (!node.alternate && node.consequent.type === "BlockStatement" && !node.consequent.body.length) {
|
|
16948
|
-
const ret = withLoc(node.consequent, node.test, node.test);
|
|
16666
|
+
const ret = (0, import_chunk_MBTLUWXR.withLoc)(node.consequent, node.test, node.test);
|
|
16949
16667
|
const u = test.embeddedEffects && unused(istate.state, node.test);
|
|
16950
16668
|
if (u) {
|
|
16951
16669
|
node.consequent.body = u;
|
|
@@ -16958,7 +16676,7 @@ function beforeEvaluate(istate, node) {
|
|
|
16958
16676
|
if (!test.embeddedEffects) {
|
|
16959
16677
|
return rep;
|
|
16960
16678
|
}
|
|
16961
|
-
const estmt = wrap(
|
|
16679
|
+
const estmt = (0, import_chunk_MBTLUWXR.wrap)(
|
|
16962
16680
|
{ type: "ExpressionStatement", expression: node.test },
|
|
16963
16681
|
node.loc
|
|
16964
16682
|
);
|
|
@@ -16995,11 +16713,11 @@ function beforeEvaluate(istate, node) {
|
|
|
16995
16713
|
const [arg] = istate.stack.slice(-1);
|
|
16996
16714
|
if ((arg.value.type & 120) === arg.value.type && arg.value.value == null) {
|
|
16997
16715
|
const leftType = { type: 8, value: 0 };
|
|
16998
|
-
const rep = withLoc(
|
|
16716
|
+
const rep = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
16999
16717
|
{
|
|
17000
16718
|
type: "BinaryExpression",
|
|
17001
16719
|
operator: "-",
|
|
17002
|
-
left: withLoc(mcExprFromType(leftType), node.argument, false),
|
|
16720
|
+
left: (0, import_chunk_MBTLUWXR.withLoc)(mcExprFromType(leftType), node.argument, false),
|
|
17003
16721
|
right: node.argument
|
|
17004
16722
|
},
|
|
17005
16723
|
node
|
|
@@ -17021,8 +16739,8 @@ function beforeEvaluate(istate, node) {
|
|
|
17021
16739
|
break;
|
|
17022
16740
|
}
|
|
17023
16741
|
const id = node.right.argument;
|
|
17024
|
-
if ((0,
|
|
17025
|
-
if (hasProperty(m.decls, id.name))
|
|
16742
|
+
if ((0, import_chunk_PVBIKZYZ.every)(left.value.value, (m) => {
|
|
16743
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(m.decls, id.name))
|
|
17026
16744
|
return false;
|
|
17027
16745
|
return istate.state.lookup({
|
|
17028
16746
|
type: "MemberExpression",
|
|
@@ -17033,7 +16751,7 @@ function beforeEvaluate(istate, node) {
|
|
|
17033
16751
|
})) {
|
|
17034
16752
|
popIstate(istate, node.right);
|
|
17035
16753
|
popIstate(istate, node.left);
|
|
17036
|
-
const rep = wrap(
|
|
16754
|
+
const rep = (0, import_chunk_MBTLUWXR.wrap)(
|
|
17037
16755
|
{ type: "Literal", value: false, raw: "false" },
|
|
17038
16756
|
node.loc
|
|
17039
16757
|
);
|
|
@@ -17150,7 +16868,7 @@ function beforeEvaluate(istate, node) {
|
|
|
17150
16868
|
if (selfAssign) {
|
|
17151
16869
|
popIstate(istate, node.right);
|
|
17152
16870
|
popIstate(istate, node.left);
|
|
17153
|
-
const rep = withLoc(
|
|
16871
|
+
const rep = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
17154
16872
|
{ type: "Literal", value: null, raw: "null" },
|
|
17155
16873
|
node,
|
|
17156
16874
|
node
|
|
@@ -17172,13 +16890,13 @@ function beforeEvaluate(istate, node) {
|
|
|
17172
16890
|
return null;
|
|
17173
16891
|
}
|
|
17174
16892
|
function afterEvaluate(istate, node) {
|
|
17175
|
-
if (isExpression(node) && node.type !== "Literal") {
|
|
16893
|
+
if ((0, import_chunk_MBTLUWXR.isExpression)(node) && node.type !== "Literal") {
|
|
17176
16894
|
const top = istate.stack[istate.stack.length - 1];
|
|
17177
16895
|
if (!top.embeddedEffects && hasValue(top.value)) {
|
|
17178
16896
|
const rep = mcExprFromType(top.value);
|
|
17179
16897
|
if (rep) {
|
|
17180
16898
|
top.node = rep;
|
|
17181
|
-
return withLoc(rep, node, node);
|
|
16899
|
+
return (0, import_chunk_MBTLUWXR.withLoc)(rep, node, node);
|
|
17182
16900
|
}
|
|
17183
16901
|
}
|
|
17184
16902
|
}
|
|
@@ -17290,7 +17008,7 @@ function tryCommuteAndAssociate(istate, node) {
|
|
|
17290
17008
|
switch (node.operator) {
|
|
17291
17009
|
case "-":
|
|
17292
17010
|
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) {
|
|
17293
|
-
const rep = withLoc(
|
|
17011
|
+
const rep = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
17294
17012
|
{
|
|
17295
17013
|
type: "UnaryExpression",
|
|
17296
17014
|
operator: "~",
|
|
@@ -17337,11 +17055,11 @@ function tryReAssociate(istate, node, left, right) {
|
|
|
17337
17055
|
if (node.left.type !== "BinaryExpression" || node.left.operator !== node.operator && !(node.operator === "+" && node.left.operator === "-") && !(node.operator === "-" && node.left.operator === "+")) {
|
|
17338
17056
|
return false;
|
|
17339
17057
|
}
|
|
17340
|
-
let leftLit = getLiteralNode(node.left.right);
|
|
17058
|
+
let leftLit = (0, import_chunk_MBTLUWXR.getLiteralNode)(node.left.right);
|
|
17341
17059
|
if (!leftLit) {
|
|
17342
17060
|
if (node.left.operator !== "-")
|
|
17343
17061
|
return false;
|
|
17344
|
-
leftLit = getLiteralNode(node.left.left);
|
|
17062
|
+
leftLit = (0, import_chunk_MBTLUWXR.getLiteralNode)(node.left.left);
|
|
17345
17063
|
if (!leftLit)
|
|
17346
17064
|
return false;
|
|
17347
17065
|
const leftLeft = evaluate(istate, leftLit);
|
|
@@ -17409,7 +17127,7 @@ function tryReAssociate(istate, node, left, right) {
|
|
|
17409
17127
|
return false;
|
|
17410
17128
|
}
|
|
17411
17129
|
if (node.right.type === "BinaryExpression" && (node.right.operator === node.operator || (node.operator === "+" || node.operator === "-") && (node.right.operator === "+" || node.right.operator === "-"))) {
|
|
17412
|
-
const rr = getLiteralNode(node.right.right);
|
|
17130
|
+
const rr = (0, import_chunk_MBTLUWXR.getLiteralNode)(node.right.right);
|
|
17413
17131
|
if (!rr)
|
|
17414
17132
|
return false;
|
|
17415
17133
|
const rightRight = evaluate(istate, rr);
|
|
@@ -17461,13 +17179,13 @@ function tryDeEnumerate(istate, node, elem) {
|
|
|
17461
17179
|
}
|
|
17462
17180
|
return null;
|
|
17463
17181
|
}
|
|
17464
|
-
var init_optimize = (0,
|
|
17182
|
+
var init_optimize = (0, import_chunk_ABYVSU2C.__esm)({
|
|
17465
17183
|
"src/type-flow/optimize.ts"() {
|
|
17466
17184
|
"use strict";
|
|
17467
|
-
init_ast();
|
|
17185
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
17468
17186
|
init_inliner();
|
|
17469
17187
|
init_type_flow();
|
|
17470
|
-
(0,
|
|
17188
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
17471
17189
|
init_interp();
|
|
17472
17190
|
init_interp_binary();
|
|
17473
17191
|
init_types();
|
|
@@ -17499,7 +17217,7 @@ function cleanupUnusedVars(state, node) {
|
|
|
17499
17217
|
const stack = [];
|
|
17500
17218
|
const activeRemove = {};
|
|
17501
17219
|
let changes = false;
|
|
17502
|
-
traverseAst(
|
|
17220
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(
|
|
17503
17221
|
node,
|
|
17504
17222
|
(node2) => {
|
|
17505
17223
|
switch (node2.type) {
|
|
@@ -17520,7 +17238,7 @@ function cleanupUnusedVars(state, node) {
|
|
|
17520
17238
|
case "VariableDeclaration": {
|
|
17521
17239
|
node2.declarations.forEach((decl, i) => {
|
|
17522
17240
|
const name = variableDeclarationName(decl.id);
|
|
17523
|
-
if (hasProperty(toRemove, name)) {
|
|
17241
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(toRemove, name)) {
|
|
17524
17242
|
activeRemove[name] = toRemove[name];
|
|
17525
17243
|
const info = varDeclarations.get(node2);
|
|
17526
17244
|
if (info) {
|
|
@@ -17537,11 +17255,11 @@ function cleanupUnusedVars(state, node) {
|
|
|
17537
17255
|
}
|
|
17538
17256
|
case "ExpressionStatement":
|
|
17539
17257
|
if (node2.expression.type === "AssignmentExpression") {
|
|
17540
|
-
if (node2.expression.left.type === "Identifier" && hasProperty(activeRemove, node2.expression.left.name)) {
|
|
17258
|
+
if (node2.expression.left.type === "Identifier" && (0, import_chunk_MBTLUWXR.hasProperty)(activeRemove, node2.expression.left.name)) {
|
|
17541
17259
|
changes = true;
|
|
17542
17260
|
return unused(state, node2.expression.right);
|
|
17543
17261
|
}
|
|
17544
|
-
} else if (node2.expression.type === "UpdateExpression" && node2.expression.argument.type === "Identifier" && hasProperty(activeRemove, node2.expression.argument.name)) {
|
|
17262
|
+
} else if (node2.expression.type === "UpdateExpression" && node2.expression.argument.type === "Identifier" && (0, import_chunk_MBTLUWXR.hasProperty)(activeRemove, node2.expression.argument.name)) {
|
|
17545
17263
|
return false;
|
|
17546
17264
|
}
|
|
17547
17265
|
break;
|
|
@@ -17549,7 +17267,7 @@ function cleanupUnusedVars(state, node) {
|
|
|
17549
17267
|
for (let i = node2.expressions.length; i--; ) {
|
|
17550
17268
|
const expr = node2.expressions[i];
|
|
17551
17269
|
if (expr.type === "AssignmentExpression") {
|
|
17552
|
-
if (expr.left.type === "Identifier" && hasProperty(activeRemove, expr.left.name)) {
|
|
17270
|
+
if (expr.left.type === "Identifier" && (0, import_chunk_MBTLUWXR.hasProperty)(activeRemove, expr.left.name)) {
|
|
17553
17271
|
const rep = unused(state, expr.right);
|
|
17554
17272
|
if (!rep.length) {
|
|
17555
17273
|
changes = true;
|
|
@@ -17559,7 +17277,7 @@ function cleanupUnusedVars(state, node) {
|
|
|
17559
17277
|
expr.operator = "=";
|
|
17560
17278
|
}
|
|
17561
17279
|
}
|
|
17562
|
-
} else if (expr.type === "UpdateExpression" && expr.argument.type === "Identifier" && hasProperty(activeRemove, expr.argument.name)) {
|
|
17280
|
+
} else if (expr.type === "UpdateExpression" && expr.argument.type === "Identifier" && (0, import_chunk_MBTLUWXR.hasProperty)(activeRemove, expr.argument.name)) {
|
|
17563
17281
|
changes = true;
|
|
17564
17282
|
node2.expressions.splice(i, 1);
|
|
17565
17283
|
}
|
|
@@ -17576,7 +17294,7 @@ function cleanupUnusedVars(state, node) {
|
|
|
17576
17294
|
const i = info.indices[ii];
|
|
17577
17295
|
const vdecl = decl.declarations[i];
|
|
17578
17296
|
const name = variableDeclarationName(vdecl.id);
|
|
17579
|
-
if (hasProperty(activeRemove, name)) {
|
|
17297
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(activeRemove, name)) {
|
|
17580
17298
|
const rep = vdecl.init ? unused(state, vdecl.init) : [];
|
|
17581
17299
|
if (rep.length) {
|
|
17582
17300
|
if ((state.sdkVersion || 0) < 4001007 && rep.find(
|
|
@@ -17634,11 +17352,11 @@ function cleanupUnusedVars(state, node) {
|
|
|
17634
17352
|
});
|
|
17635
17353
|
return changes;
|
|
17636
17354
|
}
|
|
17637
|
-
var init_unused_exprs = (0,
|
|
17355
|
+
var init_unused_exprs = (0, import_chunk_ABYVSU2C.__esm)({
|
|
17638
17356
|
"src/unused-exprs.ts"() {
|
|
17639
17357
|
"use strict";
|
|
17640
17358
|
init_api();
|
|
17641
|
-
init_ast();
|
|
17359
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
17642
17360
|
init_inliner();
|
|
17643
17361
|
}
|
|
17644
17362
|
});
|
|
@@ -17662,7 +17380,7 @@ function collectDeclarationsByName(state) {
|
|
|
17662
17380
|
}
|
|
17663
17381
|
});
|
|
17664
17382
|
if (keyed.length) {
|
|
17665
|
-
if (!hasProperty(allDecls, key)) {
|
|
17383
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(allDecls, key)) {
|
|
17666
17384
|
allDecls[key] = keyed;
|
|
17667
17385
|
} else {
|
|
17668
17386
|
allDecls[key].push(...keyed);
|
|
@@ -17707,7 +17425,7 @@ function collectClassInfo(state) {
|
|
|
17707
17425
|
scls.forEach((c) => {
|
|
17708
17426
|
c.decls && Object.values(c.decls).forEach((funcs) => {
|
|
17709
17427
|
funcs.forEach((f) => {
|
|
17710
|
-
if (f.type === "FunctionDeclaration" && hasProperty(cls.decls, f.name)) {
|
|
17428
|
+
if (f.type === "FunctionDeclaration" && (0, import_chunk_MBTLUWXR.hasProperty)(cls.decls, f.name)) {
|
|
17711
17429
|
f.node.hasOverride = true;
|
|
17712
17430
|
}
|
|
17713
17431
|
});
|
|
@@ -17752,7 +17470,7 @@ function getFileASTs(fnMap) {
|
|
|
17752
17470
|
options.mss = value2.barrel;
|
|
17753
17471
|
}
|
|
17754
17472
|
try {
|
|
17755
|
-
value2.ast =
|
|
17473
|
+
value2.ast = import_prettier_plugin_monkeyc2.default.parsers.monkeyc.parse(
|
|
17756
17474
|
value2.monkeyCSource,
|
|
17757
17475
|
null,
|
|
17758
17476
|
options
|
|
@@ -17788,7 +17506,7 @@ async function analyze(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17788
17506
|
return drop;
|
|
17789
17507
|
if (attr.argument.type !== "Identifier")
|
|
17790
17508
|
return drop;
|
|
17791
|
-
if (hasProperty(excludeAnnotations, attr.argument.name)) {
|
|
17509
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(excludeAnnotations, attr.argument.name)) {
|
|
17792
17510
|
return true;
|
|
17793
17511
|
}
|
|
17794
17512
|
if (attr.argument.name === "test") {
|
|
@@ -17815,7 +17533,7 @@ async function analyze(fnMap, resourcesMap, manifestXML, config) {
|
|
|
17815
17533
|
scope.info = getApiFunctionInfo(state2, scope);
|
|
17816
17534
|
}
|
|
17817
17535
|
const allFuncs = state2.allFunctions;
|
|
17818
|
-
if (!hasProperty(allFuncs, scope.name)) {
|
|
17536
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(allFuncs, scope.name)) {
|
|
17819
17537
|
allFuncs[scope.name] = [scope];
|
|
17820
17538
|
} else {
|
|
17821
17539
|
allFuncs[scope.name].push(scope);
|
|
@@ -17948,10 +17666,10 @@ function evaluateFunction(istate, func, args) {
|
|
|
17948
17666
|
])
|
|
17949
17667
|
);
|
|
17950
17668
|
let ret = null;
|
|
17951
|
-
const body = args ? cloneDeep(func.body) : func.body;
|
|
17669
|
+
const body = args ? (0, import_chunk_MBTLUWXR.cloneDeep)(func.body) : func.body;
|
|
17952
17670
|
const depth = istate.stack.length;
|
|
17953
17671
|
try {
|
|
17954
|
-
traverseAst(
|
|
17672
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(
|
|
17955
17673
|
body,
|
|
17956
17674
|
(node) => {
|
|
17957
17675
|
switch (node.type) {
|
|
@@ -17974,7 +17692,7 @@ function evaluateFunction(istate, func, args) {
|
|
|
17974
17692
|
case "BlockStatement":
|
|
17975
17693
|
return null;
|
|
17976
17694
|
case "Identifier":
|
|
17977
|
-
if (hasProperty(paramValues, node.name)) {
|
|
17695
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(paramValues, node.name)) {
|
|
17978
17696
|
istate.stack.push(
|
|
17979
17697
|
evaluate(istate, node = paramValues[node.name])
|
|
17980
17698
|
);
|
|
@@ -17999,11 +17717,11 @@ function evaluateFunction(istate, func, args) {
|
|
|
17999
17717
|
}
|
|
18000
17718
|
}
|
|
18001
17719
|
function markFunctionCalled(state, func) {
|
|
18002
|
-
if (!hasProperty(state.calledFunctions, func.id.name)) {
|
|
17720
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(state.calledFunctions, func.id.name)) {
|
|
18003
17721
|
state.calledFunctions[func.id.name] = [func];
|
|
18004
17722
|
return;
|
|
18005
17723
|
}
|
|
18006
|
-
(0,
|
|
17724
|
+
(0, import_chunk_PVBIKZYZ.pushUnique)(state.calledFunctions[func.id.name], func);
|
|
18007
17725
|
}
|
|
18008
17726
|
async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
18009
17727
|
const state = await analyze(
|
|
@@ -18021,7 +17739,7 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18021
17739
|
const optimizeCallHelper = (istate2, call, node) => {
|
|
18022
17740
|
const result = optimizeCall(istate2, call, node);
|
|
18023
17741
|
if (result) {
|
|
18024
|
-
if (isExpression(result)) {
|
|
17742
|
+
if ((0, import_chunk_MBTLUWXR.isExpression)(result)) {
|
|
18025
17743
|
const elem = istate2.stack[istate2.stack.length - 1];
|
|
18026
17744
|
elem.node = result;
|
|
18027
17745
|
if (result.type === "Literal") {
|
|
@@ -18035,7 +17753,7 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18035
17753
|
};
|
|
18036
17754
|
const topLocals = () => state.localsStack[state.localsStack.length - 1];
|
|
18037
17755
|
const checkInherited = (elm, name) => elm.superClass === true || elm.superClass != null && elm.superClass.some(
|
|
18038
|
-
(sc) => hasProperty(sc.decls, name) && sc.decls[name].some(
|
|
17756
|
+
(sc) => (0, import_chunk_MBTLUWXR.hasProperty)(sc.decls, name) && sc.decls[name].some(
|
|
18039
17757
|
(f) => isStateNode(f) && f.type === "FunctionDeclaration" && maybeCalled(state, f.node)
|
|
18040
17758
|
) || sc.superClass && checkInherited(sc, name)
|
|
18041
17759
|
);
|
|
@@ -18063,10 +17781,10 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18063
17781
|
throw new Error(`No parent in lookup of local ${declName2}`);
|
|
18064
17782
|
}
|
|
18065
17783
|
const decls = parent.decls;
|
|
18066
|
-
if (!decls || !hasProperty(decls, declName2)) {
|
|
17784
|
+
if (!decls || !(0, import_chunk_MBTLUWXR.hasProperty)(decls, declName2)) {
|
|
18067
17785
|
throw new Error(`Missing decls in lookup of local ${declName2}`);
|
|
18068
17786
|
}
|
|
18069
|
-
if (hasProperty(decls, name)) {
|
|
17787
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(decls, name)) {
|
|
18070
17788
|
throw new Error(
|
|
18071
17789
|
`While renaming ${declName2} to ${name}, there was already a variable ${name}`
|
|
18072
17790
|
);
|
|
@@ -18131,7 +17849,7 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18131
17849
|
break;
|
|
18132
17850
|
case "Identifier": {
|
|
18133
17851
|
const map2 = topLocals().map;
|
|
18134
|
-
if (hasProperty(map2, node.name)) {
|
|
17852
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(map2, node.name)) {
|
|
18135
17853
|
const name = map2[node.name];
|
|
18136
17854
|
if (typeof name === "string") {
|
|
18137
17855
|
renameIdentifier(node, name);
|
|
@@ -18165,7 +17883,7 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18165
17883
|
if (lhs.type === "Identifier") {
|
|
18166
17884
|
const map2 = topLocals().map;
|
|
18167
17885
|
if (map2) {
|
|
18168
|
-
if (hasProperty(map2, lhs.name)) {
|
|
17886
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(map2, lhs.name)) {
|
|
18169
17887
|
const name = map2[lhs.name];
|
|
18170
17888
|
if (typeof name === "string") {
|
|
18171
17889
|
renameIdentifier(lhs, name);
|
|
@@ -18289,14 +18007,14 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18289
18007
|
}
|
|
18290
18008
|
break;
|
|
18291
18009
|
case "Identifier":
|
|
18292
|
-
if (hasProperty(state.index, node.name)) {
|
|
18010
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(state.index, node.name)) {
|
|
18293
18011
|
state.usedByName[node.name] = true;
|
|
18294
18012
|
}
|
|
18295
18013
|
break;
|
|
18296
18014
|
case "MemberExpression": {
|
|
18297
18015
|
const property = isLookupCandidate(node);
|
|
18298
18016
|
if (property) {
|
|
18299
|
-
if (hasProperty(state.index, property.name)) {
|
|
18017
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(state.index, property.name)) {
|
|
18300
18018
|
state.usedByName[property.name] = true;
|
|
18301
18019
|
}
|
|
18302
18020
|
}
|
|
@@ -18349,7 +18067,7 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18349
18067
|
}
|
|
18350
18068
|
delete decl.init;
|
|
18351
18069
|
results.push(
|
|
18352
|
-
withLoc(
|
|
18070
|
+
(0, import_chunk_MBTLUWXR.withLoc)(
|
|
18353
18071
|
{
|
|
18354
18072
|
...node,
|
|
18355
18073
|
declarations: declarations.slice(j, i)
|
|
@@ -18382,7 +18100,7 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18382
18100
|
if (call) {
|
|
18383
18101
|
let ok = false;
|
|
18384
18102
|
if (node.expression.left.type === "Identifier") {
|
|
18385
|
-
if (hasProperty(topLocals().map, node.expression.left.type)) {
|
|
18103
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(topLocals().map, node.expression.left.type)) {
|
|
18386
18104
|
ok = true;
|
|
18387
18105
|
}
|
|
18388
18106
|
}
|
|
@@ -18402,7 +18120,7 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18402
18120
|
const n = node;
|
|
18403
18121
|
n.type = "AssignmentExpression";
|
|
18404
18122
|
n.left = node.argument;
|
|
18405
|
-
n.right = withLoc(
|
|
18123
|
+
n.right = (0, import_chunk_MBTLUWXR.withLoc)(
|
|
18406
18124
|
mcExprFromType({ type: 8, value: 1 }),
|
|
18407
18125
|
n.left
|
|
18408
18126
|
);
|
|
@@ -18432,7 +18150,7 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18432
18150
|
collectNamespaces(f.ast, state);
|
|
18433
18151
|
});
|
|
18434
18152
|
const cleanupAll = () => Object.values(fnMap).reduce((changes, f) => {
|
|
18435
|
-
traverseAst(f.ast, void 0, (node) => {
|
|
18153
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(f.ast, void 0, (node) => {
|
|
18436
18154
|
const ret = cleanup(state, node, f.ast);
|
|
18437
18155
|
if (ret === false) {
|
|
18438
18156
|
changes = true;
|
|
@@ -18473,7 +18191,7 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18473
18191
|
state.diagnostics = state.inlineDiagnostics;
|
|
18474
18192
|
} else {
|
|
18475
18193
|
Object.entries(state.inlineDiagnostics).forEach(([key, diags]) => {
|
|
18476
|
-
if (!hasProperty(state.diagnostics, key)) {
|
|
18194
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(state.diagnostics, key)) {
|
|
18477
18195
|
state.diagnostics[key] = diags;
|
|
18478
18196
|
} else {
|
|
18479
18197
|
state.diagnostics[key].push(...diags);
|
|
@@ -18487,13 +18205,13 @@ async function optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config) {
|
|
|
18487
18205
|
pragmaChecker(state, f.ast, state.diagnostics?.[name]);
|
|
18488
18206
|
}
|
|
18489
18207
|
});
|
|
18490
|
-
return state.diagnostics;
|
|
18208
|
+
return { diagnostics: state.diagnostics, sdkVersion: state.sdkVersion };
|
|
18491
18209
|
}
|
|
18492
18210
|
function maybeCalled(state, func) {
|
|
18493
18211
|
if (!func.body) {
|
|
18494
18212
|
return true;
|
|
18495
18213
|
}
|
|
18496
|
-
if (hasProperty(state.exposed, func.id.name))
|
|
18214
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(state.exposed, func.id.name))
|
|
18497
18215
|
return true;
|
|
18498
18216
|
if (func.attrs && func.attrs.attributes && func.attrs.attributes.elements.some((attr) => {
|
|
18499
18217
|
if (attr.type !== "UnaryExpression")
|
|
@@ -18504,7 +18222,7 @@ function maybeCalled(state, func) {
|
|
|
18504
18222
|
})) {
|
|
18505
18223
|
return true;
|
|
18506
18224
|
}
|
|
18507
|
-
if (hasProperty(state.calledFunctions, func.id.name)) {
|
|
18225
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(state.calledFunctions, func.id.name)) {
|
|
18508
18226
|
return state.calledFunctions[func.id.name].find((f) => f === func) !== null;
|
|
18509
18227
|
}
|
|
18510
18228
|
return false;
|
|
@@ -18517,14 +18235,14 @@ function cleanup(state, node, ast) {
|
|
|
18517
18235
|
case "EnumStringBody":
|
|
18518
18236
|
if (node.members.every((m) => {
|
|
18519
18237
|
const name = "name" in m ? m.name : m.id.name;
|
|
18520
|
-
return hasProperty(state.index, name) && !hasProperty(state.exposed, name) && !hasProperty(state.usedByName, name);
|
|
18238
|
+
return (0, import_chunk_MBTLUWXR.hasProperty)(state.index, name) && !(0, import_chunk_MBTLUWXR.hasProperty)(state.exposed, name) && !(0, import_chunk_MBTLUWXR.hasProperty)(state.usedByName, name);
|
|
18521
18239
|
})) {
|
|
18522
18240
|
node.enumType = [
|
|
18523
18241
|
...new Set(
|
|
18524
18242
|
node.members.map((m) => {
|
|
18525
18243
|
if (!("init" in m))
|
|
18526
18244
|
return "Number";
|
|
18527
|
-
const [node2, type] = getNodeValue(m.init);
|
|
18245
|
+
const [node2, type] = (0, import_chunk_MBTLUWXR.getNodeValue)(m.init);
|
|
18528
18246
|
if (!node2) {
|
|
18529
18247
|
throw new Error("Failed to get type for eliminated enum");
|
|
18530
18248
|
}
|
|
@@ -18543,7 +18261,7 @@ function cleanup(state, node, ast) {
|
|
|
18543
18261
|
throw new Error("Missing enumType on optimized enum");
|
|
18544
18262
|
}
|
|
18545
18263
|
state.removeNodeComments(node, ast);
|
|
18546
|
-
return withLocDeep(
|
|
18264
|
+
return (0, import_chunk_MBTLUWXR.withLocDeep)(
|
|
18547
18265
|
{
|
|
18548
18266
|
type: "TypedefDeclaration",
|
|
18549
18267
|
id: node.id,
|
|
@@ -18566,7 +18284,7 @@ function cleanup(state, node, ast) {
|
|
|
18566
18284
|
break;
|
|
18567
18285
|
case "VariableDeclarator": {
|
|
18568
18286
|
const name = variableDeclarationName(node.id);
|
|
18569
|
-
return !hasProperty(state.index, name) || hasProperty(state.exposed, name) || hasProperty(state.usedByName, name) ? null : false;
|
|
18287
|
+
return !(0, import_chunk_MBTLUWXR.hasProperty)(state.index, name) || (0, import_chunk_MBTLUWXR.hasProperty)(state.exposed, name) || (0, import_chunk_MBTLUWXR.hasProperty)(state.usedByName, name) ? null : false;
|
|
18570
18288
|
}
|
|
18571
18289
|
case "VariableDeclaration": {
|
|
18572
18290
|
if (!node.declarations.length) {
|
|
@@ -18608,7 +18326,7 @@ function optimizeCall(istate, node, context) {
|
|
|
18608
18326
|
if (!callees || !callees.length) {
|
|
18609
18327
|
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;
|
|
18610
18328
|
if (n) {
|
|
18611
|
-
if (hasProperty(state.allFunctions, n)) {
|
|
18329
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(state.allFunctions, n)) {
|
|
18612
18330
|
if (state.currentFunction) {
|
|
18613
18331
|
recordCalledFuncs(state.currentFunction, state.allFunctions[n]);
|
|
18614
18332
|
}
|
|
@@ -18626,11 +18344,11 @@ function optimizeCall(istate, node, context) {
|
|
|
18626
18344
|
}
|
|
18627
18345
|
if (callees.length === 1 && callees[0].type === "FunctionDeclaration") {
|
|
18628
18346
|
const callee = callees[0].node;
|
|
18629
|
-
if (!context && callee.optimizable && !callee.hasOverride && node.arguments.every((n) => getNodeValue(n)[0] !== null)) {
|
|
18347
|
+
if (!context && callee.optimizable && !callee.hasOverride && node.arguments.every((n) => (0, import_chunk_MBTLUWXR.getNodeValue)(n)[0] !== null)) {
|
|
18630
18348
|
const ret = evaluateFunction(istate, callee, node.arguments);
|
|
18631
18349
|
if (ret) {
|
|
18632
18350
|
inlineDiagnostic(state, callees[0], node, null);
|
|
18633
|
-
return withLoc(ret, node, node);
|
|
18351
|
+
return (0, import_chunk_MBTLUWXR.withLoc)(ret, node, node);
|
|
18634
18352
|
}
|
|
18635
18353
|
}
|
|
18636
18354
|
if (shouldInline(state, callees[0], node, context)) {
|
|
@@ -18643,11 +18361,11 @@ function optimizeCall(istate, node, context) {
|
|
|
18643
18361
|
callees.forEach((c) => markFunctionCalled(state, c.node));
|
|
18644
18362
|
return null;
|
|
18645
18363
|
}
|
|
18646
|
-
var init_mc_rewrite = (0,
|
|
18364
|
+
var init_mc_rewrite = (0, import_chunk_ABYVSU2C.__esm)({
|
|
18647
18365
|
"src/mc-rewrite.ts"() {
|
|
18648
18366
|
"use strict";
|
|
18649
18367
|
init_api();
|
|
18650
|
-
init_ast();
|
|
18368
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
18651
18369
|
init_function_info();
|
|
18652
18370
|
init_inliner();
|
|
18653
18371
|
init_optimizer_types();
|
|
@@ -18661,12 +18379,12 @@ var init_mc_rewrite = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
18661
18379
|
init_sub_type();
|
|
18662
18380
|
init_types();
|
|
18663
18381
|
init_unused_exprs();
|
|
18664
|
-
(0,
|
|
18382
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
18665
18383
|
init_variable_renamer();
|
|
18666
18384
|
}
|
|
18667
18385
|
});
|
|
18668
18386
|
var negativeFixups;
|
|
18669
|
-
var init_negative_fixups = (0,
|
|
18387
|
+
var init_negative_fixups = (0, import_chunk_ABYVSU2C.__esm)({
|
|
18670
18388
|
"src/negative-fixups.ts"() {
|
|
18671
18389
|
"use strict";
|
|
18672
18390
|
negativeFixups = [
|
|
@@ -18867,8 +18585,8 @@ function add_resources_to_ast(state, ast, resources, manifestXML) {
|
|
|
18867
18585
|
loc: outerLoc
|
|
18868
18586
|
});
|
|
18869
18587
|
const makeImport = (type, module2, as) => {
|
|
18870
|
-
const id = makeScopedName(module2);
|
|
18871
|
-
return type === "Using" && as ? { type, id, as: makeIdentifier(as) } : { type, id };
|
|
18588
|
+
const id = (0, import_chunk_MBTLUWXR.makeScopedName)(module2);
|
|
18589
|
+
return type === "Using" && as ? { type, id, as: (0, import_chunk_MBTLUWXR.makeIdentifier)(as) } : { type, id };
|
|
18872
18590
|
};
|
|
18873
18591
|
ast.body.push(
|
|
18874
18592
|
makeImport("ImportModule", "Toybox.Lang"),
|
|
@@ -18904,7 +18622,7 @@ function add_resources_to_ast(state, ast, resources, manifestXML) {
|
|
|
18904
18622
|
visit_resources(rez2.body.elements, null, (e, s) => {
|
|
18905
18623
|
if (!s)
|
|
18906
18624
|
return;
|
|
18907
|
-
if (!hasProperty(rezModules, s))
|
|
18625
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(rezModules, s))
|
|
18908
18626
|
return;
|
|
18909
18627
|
const module2 = rezModules[s];
|
|
18910
18628
|
add_one_resource(state, rez2, module2, e);
|
|
@@ -18928,22 +18646,22 @@ function visit_resource_refs(state, doc, e) {
|
|
|
18928
18646
|
const parseArg = (name, loc, skip) => {
|
|
18929
18647
|
if (name.startsWith("@")) {
|
|
18930
18648
|
name = name.substring(1);
|
|
18931
|
-
loc = adjustLoc(loc, 1, 0);
|
|
18649
|
+
loc = (0, import_chunk_MBTLUWXR.adjustLoc)(loc, 1, 0);
|
|
18932
18650
|
}
|
|
18933
|
-
if (hasProperty(skip, name)) {
|
|
18651
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(skip, name)) {
|
|
18934
18652
|
return;
|
|
18935
18653
|
}
|
|
18936
18654
|
if (/^([-\w_$]+\s*\.\s*)*[-\w_$]+$/.test(name)) {
|
|
18937
|
-
result.push(makeScopedName(name, loc));
|
|
18655
|
+
result.push((0, import_chunk_MBTLUWXR.makeScopedName)(name, loc));
|
|
18938
18656
|
return;
|
|
18939
18657
|
}
|
|
18940
|
-
const startPos = adjustLoc(loc, -1, 0).start;
|
|
18658
|
+
const startPos = (0, import_chunk_MBTLUWXR.adjustLoc)(loc, -1, 0).start;
|
|
18941
18659
|
try {
|
|
18942
|
-
const expr =
|
|
18660
|
+
const expr = import_prettier_plugin_monkeyc3.default.parsers.monkeyc.parse(`(${name})`, null, {
|
|
18943
18661
|
filepath: loc.source || void 0,
|
|
18944
18662
|
singleExpression: true
|
|
18945
18663
|
});
|
|
18946
|
-
traverseAst(expr, (node) => {
|
|
18664
|
+
(0, import_chunk_MBTLUWXR.traverseAst)(expr, (node) => {
|
|
18947
18665
|
if (node.loc) {
|
|
18948
18666
|
node.loc = {
|
|
18949
18667
|
source: node.loc.source,
|
|
@@ -18987,12 +18705,12 @@ function visit_resource_refs(state, doc, e) {
|
|
|
18987
18705
|
elems?.reduce((offset, name) => {
|
|
18988
18706
|
const end = offset + name.length;
|
|
18989
18707
|
if (!/\s/.test(name)) {
|
|
18990
|
-
const base = makeScopedName(`Rez.Styles`);
|
|
18991
|
-
const id2 = makeIdentifier(
|
|
18708
|
+
const base = (0, import_chunk_MBTLUWXR.makeScopedName)(`Rez.Styles`);
|
|
18709
|
+
const id2 = (0, import_chunk_MBTLUWXR.makeIdentifier)(
|
|
18992
18710
|
name,
|
|
18993
|
-
adjustLoc(l, offset, end - dotted.length)
|
|
18711
|
+
(0, import_chunk_MBTLUWXR.adjustLoc)(l, offset, end - dotted.length)
|
|
18994
18712
|
);
|
|
18995
|
-
result.push(makeMemberExpression(withLoc(base, id2, false), id2));
|
|
18713
|
+
result.push((0, import_chunk_MBTLUWXR.makeMemberExpression)((0, import_chunk_MBTLUWXR.withLoc)(base, id2, false), id2));
|
|
18996
18714
|
}
|
|
18997
18715
|
return end;
|
|
18998
18716
|
}, 0);
|
|
@@ -19017,7 +18735,7 @@ function visit_resource_refs(state, doc, e) {
|
|
|
19017
18735
|
case "drawable-list":
|
|
19018
18736
|
case "text-area":
|
|
19019
18737
|
case "label":
|
|
19020
|
-
if (id && hasProperty(drawableSkips, id)) {
|
|
18738
|
+
if (id && (0, import_chunk_MBTLUWXR.hasProperty)(drawableSkips, id)) {
|
|
19021
18739
|
parseArg(dotted, l, drawableSkips[id]);
|
|
19022
18740
|
}
|
|
19023
18741
|
return;
|
|
@@ -19037,7 +18755,7 @@ function visit_resource_refs(state, doc, e) {
|
|
|
19037
18755
|
Object.values(node.attr).forEach((attr) => {
|
|
19038
18756
|
if (!attr || !attr.value.loc)
|
|
19039
18757
|
return;
|
|
19040
|
-
const loc = adjustLoc(attr.value.loc);
|
|
18758
|
+
const loc = (0, import_chunk_MBTLUWXR.adjustLoc)(attr.value.loc);
|
|
19041
18759
|
stringToScopedName(node, attr.name.value, attr.value.value, loc);
|
|
19042
18760
|
});
|
|
19043
18761
|
const content = doc.textContent(node);
|
|
@@ -19046,7 +18764,7 @@ function visit_resource_refs(state, doc, e) {
|
|
|
19046
18764
|
node,
|
|
19047
18765
|
null,
|
|
19048
18766
|
content,
|
|
19049
|
-
locRange(
|
|
18767
|
+
(0, import_chunk_MBTLUWXR.locRange)(
|
|
19050
18768
|
node.children[0].loc,
|
|
19051
18769
|
node.children[node.children.length - 1].loc
|
|
19052
18770
|
)
|
|
@@ -19062,25 +18780,25 @@ function add_one_resource(state, doc, module2, e) {
|
|
|
19062
18780
|
let id;
|
|
19063
18781
|
let func;
|
|
19064
18782
|
const makeVarDecl = (id2, outer) => {
|
|
19065
|
-
const loc = id2 && adjustLoc(id2.value.loc);
|
|
19066
|
-
return wrap(
|
|
18783
|
+
const loc = id2 && (0, import_chunk_MBTLUWXR.adjustLoc)(id2.value.loc);
|
|
18784
|
+
return (0, import_chunk_MBTLUWXR.wrap)(
|
|
19067
18785
|
{
|
|
19068
18786
|
type: "VariableDeclaration",
|
|
19069
18787
|
declarations: [
|
|
19070
|
-
wrap(
|
|
18788
|
+
(0, import_chunk_MBTLUWXR.wrap)(
|
|
19071
18789
|
{
|
|
19072
18790
|
type: "VariableDeclarator",
|
|
19073
18791
|
kind: "var",
|
|
19074
18792
|
id: {
|
|
19075
18793
|
type: "BinaryExpression",
|
|
19076
18794
|
operator: "as",
|
|
19077
|
-
left: makeIdentifier(id2 ? id2.value.value : "*invalid*", loc),
|
|
18795
|
+
left: (0, import_chunk_MBTLUWXR.makeIdentifier)(id2 ? id2.value.value : "*invalid*", loc),
|
|
19078
18796
|
right: {
|
|
19079
18797
|
type: "TypeSpecList",
|
|
19080
18798
|
ts: [
|
|
19081
18799
|
{
|
|
19082
18800
|
type: "TypeSpecPart",
|
|
19083
|
-
name: makeIdentifier("Symbol")
|
|
18801
|
+
name: (0, import_chunk_MBTLUWXR.makeIdentifier)("Symbol")
|
|
19084
18802
|
}
|
|
19085
18803
|
]
|
|
19086
18804
|
}
|
|
@@ -19110,8 +18828,8 @@ function add_one_resource(state, doc, module2, e) {
|
|
|
19110
18828
|
return {
|
|
19111
18829
|
type: "ClassDeclaration",
|
|
19112
18830
|
body: { type: "ClassBody", body: items, loc: e.loc },
|
|
19113
|
-
id: makeIdentifier(id.value.value, loc),
|
|
19114
|
-
superClass: makeScopedName(parent),
|
|
18831
|
+
id: (0, import_chunk_MBTLUWXR.makeIdentifier)(id.value.value, loc),
|
|
18832
|
+
superClass: (0, import_chunk_MBTLUWXR.makeScopedName)(parent),
|
|
19115
18833
|
loc: e.loc
|
|
19116
18834
|
};
|
|
19117
18835
|
};
|
|
@@ -19123,18 +18841,18 @@ function add_one_resource(state, doc, module2, e) {
|
|
|
19123
18841
|
return {
|
|
19124
18842
|
type: "FunctionDeclaration",
|
|
19125
18843
|
body: { type: "BlockStatement", body: items, loc: e.loc },
|
|
19126
|
-
id: makeIdentifier(id.value.value, loc),
|
|
18844
|
+
id: (0, import_chunk_MBTLUWXR.makeIdentifier)(id.value.value, loc),
|
|
19127
18845
|
params: [
|
|
19128
18846
|
{
|
|
19129
18847
|
type: "BinaryExpression",
|
|
19130
18848
|
operator: "as",
|
|
19131
|
-
left: makeIdentifier("dc"),
|
|
18849
|
+
left: (0, import_chunk_MBTLUWXR.makeIdentifier)("dc"),
|
|
19132
18850
|
right: {
|
|
19133
18851
|
type: "TypeSpecList",
|
|
19134
18852
|
ts: [
|
|
19135
18853
|
{
|
|
19136
18854
|
type: "TypeSpecPart",
|
|
19137
|
-
name: makeScopedName("Graphics.Dc")
|
|
18855
|
+
name: (0, import_chunk_MBTLUWXR.makeScopedName)("Graphics.Dc")
|
|
19138
18856
|
}
|
|
19139
18857
|
]
|
|
19140
18858
|
}
|
|
@@ -19149,14 +18867,14 @@ function add_one_resource(state, doc, module2, e) {
|
|
|
19149
18867
|
ts: [
|
|
19150
18868
|
{
|
|
19151
18869
|
type: "TypeSpecPart",
|
|
19152
|
-
name: makeScopedName("$.Toybox.Lang.Array"),
|
|
18870
|
+
name: (0, import_chunk_MBTLUWXR.makeScopedName)("$.Toybox.Lang.Array"),
|
|
19153
18871
|
generics: [
|
|
19154
18872
|
{
|
|
19155
18873
|
type: "TypeSpecList",
|
|
19156
18874
|
ts: [
|
|
19157
18875
|
{
|
|
19158
18876
|
type: "TypeSpecPart",
|
|
19159
|
-
name: makeScopedName("$.Toybox.WatchUi.Drawable")
|
|
18877
|
+
name: (0, import_chunk_MBTLUWXR.makeScopedName)("$.Toybox.WatchUi.Drawable")
|
|
19160
18878
|
}
|
|
19161
18879
|
]
|
|
19162
18880
|
}
|
|
@@ -19213,9 +18931,9 @@ function add_one_resource(state, doc, module2, e) {
|
|
|
19213
18931
|
const elements = visit_resource_refs(state, doc, e);
|
|
19214
18932
|
const startLoc = elements[0]?.loc;
|
|
19215
18933
|
const endLoc = elements[elements.length - 1]?.loc;
|
|
19216
|
-
const init = elements.length ? wrap(
|
|
18934
|
+
const init = elements.length ? (0, import_chunk_MBTLUWXR.wrap)(
|
|
19217
18935
|
{ type: "ArrayExpression", elements },
|
|
19218
|
-
startLoc && endLoc && locRange(startLoc, endLoc)
|
|
18936
|
+
startLoc && endLoc && (0, import_chunk_MBTLUWXR.locRange)(startLoc, endLoc)
|
|
19219
18937
|
) : void 0;
|
|
19220
18938
|
if (!id) {
|
|
19221
18939
|
if (!init)
|
|
@@ -19227,11 +18945,11 @@ function add_one_resource(state, doc, module2, e) {
|
|
|
19227
18945
|
}
|
|
19228
18946
|
}
|
|
19229
18947
|
var drawableSkips;
|
|
19230
|
-
var init_resources = (0,
|
|
18948
|
+
var init_resources = (0, import_chunk_ABYVSU2C.__esm)({
|
|
19231
18949
|
"src/resources.ts"() {
|
|
19232
18950
|
"use strict";
|
|
19233
18951
|
init_api();
|
|
19234
|
-
init_ast();
|
|
18952
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
19235
18953
|
init_sdk_util();
|
|
19236
18954
|
drawableSkips = {
|
|
19237
18955
|
x: { center: true, left: true, right: true, start: true },
|
|
@@ -19431,7 +19149,7 @@ function visitReferences(state, ast, name, defn, callback, includeDefs = false,
|
|
|
19431
19149
|
collectNamespaces(ast, state);
|
|
19432
19150
|
delete state.pre;
|
|
19433
19151
|
}
|
|
19434
|
-
var init_visitor = (0,
|
|
19152
|
+
var init_visitor = (0, import_chunk_ABYVSU2C.__esm)({
|
|
19435
19153
|
"src/visitor.ts"() {
|
|
19436
19154
|
"use strict";
|
|
19437
19155
|
init_api();
|
|
@@ -19466,7 +19184,7 @@ function checkCompilerVersion(version, sdkVer) {
|
|
|
19466
19184
|
return sdkVer <= v2;
|
|
19467
19185
|
}
|
|
19468
19186
|
async function getApiMapping(state, resourcesMap, manifestXML) {
|
|
19469
|
-
const parser =
|
|
19187
|
+
const parser = import_prettier_plugin_monkeyc4.default.parsers.monkeyc;
|
|
19470
19188
|
const sdk = await getSdkPath();
|
|
19471
19189
|
if (state) {
|
|
19472
19190
|
state.sdk = sdk;
|
|
@@ -19504,7 +19222,7 @@ async function getApiMapping(state, resourcesMap, manifestXML) {
|
|
|
19504
19222
|
if (!value2 || value2.type !== "EnumStringMember" && (value2.type !== "VariableDeclarator" || value2.kind !== "const")) {
|
|
19505
19223
|
throw `Negative constant ${fixup} did not refer to a constant`;
|
|
19506
19224
|
}
|
|
19507
|
-
const init = getLiteralNode(value2.init);
|
|
19225
|
+
const init = (0, import_chunk_MBTLUWXR.getLiteralNode)(value2.init);
|
|
19508
19226
|
if (!init || init.type !== "Literal") {
|
|
19509
19227
|
throw `Negative constant ${fixup} was not a Literal`;
|
|
19510
19228
|
}
|
|
@@ -19523,7 +19241,7 @@ async function getApiMapping(state, resourcesMap, manifestXML) {
|
|
|
19523
19241
|
}
|
|
19524
19242
|
}
|
|
19525
19243
|
function isStateNode(node) {
|
|
19526
|
-
return hasProperty(node, "node");
|
|
19244
|
+
return (0, import_chunk_MBTLUWXR.hasProperty)(node, "node");
|
|
19527
19245
|
}
|
|
19528
19246
|
function variableDeclarationName(node) {
|
|
19529
19247
|
return ("left" in node ? node.left : node).name;
|
|
@@ -19559,7 +19277,7 @@ function checkOne(state, ns, decls, node) {
|
|
|
19559
19277
|
}
|
|
19560
19278
|
return cls.superClass.reduce((result, sup) => {
|
|
19561
19279
|
const sdecls = sup[decls];
|
|
19562
|
-
const next = hasProperty(sdecls, node.name) ? sdecls[node.name] : superChain(sup);
|
|
19280
|
+
const next = (0, import_chunk_MBTLUWXR.hasProperty)(sdecls, node.name) ? sdecls[node.name] : superChain(sup);
|
|
19563
19281
|
return next ? result ? result.concat(next) : next : result;
|
|
19564
19282
|
}, null);
|
|
19565
19283
|
};
|
|
@@ -19580,7 +19298,7 @@ function checkOne(state, ns, decls, node) {
|
|
|
19580
19298
|
}, null);
|
|
19581
19299
|
};
|
|
19582
19300
|
const ndecls = ns[decls];
|
|
19583
|
-
if (hasProperty(ndecls, node.name)) {
|
|
19301
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(ndecls, node.name)) {
|
|
19584
19302
|
return ndecls[node.name];
|
|
19585
19303
|
}
|
|
19586
19304
|
switch (ns.type) {
|
|
@@ -19603,11 +19321,11 @@ function sameStateNodeDecl(a, b) {
|
|
|
19603
19321
|
function sameLookupDefinition(a, b) {
|
|
19604
19322
|
return (
|
|
19605
19323
|
// sameStateNodeDecl(a.parent, b.parent) &&
|
|
19606
|
-
(0,
|
|
19324
|
+
(0, import_chunk_PVBIKZYZ.sameArrays)(a.results, b.results, (ar, br) => sameStateNodeDecl(ar, br))
|
|
19607
19325
|
);
|
|
19608
19326
|
}
|
|
19609
19327
|
function sameLookupResult(a, b) {
|
|
19610
|
-
return (0,
|
|
19328
|
+
return (0, import_chunk_PVBIKZYZ.sameArrays)(a, b, sameLookupDefinition);
|
|
19611
19329
|
}
|
|
19612
19330
|
function declKey(decl) {
|
|
19613
19331
|
return isStateNode(decl) ? decl.type === "ModuleDeclaration" ? decl.fullName : decl.node : decl;
|
|
@@ -19703,7 +19421,7 @@ function lookup(state, decls, node, name, maybeStack, nonlocal, ignoreImports) {
|
|
|
19703
19421
|
case "ClassDeclaration":
|
|
19704
19422
|
if (inStatic && state.config?.enforceStatic !== "NO") {
|
|
19705
19423
|
inStatic = false;
|
|
19706
|
-
if (hasProperty(si.decls, node.name)) {
|
|
19424
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(si.decls, node.name)) {
|
|
19707
19425
|
const r = si.decls[node.name].filter((s) => {
|
|
19708
19426
|
switch (s.type) {
|
|
19709
19427
|
case "FunctionDeclaration":
|
|
@@ -19865,7 +19583,7 @@ function stateFuncs() {
|
|
|
19865
19583
|
return this.stack[this.stack.length - 1];
|
|
19866
19584
|
},
|
|
19867
19585
|
traverse(root) {
|
|
19868
|
-
return traverseAst(
|
|
19586
|
+
return (0, import_chunk_MBTLUWXR.traverseAst)(
|
|
19869
19587
|
root,
|
|
19870
19588
|
(node) => {
|
|
19871
19589
|
try {
|
|
@@ -19975,7 +19693,7 @@ function stateFuncs() {
|
|
|
19975
19693
|
if (name) {
|
|
19976
19694
|
if (!parent.decls)
|
|
19977
19695
|
parent.decls = {};
|
|
19978
|
-
if (hasProperty(parent.decls, name)) {
|
|
19696
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(parent.decls, name)) {
|
|
19979
19697
|
const what = node.type === "ModuleDeclaration" ? "type" : "node";
|
|
19980
19698
|
const e = parent.decls[name].find(
|
|
19981
19699
|
(d) => isStateNode(d) && d[what] === elm[what]
|
|
@@ -19998,7 +19716,7 @@ function stateFuncs() {
|
|
|
19998
19716
|
if (node.type === "ModuleDeclaration" || node.type === "ClassDeclaration") {
|
|
19999
19717
|
if (!parent.type_decls)
|
|
20000
19718
|
parent.type_decls = {};
|
|
20001
|
-
if (!hasProperty(parent.type_decls, name)) {
|
|
19719
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(parent.type_decls, name)) {
|
|
20002
19720
|
parent.type_decls[name] = [];
|
|
20003
19721
|
}
|
|
20004
19722
|
parent.type_decls[name].push(elm);
|
|
@@ -20027,7 +19745,7 @@ function stateFuncs() {
|
|
|
20027
19745
|
const parent = this.top().sn;
|
|
20028
19746
|
if (!parent.type_decls)
|
|
20029
19747
|
parent.type_decls = {};
|
|
20030
|
-
if (!hasProperty(parent.type_decls, name)) {
|
|
19748
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(parent.type_decls, name)) {
|
|
20031
19749
|
parent.type_decls[name] = [];
|
|
20032
19750
|
} else if (parent.type_decls[name].find(
|
|
20033
19751
|
(n) => (isStateNode(n) ? n.node : n) === node
|
|
@@ -20056,7 +19774,7 @@ function stateFuncs() {
|
|
|
20056
19774
|
const stack = this.stackClone();
|
|
20057
19775
|
node.declarations.forEach((decl) => {
|
|
20058
19776
|
const name = variableDeclarationName(decl.id);
|
|
20059
|
-
if (!hasProperty(decls, name)) {
|
|
19777
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(decls, name)) {
|
|
20060
19778
|
decls[name] = [];
|
|
20061
19779
|
} else if (decls[name].find(
|
|
20062
19780
|
(n) => (isStateNode(n) ? n.node : n) === decl
|
|
@@ -20073,10 +19791,10 @@ function stateFuncs() {
|
|
|
20073
19791
|
attributes: stateNodeAttrs(node.attrs)
|
|
20074
19792
|
});
|
|
20075
19793
|
if (node.kind === "const") {
|
|
20076
|
-
if (!hasProperty(this.index, name)) {
|
|
19794
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(this.index, name)) {
|
|
20077
19795
|
this.index[name] = [];
|
|
20078
19796
|
}
|
|
20079
|
-
(0,
|
|
19797
|
+
(0, import_chunk_PVBIKZYZ.pushUnique)(this.index[name], parent);
|
|
20080
19798
|
}
|
|
20081
19799
|
});
|
|
20082
19800
|
break;
|
|
@@ -20116,7 +19834,7 @@ function stateFuncs() {
|
|
|
20116
19834
|
};
|
|
20117
19835
|
}
|
|
20118
19836
|
const name = m.id.name;
|
|
20119
|
-
const init = getLiteralNode(m.init);
|
|
19837
|
+
const init = (0, import_chunk_MBTLUWXR.getLiteralNode)(m.init);
|
|
20120
19838
|
if (!init) {
|
|
20121
19839
|
throw new Error("Unexpected enum initializer");
|
|
20122
19840
|
}
|
|
@@ -20126,21 +19844,21 @@ function stateFuncs() {
|
|
|
20126
19844
|
}
|
|
20127
19845
|
m.init = init;
|
|
20128
19846
|
}
|
|
20129
|
-
if (init.type === "Literal" && init.raw &&
|
|
19847
|
+
if (init.type === "Literal" && init.raw && import_prettier_plugin_monkeyc4.LiteralIntegerRe.test(init.raw)) {
|
|
20130
19848
|
prev = init.value;
|
|
20131
19849
|
}
|
|
20132
|
-
if (!hasProperty(values, name)) {
|
|
19850
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(values, name)) {
|
|
20133
19851
|
values[name] = [];
|
|
20134
19852
|
}
|
|
20135
|
-
if ((0,
|
|
19853
|
+
if ((0, import_chunk_PVBIKZYZ.pushUnique)(values[name], m) && currentEnum) {
|
|
20136
19854
|
if (!this.enumMap)
|
|
20137
19855
|
this.enumMap = /* @__PURE__ */ new Map();
|
|
20138
19856
|
this.enumMap.set(m, currentEnum);
|
|
20139
19857
|
}
|
|
20140
|
-
if (!hasProperty(this.index, name)) {
|
|
19858
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(this.index, name)) {
|
|
20141
19859
|
this.index[name] = [];
|
|
20142
19860
|
}
|
|
20143
|
-
(0,
|
|
19861
|
+
(0, import_chunk_PVBIKZYZ.pushUnique)(this.index[name], parent);
|
|
20144
19862
|
});
|
|
20145
19863
|
break;
|
|
20146
19864
|
}
|
|
@@ -20263,11 +19981,11 @@ function formatAst(node, monkeyCSource = null, options = null) {
|
|
|
20263
19981
|
node = e;
|
|
20264
19982
|
}
|
|
20265
19983
|
}
|
|
20266
|
-
const source = (monkeyCSource || "") + "\n" + (0,
|
|
19984
|
+
const source = (monkeyCSource || "") + "\n" + (0, import_prettier_plugin_monkeyc4.serializeMonkeyC)(node);
|
|
20267
19985
|
return Prettier.format(source, {
|
|
20268
19986
|
...options || {},
|
|
20269
19987
|
parser: "monkeyc-json",
|
|
20270
|
-
plugins: [
|
|
19988
|
+
plugins: [import_prettier_plugin_monkeyc4.default],
|
|
20271
19989
|
endOfLine: "lf"
|
|
20272
19990
|
});
|
|
20273
19991
|
}
|
|
@@ -20434,7 +20152,7 @@ function findUsing(state, stack, using) {
|
|
|
20434
20152
|
find(node.object);
|
|
20435
20153
|
name = node.property.name;
|
|
20436
20154
|
}
|
|
20437
|
-
if (hasProperty(module2.decls, name)) {
|
|
20155
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(module2.decls, name)) {
|
|
20438
20156
|
const decls = module2.decls[name];
|
|
20439
20157
|
if (decls && decls.length === 1 && decls[0].type === "ModuleDeclaration") {
|
|
20440
20158
|
module2 = decls[0];
|
|
@@ -20461,7 +20179,7 @@ function findUsingForNode(state, stack, i, node) {
|
|
|
20461
20179
|
let imports = null;
|
|
20462
20180
|
while (i >= 0) {
|
|
20463
20181
|
const si = stack[i--];
|
|
20464
|
-
if (hasProperty(si.usings, node.name)) {
|
|
20182
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(si.usings, node.name)) {
|
|
20465
20183
|
const using = si.usings[node.name];
|
|
20466
20184
|
return findUsing(state, stack, using);
|
|
20467
20185
|
}
|
|
@@ -20470,7 +20188,7 @@ function findUsingForNode(state, stack, i, node) {
|
|
|
20470
20188
|
const using = si.imports[j];
|
|
20471
20189
|
const module2 = findUsing(state, stack, using);
|
|
20472
20190
|
if (module2) {
|
|
20473
|
-
if (hasProperty(module2.type_decls, node.name)) {
|
|
20191
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(module2.type_decls, node.name)) {
|
|
20474
20192
|
if (!imports)
|
|
20475
20193
|
imports = [];
|
|
20476
20194
|
imports.push({
|
|
@@ -20526,7 +20244,7 @@ function diagnosticHelper(diagnostics, node, message, type = "INFO", extra, uniq
|
|
|
20526
20244
|
if (!loc || !loc.source)
|
|
20527
20245
|
return;
|
|
20528
20246
|
const source = loc.source;
|
|
20529
|
-
if (!hasProperty(diagnostics, source)) {
|
|
20247
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(diagnostics, source)) {
|
|
20530
20248
|
if (!message)
|
|
20531
20249
|
return;
|
|
20532
20250
|
diagnostics[source] = [];
|
|
@@ -20580,9 +20298,9 @@ function getSuperClasses(klass) {
|
|
|
20580
20298
|
});
|
|
20581
20299
|
return superClasses;
|
|
20582
20300
|
}
|
|
20583
|
-
var init_api = (0,
|
|
20301
|
+
var init_api = (0, import_chunk_ABYVSU2C.__esm)({
|
|
20584
20302
|
"src/api.ts"() {
|
|
20585
|
-
init_ast();
|
|
20303
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
20586
20304
|
init_mc_rewrite();
|
|
20587
20305
|
init_negative_fixups();
|
|
20588
20306
|
init_optimizer_types();
|
|
@@ -20590,7 +20308,7 @@ var init_api = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
20590
20308
|
init_sdk_util();
|
|
20591
20309
|
init_type_flow_util();
|
|
20592
20310
|
init_types();
|
|
20593
|
-
(0,
|
|
20311
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
20594
20312
|
init_visitor();
|
|
20595
20313
|
}
|
|
20596
20314
|
});
|
|
@@ -20706,7 +20424,7 @@ function buildDataFlowGraph(state, func, wantsLiteral, trackInsertionPoints, wan
|
|
|
20706
20424
|
}
|
|
20707
20425
|
const decl = lookupDefToDecl(results);
|
|
20708
20426
|
if (decl && path7.length) {
|
|
20709
|
-
if (wantsAllRefs && (0,
|
|
20427
|
+
if (wantsAllRefs && (0, import_chunk_PVBIKZYZ.every)(
|
|
20710
20428
|
decl,
|
|
20711
20429
|
(d) => d.type === "VariableDeclarator" || d.type === "BinaryExpression" || d.type === "Identifier"
|
|
20712
20430
|
)) {
|
|
@@ -20793,7 +20511,7 @@ function buildDataFlowGraph(state, func, wantsLiteral, trackInsertionPoints, wan
|
|
|
20793
20511
|
break;
|
|
20794
20512
|
case "Literal":
|
|
20795
20513
|
if (wantsLiteral(node)) {
|
|
20796
|
-
const result = getNodeValue(node);
|
|
20514
|
+
const result = (0, import_chunk_MBTLUWXR.getNodeValue)(node);
|
|
20797
20515
|
const key = result[1] + (result[0].value === null ? "" : "-" + result[0].value.toString());
|
|
20798
20516
|
let decl = literals.get(key);
|
|
20799
20517
|
if (!decl) {
|
|
@@ -20814,7 +20532,7 @@ function buildDataFlowGraph(state, func, wantsLiteral, trackInsertionPoints, wan
|
|
|
20814
20532
|
const decls = findDecl(node);
|
|
20815
20533
|
if (!decls)
|
|
20816
20534
|
break;
|
|
20817
|
-
if (trackInsertionPoints && (0,
|
|
20535
|
+
if (trackInsertionPoints && (0, import_chunk_PVBIKZYZ.some)(decls, (decl) => {
|
|
20818
20536
|
if (decl.type === "VariableDeclarator") {
|
|
20819
20537
|
const defStmts = decl.node.kind === "var" && liveDefs.get(null) || liveDefs.get(decl);
|
|
20820
20538
|
if (defStmts) {
|
|
@@ -20946,7 +20664,7 @@ function buildDataFlowGraph(state, func, wantsLiteral, trackInsertionPoints, wan
|
|
|
20946
20664
|
return { type: "mod", node, mayThrow: mayThrow2, callees };
|
|
20947
20665
|
}
|
|
20948
20666
|
default:
|
|
20949
|
-
if (!isExpression(node))
|
|
20667
|
+
if (!(0, import_chunk_MBTLUWXR.isExpression)(node))
|
|
20950
20668
|
break;
|
|
20951
20669
|
unhandledType(node);
|
|
20952
20670
|
}
|
|
@@ -21057,16 +20775,16 @@ function getFlowEvent(node, stmt, findDecl) {
|
|
|
21057
20775
|
return null;
|
|
21058
20776
|
}
|
|
21059
20777
|
var DataflowQueue;
|
|
21060
|
-
var init_data_flow = (0,
|
|
20778
|
+
var init_data_flow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
21061
20779
|
"src/data-flow.ts"() {
|
|
21062
20780
|
"use strict";
|
|
21063
20781
|
init_api();
|
|
21064
|
-
init_ast();
|
|
20782
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
21065
20783
|
init_control_flow();
|
|
21066
20784
|
init_function_info();
|
|
21067
20785
|
init_type_flow_util();
|
|
21068
|
-
(0,
|
|
21069
|
-
DataflowQueue = class extends
|
|
20786
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
20787
|
+
DataflowQueue = class extends import_chunk_PVBIKZYZ.GenericQueue {
|
|
21070
20788
|
constructor() {
|
|
21071
20789
|
super((b, a) => (a.order || 0) - (b.order || 0));
|
|
21072
20790
|
}
|
|
@@ -21451,7 +21169,7 @@ function isCondBranch(op) {
|
|
|
21451
21169
|
return false;
|
|
21452
21170
|
}
|
|
21453
21171
|
var Opcodes;
|
|
21454
|
-
var init_opcodes = (0,
|
|
21172
|
+
var init_opcodes = (0, import_chunk_ABYVSU2C.__esm)({
|
|
21455
21173
|
"src/readprg/opcodes.ts"() {
|
|
21456
21174
|
"use strict";
|
|
21457
21175
|
init_data_flow();
|
|
@@ -21602,7 +21320,7 @@ function computeJsrMap(func) {
|
|
|
21602
21320
|
}
|
|
21603
21321
|
function postOrderPropagate(func, preBlock, processBc, postBlock, merge) {
|
|
21604
21322
|
const order = /* @__PURE__ */ new Map();
|
|
21605
|
-
const queue = new
|
|
21323
|
+
const queue = new import_chunk_PVBIKZYZ.GenericQueue(
|
|
21606
21324
|
(b, a) => order.get(a) - order.get(b)
|
|
21607
21325
|
);
|
|
21608
21326
|
postOrderTraverse2(func, (block) => {
|
|
@@ -21661,7 +21379,7 @@ function rpoPropagate(func, preBlock, processBc, postBlock, merge) {
|
|
|
21661
21379
|
});
|
|
21662
21380
|
blocks.reverse().forEach((block, i) => order.set(block, i));
|
|
21663
21381
|
}
|
|
21664
|
-
const queue = new
|
|
21382
|
+
const queue = new import_chunk_PVBIKZYZ.GenericQueue(
|
|
21665
21383
|
(b, a) => order.get(a) - order.get(b)
|
|
21666
21384
|
);
|
|
21667
21385
|
queue.enqueue(func.blocks.get(func.offset));
|
|
@@ -21712,10 +21430,10 @@ function rpoPropagate(func, preBlock, processBc, postBlock, merge) {
|
|
|
21712
21430
|
retMap.get(top.offset)?.forEach((retSucc) => doMerge(retSucc, false));
|
|
21713
21431
|
}
|
|
21714
21432
|
}
|
|
21715
|
-
var init_cflow = (0,
|
|
21433
|
+
var init_cflow = (0, import_chunk_ABYVSU2C.__esm)({
|
|
21716
21434
|
"src/readprg/cflow.ts"() {
|
|
21717
21435
|
"use strict";
|
|
21718
|
-
(0,
|
|
21436
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
21719
21437
|
init_opcodes();
|
|
21720
21438
|
}
|
|
21721
21439
|
});
|
|
@@ -21819,16 +21537,16 @@ function sizeBasedPRE2(func, context) {
|
|
|
21819
21537
|
delete bc.arg;
|
|
21820
21538
|
return bc;
|
|
21821
21539
|
};
|
|
21822
|
-
if ((0,
|
|
21823
|
-
if ((0,
|
|
21824
|
-
(0,
|
|
21540
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("pre", 1)) {
|
|
21541
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("pre", 5)) {
|
|
21542
|
+
(0, import_chunk_PVBIKZYZ.log)(functionBanner(func, context, "PRE")());
|
|
21825
21543
|
} else {
|
|
21826
|
-
(0,
|
|
21544
|
+
(0, import_chunk_PVBIKZYZ.log)(`================ PRE : ${func.name} ================
|
|
21827
21545
|
`);
|
|
21828
21546
|
}
|
|
21829
21547
|
insertionBlocks.forEach((o, key) => {
|
|
21830
21548
|
const bcs = canonicalMap.get(key);
|
|
21831
|
-
(0,
|
|
21549
|
+
(0, import_chunk_PVBIKZYZ.log)(
|
|
21832
21550
|
`Replacing ${bcs.size} instances of ${bytecodeToString(
|
|
21833
21551
|
bcs.values().next().value,
|
|
21834
21552
|
context.symbolTable
|
|
@@ -21874,7 +21592,7 @@ function sizeBasedPRE2(func, context) {
|
|
|
21874
21592
|
})
|
|
21875
21593
|
);
|
|
21876
21594
|
(0, import_node_assert7.default)(spush);
|
|
21877
|
-
if (index >= 0 && index < block.bytecodes.length) {
|
|
21595
|
+
if (index >= 0 && index < block.bytecodes.length && bcs.has(block.bytecodes[index])) {
|
|
21878
21596
|
index--;
|
|
21879
21597
|
}
|
|
21880
21598
|
block.bytecodes.splice(
|
|
@@ -21909,13 +21627,13 @@ function sizeBasedPRE2(func, context) {
|
|
|
21909
21627
|
bytecode(1, insertionBlocks.size)
|
|
21910
21628
|
);
|
|
21911
21629
|
}
|
|
21912
|
-
(0,
|
|
21630
|
+
(0, import_chunk_PVBIKZYZ.logger)("pre", 5, functionBanner(func, context, "post-PRE"));
|
|
21913
21631
|
return true;
|
|
21914
21632
|
}
|
|
21915
|
-
var init_pre2 = (0,
|
|
21633
|
+
var init_pre2 = (0, import_chunk_ABYVSU2C.__esm)({
|
|
21916
21634
|
"src/readprg/pre.ts"() {
|
|
21917
21635
|
"use strict";
|
|
21918
|
-
(0,
|
|
21636
|
+
(0, import_chunk_PVBIKZYZ.init_logger)();
|
|
21919
21637
|
init_bytecode();
|
|
21920
21638
|
init_cflow();
|
|
21921
21639
|
init_opcodes();
|
|
@@ -22350,12 +22068,12 @@ function interpFunc(func, context) {
|
|
|
22350
22068
|
const selfStores = /* @__PURE__ */ new Set();
|
|
22351
22069
|
const liveInState = /* @__PURE__ */ new Map();
|
|
22352
22070
|
const replacements = /* @__PURE__ */ new Map();
|
|
22353
|
-
const interpLogging = (0,
|
|
22071
|
+
const interpLogging = (0, import_chunk_PVBIKZYZ.wouldLog)("interp", 1);
|
|
22354
22072
|
if (interpLogging) {
|
|
22355
|
-
if ((0,
|
|
22356
|
-
(0,
|
|
22357
|
-
} else if ((0,
|
|
22358
|
-
(0,
|
|
22073
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("interp", 7)) {
|
|
22074
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(functionBanner(func, context, "interp"));
|
|
22075
|
+
} else if ((0, import_chunk_PVBIKZYZ.wouldLog)("interp", 3)) {
|
|
22076
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(
|
|
22359
22077
|
() => `+++++++++++++ interp-prepare ${func.name} ++++++++++++++`
|
|
22360
22078
|
);
|
|
22361
22079
|
}
|
|
@@ -22389,20 +22107,20 @@ function interpFunc(func, context) {
|
|
|
22389
22107
|
func,
|
|
22390
22108
|
(block) => {
|
|
22391
22109
|
if (interpLogging) {
|
|
22392
|
-
(0,
|
|
22110
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
22393
22111
|
"interp",
|
|
22394
22112
|
3,
|
|
22395
22113
|
`${offsetToString(block.offset)}: ${block.bytecodes[0]?.lineNum ? lineInfoToString(block.bytecodes[0]?.lineNum, context) : ""}
|
|
22396
22114
|
${interpStateToString(liveInState.get(block.offset))}`
|
|
22397
22115
|
);
|
|
22398
|
-
(0,
|
|
22116
|
+
(0, import_chunk_PVBIKZYZ.logger)("interp", 9, () => blockToString(block, context));
|
|
22399
22117
|
}
|
|
22400
22118
|
return cloneState2(liveInState.get(block.offset));
|
|
22401
22119
|
},
|
|
22402
22120
|
(block, bc, localState) => {
|
|
22403
22121
|
if (interpLogging) {
|
|
22404
|
-
if ((0,
|
|
22405
|
-
(0,
|
|
22122
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("interp", 8)) {
|
|
22123
|
+
(0, import_chunk_PVBIKZYZ.log)(
|
|
22406
22124
|
`${interpStateToString(localState)}
|
|
22407
22125
|
${bytecodeToString(
|
|
22408
22126
|
bc,
|
|
@@ -22567,14 +22285,14 @@ function interpFunc(func, context) {
|
|
|
22567
22285
|
if (!mergeInto(localState, succState))
|
|
22568
22286
|
return false;
|
|
22569
22287
|
if (interpLogging) {
|
|
22570
|
-
(0,
|
|
22288
|
+
(0, import_chunk_PVBIKZYZ.logger)("interp", 3, `Re-Merge to ${offsetToString(succBlock.offset)}`);
|
|
22571
22289
|
}
|
|
22572
22290
|
return true;
|
|
22573
22291
|
}
|
|
22574
22292
|
);
|
|
22575
22293
|
if (interpLogging) {
|
|
22576
|
-
if ((0,
|
|
22577
|
-
(0,
|
|
22294
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("interp", 5)) {
|
|
22295
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(
|
|
22578
22296
|
functionBanner(func, context, "interp", (block, footer) => {
|
|
22579
22297
|
if (footer)
|
|
22580
22298
|
return "";
|
|
@@ -22582,44 +22300,44 @@ function interpFunc(func, context) {
|
|
|
22582
22300
|
})
|
|
22583
22301
|
);
|
|
22584
22302
|
} else {
|
|
22585
|
-
(0,
|
|
22303
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(() => `=============== interp ${func.name} ==============`);
|
|
22586
22304
|
}
|
|
22587
22305
|
if (equivSets.size) {
|
|
22588
|
-
(0,
|
|
22306
|
+
(0, import_chunk_PVBIKZYZ.log)(`====== equivSets =====`);
|
|
22589
22307
|
equivSets.forEach(
|
|
22590
|
-
(value2, key) => (0,
|
|
22308
|
+
(value2, key) => (0, import_chunk_PVBIKZYZ.log)(
|
|
22591
22309
|
`L${key.arg} === ${Array.from(value2).sort().join(" ")} ${key.lineNum ? lineInfoToString(key.lineNum, context) : ""}`
|
|
22592
22310
|
)
|
|
22593
22311
|
);
|
|
22594
22312
|
}
|
|
22595
22313
|
if (selfStores.size) {
|
|
22596
|
-
(0,
|
|
22314
|
+
(0, import_chunk_PVBIKZYZ.log)(`====== selfStores =====`);
|
|
22597
22315
|
selfStores.forEach(
|
|
22598
|
-
(value2) => (0,
|
|
22316
|
+
(value2) => (0, import_chunk_PVBIKZYZ.log)(`${bytecodeToString(value2, symbolTable)}`)
|
|
22599
22317
|
);
|
|
22600
22318
|
}
|
|
22601
22319
|
if (replacements.size) {
|
|
22602
|
-
(0,
|
|
22320
|
+
(0, import_chunk_PVBIKZYZ.log)(`====== replacements =====`);
|
|
22603
22321
|
replacements.forEach(
|
|
22604
22322
|
(blockRep) => blockRep.forEach(
|
|
22605
|
-
(rep, bc) => (0,
|
|
22323
|
+
(rep, bc) => (0, import_chunk_PVBIKZYZ.log)(
|
|
22606
22324
|
`${bytecodeToString(bc, symbolTable)} => ${rep.invert ? "~" : ""}${bytecodeToString(rep, symbolTable)} ${bc.lineNum ? lineInfoToString(bc.lineNum, context) : ""}`
|
|
22607
22325
|
)
|
|
22608
22326
|
)
|
|
22609
22327
|
);
|
|
22610
22328
|
}
|
|
22611
22329
|
if (resolvedBranches.size) {
|
|
22612
|
-
(0,
|
|
22330
|
+
(0, import_chunk_PVBIKZYZ.log)(`====== resolved branches =====`);
|
|
22613
22331
|
resolvedBranches.forEach(
|
|
22614
|
-
(isTaken, block) => (0,
|
|
22332
|
+
(isTaken, block) => (0, import_chunk_PVBIKZYZ.log)(
|
|
22615
22333
|
`block ${offsetToString(block.offset)} is ${isTaken ? "always" : "never"} taken`
|
|
22616
22334
|
)
|
|
22617
22335
|
);
|
|
22618
22336
|
}
|
|
22619
22337
|
if (branchRedirects.size) {
|
|
22620
|
-
(0,
|
|
22338
|
+
(0, import_chunk_PVBIKZYZ.log)(`====== redirected branches =====`);
|
|
22621
22339
|
branchRedirects.forEach(
|
|
22622
|
-
({ to, from }, block) => (0,
|
|
22340
|
+
({ to, from }, block) => (0, import_chunk_PVBIKZYZ.log)(
|
|
22623
22341
|
`block ${offsetToString(
|
|
22624
22342
|
block.offset
|
|
22625
22343
|
)} redirects from ${offsetToString(from)} to ${offsetToString(to)}${safeBranchBlocks.get(from) ? ` popping ${safeBranchBlocks.get(from)}` : ""}`
|
|
@@ -22685,7 +22403,7 @@ function interpFunc(func, context) {
|
|
|
22685
22403
|
}
|
|
22686
22404
|
});
|
|
22687
22405
|
if (interpLogging)
|
|
22688
|
-
(0,
|
|
22406
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(null);
|
|
22689
22407
|
return {
|
|
22690
22408
|
liveInState,
|
|
22691
22409
|
equivSets,
|
|
@@ -22734,11 +22452,11 @@ function instForType(type, offset) {
|
|
|
22734
22452
|
}
|
|
22735
22453
|
return null;
|
|
22736
22454
|
}
|
|
22737
|
-
var init_interp2 = (0,
|
|
22455
|
+
var init_interp2 = (0, import_chunk_ABYVSU2C.__esm)({
|
|
22738
22456
|
"src/readprg/interp.ts"() {
|
|
22739
22457
|
"use strict";
|
|
22740
22458
|
init_interp_binary();
|
|
22741
|
-
(0,
|
|
22459
|
+
(0, import_chunk_PVBIKZYZ.init_logger)();
|
|
22742
22460
|
init_interp();
|
|
22743
22461
|
init_types();
|
|
22744
22462
|
init_union_type();
|
|
@@ -22846,7 +22564,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
|
|
|
22846
22564
|
i = found;
|
|
22847
22565
|
}
|
|
22848
22566
|
if (initType && (block.bytecodes[index].op === 20 ? initType.type === 1 : initType.type === 8 && initType.value === 0)) {
|
|
22849
|
-
(0,
|
|
22567
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
22850
22568
|
"array-init",
|
|
22851
22569
|
1,
|
|
22852
22570
|
() => `${func.name}: Removing initialization of default initialized ${putvStarts.length} element array init at block ${offsetToString(
|
|
@@ -22879,7 +22597,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
|
|
|
22879
22597
|
convertAputv(offset - 1);
|
|
22880
22598
|
}
|
|
22881
22599
|
}
|
|
22882
|
-
(0,
|
|
22600
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
22883
22601
|
"array-init",
|
|
22884
22602
|
1,
|
|
22885
22603
|
() => `${func.name}: Optimizing unused ${putvStarts.length} element array init at block ${offsetToString(
|
|
@@ -22888,8 +22606,8 @@ function optimizeArrayInit(func, block, index, context, interpState) {
|
|
|
22888
22606
|
block.bytecodes[index].offset
|
|
22889
22607
|
)}`
|
|
22890
22608
|
);
|
|
22891
|
-
if ((0,
|
|
22892
|
-
(0,
|
|
22609
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("array-init", 5)) {
|
|
22610
|
+
(0, import_chunk_PVBIKZYZ.log)(blockToString(block, context));
|
|
22893
22611
|
}
|
|
22894
22612
|
return true;
|
|
22895
22613
|
}
|
|
@@ -22929,7 +22647,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
|
|
|
22929
22647
|
if (putvStarts.length < 3)
|
|
22930
22648
|
return false;
|
|
22931
22649
|
tryLocal(3);
|
|
22932
|
-
(0,
|
|
22650
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
22933
22651
|
"array-init",
|
|
22934
22652
|
1,
|
|
22935
22653
|
() => `${func.name}: Optimizing ${putvStarts.length} element array init with constant initializer ${bytecodeToString(
|
|
@@ -22955,7 +22673,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
|
|
|
22955
22673
|
block.bytecodes[index + 1].arg = putvStarts.length;
|
|
22956
22674
|
}
|
|
22957
22675
|
}
|
|
22958
|
-
(0,
|
|
22676
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
22959
22677
|
"array-init",
|
|
22960
22678
|
5,
|
|
22961
22679
|
() => `index: ${index}, i: ${i}
|
|
@@ -22993,7 +22711,7 @@ ${blockToString(block, context)}`
|
|
|
22993
22711
|
for (let i2 = putvStarts.length; i2-- > 1; ) {
|
|
22994
22712
|
block.bytecodes.splice(putvStarts[i2], 2);
|
|
22995
22713
|
}
|
|
22996
|
-
(0,
|
|
22714
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
22997
22715
|
"array-init",
|
|
22998
22716
|
1,
|
|
22999
22717
|
() => `${func.name}: Optimizing ${putvStarts.length} element array init at block ${offsetToString(
|
|
@@ -23048,19 +22766,19 @@ ${blockToString(block, context)}`
|
|
|
23048
22766
|
loop.taken = loopOffset;
|
|
23049
22767
|
return true;
|
|
23050
22768
|
}
|
|
23051
|
-
var init_array_init = (0,
|
|
22769
|
+
var init_array_init = (0, import_chunk_ABYVSU2C.__esm)({
|
|
23052
22770
|
"src/readprg/array-init.ts"() {
|
|
23053
22771
|
"use strict";
|
|
23054
22772
|
init_types();
|
|
23055
|
-
(0,
|
|
22773
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
23056
22774
|
init_bytecode();
|
|
23057
22775
|
init_interp2();
|
|
23058
22776
|
init_opcodes();
|
|
23059
22777
|
}
|
|
23060
22778
|
});
|
|
23061
22779
|
function localDCE(func, context) {
|
|
23062
|
-
if ((0,
|
|
23063
|
-
(0,
|
|
22780
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("dce", 5)) {
|
|
22781
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(
|
|
23064
22782
|
functionBanner(
|
|
23065
22783
|
func,
|
|
23066
22784
|
context,
|
|
@@ -23093,7 +22811,7 @@ function localDCE(func, context) {
|
|
|
23093
22811
|
};
|
|
23094
22812
|
func.blocks.forEach((block) => {
|
|
23095
22813
|
const reportPopv = (i, item, kill) => {
|
|
23096
|
-
(0,
|
|
22814
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
23097
22815
|
"dce",
|
|
23098
22816
|
2,
|
|
23099
22817
|
() => `${func.name}: Convert ${i}:${bytecodeToString(
|
|
@@ -23108,7 +22826,7 @@ function localDCE(func, context) {
|
|
|
23108
22826
|
);
|
|
23109
22827
|
};
|
|
23110
22828
|
const reportNop = (item) => {
|
|
23111
|
-
(0,
|
|
22829
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
23112
22830
|
"dce",
|
|
23113
22831
|
2,
|
|
23114
22832
|
() => `${func.name}: Kill ${item.deps.map(
|
|
@@ -23127,7 +22845,7 @@ function localDCE(func, context) {
|
|
|
23127
22845
|
case 19: {
|
|
23128
22846
|
const liveLocal = dceInfo.locals.has(bytecode.arg);
|
|
23129
22847
|
if (!liveLocal) {
|
|
23130
|
-
(0,
|
|
22848
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
23131
22849
|
"dce",
|
|
23132
22850
|
2,
|
|
23133
22851
|
() => `${func.name}: Killing store to unused local ${bytecode.arg} at ${offsetToString(block.offset)}:${i}`
|
|
@@ -23248,10 +22966,10 @@ function localDCE(func, context) {
|
|
|
23248
22966
|
(bc) => bc.op !== 0
|
|
23249
22967
|
/* nop */
|
|
23250
22968
|
);
|
|
23251
|
-
(0,
|
|
22969
|
+
(0, import_chunk_PVBIKZYZ.logger)("dce", 3, functionBanner(func, context, "local-dce-end"));
|
|
23252
22970
|
}
|
|
23253
22971
|
});
|
|
23254
|
-
(0,
|
|
22972
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(null);
|
|
23255
22973
|
return anyChanges;
|
|
23256
22974
|
}
|
|
23257
22975
|
function computeLiveLocals(func) {
|
|
@@ -23294,10 +23012,10 @@ function computeLiveLocals(func) {
|
|
|
23294
23012
|
);
|
|
23295
23013
|
return { liveInLocals, liveOutLocals };
|
|
23296
23014
|
}
|
|
23297
|
-
var init_dce = (0,
|
|
23015
|
+
var init_dce = (0, import_chunk_ABYVSU2C.__esm)({
|
|
23298
23016
|
"src/readprg/dce.ts"() {
|
|
23299
23017
|
"use strict";
|
|
23300
|
-
(0,
|
|
23018
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
23301
23019
|
init_bytecode();
|
|
23302
23020
|
init_cflow();
|
|
23303
23021
|
init_opcodes();
|
|
@@ -23330,7 +23048,7 @@ function minimizeLocals2(func, equivSets, context) {
|
|
|
23330
23048
|
const splitRanges = computeSplitRanges(func, equivSets);
|
|
23331
23049
|
const locals = mergeSplitRanges(splitRanges);
|
|
23332
23050
|
const numLocals = Math.max(...Array.from(splitRanges.keys())) + 1;
|
|
23333
|
-
(0,
|
|
23051
|
+
(0, import_chunk_PVBIKZYZ.logger)("locals", 10, functionBanner(func, context, "Minimize Locals"));
|
|
23334
23052
|
let argc = func.argc ?? null;
|
|
23335
23053
|
const colors = /* @__PURE__ */ new Map();
|
|
23336
23054
|
const merge = [];
|
|
@@ -23388,15 +23106,15 @@ function minimizeLocals2(func, equivSets, context) {
|
|
|
23388
23106
|
}
|
|
23389
23107
|
}
|
|
23390
23108
|
}
|
|
23391
|
-
if ((0,
|
|
23392
|
-
if (!(0,
|
|
23393
|
-
(0,
|
|
23109
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("locals", 1)) {
|
|
23110
|
+
if (!(0, import_chunk_PVBIKZYZ.wouldLog)("locals", 10)) {
|
|
23111
|
+
(0, import_chunk_PVBIKZYZ.logger)("locals", 5, functionBanner(func, context, "Minimize Locals"));
|
|
23394
23112
|
}
|
|
23395
|
-
(0,
|
|
23113
|
+
(0, import_chunk_PVBIKZYZ.log)(
|
|
23396
23114
|
`>>> Merging locals in ${func.name} (in: ${numLocals} => out: ${merge.length})`
|
|
23397
23115
|
);
|
|
23398
23116
|
merge.slice().sort((a, b) => (colors.get(a[0]) ?? 0) - (colors.get(b[0]) ?? 0)).forEach(
|
|
23399
|
-
(merged) => (0,
|
|
23117
|
+
(merged) => (0, import_chunk_PVBIKZYZ.log)(
|
|
23400
23118
|
` ${colors.get(merged[0])} - ${merged.map((k) => bytecodeToString(k, context.symbolTable)).join(" | ")}`
|
|
23401
23119
|
)
|
|
23402
23120
|
);
|
|
@@ -23656,10 +23374,10 @@ function mergeSplitRanges(splitRanges) {
|
|
|
23656
23374
|
});
|
|
23657
23375
|
return localInfo;
|
|
23658
23376
|
}
|
|
23659
|
-
var init_locals = (0,
|
|
23377
|
+
var init_locals = (0, import_chunk_ABYVSU2C.__esm)({
|
|
23660
23378
|
"src/readprg/locals.ts"() {
|
|
23661
23379
|
"use strict";
|
|
23662
|
-
(0,
|
|
23380
|
+
(0, import_chunk_PVBIKZYZ.init_logger)();
|
|
23663
23381
|
init_bytecode();
|
|
23664
23382
|
init_cflow();
|
|
23665
23383
|
init_opcodes();
|
|
@@ -23692,9 +23410,9 @@ function blockSharing(func, context) {
|
|
|
23692
23410
|
if (!any)
|
|
23693
23411
|
return false;
|
|
23694
23412
|
any = false;
|
|
23695
|
-
const logging3 = (0,
|
|
23696
|
-
if (logging3 && (0,
|
|
23697
|
-
(0,
|
|
23413
|
+
const logging3 = (0, import_chunk_PVBIKZYZ.wouldLog)("sharing", 1);
|
|
23414
|
+
if (logging3 && (0, import_chunk_PVBIKZYZ.wouldLog)("sharing", 10)) {
|
|
23415
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(functionBanner(func, context, "sharing"));
|
|
23698
23416
|
}
|
|
23699
23417
|
candidates.forEach((blocks) => {
|
|
23700
23418
|
while (blocks.size > 1) {
|
|
@@ -23830,9 +23548,9 @@ function blockSharing(func, context) {
|
|
|
23830
23548
|
block2.offset
|
|
23831
23549
|
)})` : `block(${offsetToString(block2.offset)})`;
|
|
23832
23550
|
};
|
|
23833
|
-
(0,
|
|
23834
|
-
if ((0,
|
|
23835
|
-
(0,
|
|
23551
|
+
(0, import_chunk_PVBIKZYZ.log)(`Sharing ${showBlock(block)} with ${showBlock(target)}`);
|
|
23552
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("sharing", 5)) {
|
|
23553
|
+
(0, import_chunk_PVBIKZYZ.log)(blockToString(target, context));
|
|
23836
23554
|
}
|
|
23837
23555
|
}
|
|
23838
23556
|
if (target.bytecodes.length > length2) {
|
|
@@ -23859,13 +23577,13 @@ function blockSharing(func, context) {
|
|
|
23859
23577
|
});
|
|
23860
23578
|
}
|
|
23861
23579
|
});
|
|
23862
|
-
(0,
|
|
23580
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(null);
|
|
23863
23581
|
return any;
|
|
23864
23582
|
}
|
|
23865
|
-
var init_sharing = (0,
|
|
23583
|
+
var init_sharing = (0, import_chunk_ABYVSU2C.__esm)({
|
|
23866
23584
|
"src/readprg/sharing.ts"() {
|
|
23867
23585
|
"use strict";
|
|
23868
|
-
(0,
|
|
23586
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
23869
23587
|
init_bytecode();
|
|
23870
23588
|
init_opcodes();
|
|
23871
23589
|
}
|
|
@@ -23928,7 +23646,7 @@ function doArrayInits(func, liveInState, context) {
|
|
|
23928
23646
|
}
|
|
23929
23647
|
function simpleOpts(func, context) {
|
|
23930
23648
|
const equalsSym = 8388787;
|
|
23931
|
-
const logging3 = (0,
|
|
23649
|
+
const logging3 = (0, import_chunk_PVBIKZYZ.wouldLog)("optimize", 5);
|
|
23932
23650
|
return Array.from(func.blocks.values()).reduce((changes, block) => {
|
|
23933
23651
|
for (let i = block.bytecodes.length; i--; ) {
|
|
23934
23652
|
const cur = block.bytecodes[i];
|
|
@@ -23936,7 +23654,7 @@ function simpleOpts(func, context) {
|
|
|
23936
23654
|
block.bytecodes.splice(i, 1);
|
|
23937
23655
|
changes = true;
|
|
23938
23656
|
if (logging3) {
|
|
23939
|
-
(0,
|
|
23657
|
+
(0, import_chunk_PVBIKZYZ.log)(`${func.name}: deleting ${bytecodeToString(cur, null)}`);
|
|
23940
23658
|
}
|
|
23941
23659
|
} else if (i && cur.op === 39 && cur.arg === equalsSym) {
|
|
23942
23660
|
changes = equalSymbolToEq(block, i) || changes;
|
|
@@ -23947,7 +23665,7 @@ function simpleOpts(func, context) {
|
|
|
23947
23665
|
if (!shift && prev.op === 37) {
|
|
23948
23666
|
block.bytecodes.splice(i - 1, 2);
|
|
23949
23667
|
changes = true;
|
|
23950
|
-
logging3 && (0,
|
|
23668
|
+
logging3 && (0, import_chunk_PVBIKZYZ.log)(`${func.name}: deleting no-op shift (${shift})`);
|
|
23951
23669
|
continue;
|
|
23952
23670
|
}
|
|
23953
23671
|
if (shift < (prev.op === 49 ? 64n : 31n)) {
|
|
@@ -23957,7 +23675,7 @@ function simpleOpts(func, context) {
|
|
|
23957
23675
|
} else {
|
|
23958
23676
|
prev.arg = BigInt.asIntN(64, mul);
|
|
23959
23677
|
}
|
|
23960
|
-
logging3 && (0,
|
|
23678
|
+
logging3 && (0, import_chunk_PVBIKZYZ.log)(
|
|
23961
23679
|
`${func.name}: converting shlv(${shift}) to mulv(${prev.arg})`
|
|
23962
23680
|
);
|
|
23963
23681
|
changes = true;
|
|
@@ -23972,14 +23690,14 @@ function simpleOpts(func, context) {
|
|
|
23972
23690
|
func.blocks.get(block.taken).preds.delete(block.offset);
|
|
23973
23691
|
delete block.taken;
|
|
23974
23692
|
changes = true;
|
|
23975
|
-
logging3 && (0,
|
|
23693
|
+
logging3 && (0, import_chunk_PVBIKZYZ.log)(`${func.name}: deleting empty finally handler`);
|
|
23976
23694
|
} else if (isCondBranch(cur.op)) {
|
|
23977
23695
|
const next = func.blocks.get(block.next);
|
|
23978
23696
|
const taken = func.blocks.get(block.taken);
|
|
23979
23697
|
if (next.preds.size > 1 && taken.preds.size === 1) {
|
|
23980
23698
|
const newOp = cur.op === 40 ? 41 : 40;
|
|
23981
23699
|
if (logging3) {
|
|
23982
|
-
(0,
|
|
23700
|
+
(0, import_chunk_PVBIKZYZ.log)(
|
|
23983
23701
|
`${func.name}: converting ${Opcodes[cur.op]} to ${Opcodes[newOp]}`
|
|
23984
23702
|
);
|
|
23985
23703
|
}
|
|
@@ -23992,7 +23710,7 @@ function simpleOpts(func, context) {
|
|
|
23992
23710
|
const isBool = i >= 2 && isBoolOp(block.bytecodes[i - 2].op);
|
|
23993
23711
|
if (next.next === block.taken && next.taken == null && taken.bytecodes.length === 1 && isCondBranch(taken.bytecodes[0].op) && next.bytecodes.length > 1 && next.bytecodes[next.bytecodes.length - 1].op === (cur.op === 41 ? 7 : 8) && (isBool || next.bytecodes.length > 2 && isBoolOp(next.bytecodes[next.bytecodes.length - 2].op)) && next.preds?.size === 1 && taken.preds?.size === 2) {
|
|
23994
23712
|
if (logging3) {
|
|
23995
|
-
(0,
|
|
23713
|
+
(0, import_chunk_PVBIKZYZ.log)(
|
|
23996
23714
|
`${func.name}: simplifying ${next.bytecodes[next.bytecodes.length - 1].op === 7 ? "'&&'" : "'||'"} at ${offsetToString(block.offset)}:${offsetToString(
|
|
23997
23715
|
next.offset
|
|
23998
23716
|
)}:${offsetToString(taken.offset)}:`
|
|
@@ -24009,7 +23727,7 @@ function simpleOpts(func, context) {
|
|
|
24009
23727
|
changes = true;
|
|
24010
23728
|
} else if (taken.next === block.next && taken.taken == null && next.bytecodes.length === 1 && isCondBranch(next.bytecodes[0].op) && taken.bytecodes.length > 1 && taken.bytecodes[taken.bytecodes.length - 1].op === (cur.op === 40 ? 7 : 8) && (isBool || taken.bytecodes.length > 2 && isBoolOp(taken.bytecodes[taken.bytecodes.length - 2].op)) && next.preds?.size === 2 && taken.preds?.size === 1) {
|
|
24011
23729
|
if (logging3) {
|
|
24012
|
-
(0,
|
|
23730
|
+
(0, import_chunk_PVBIKZYZ.log)(
|
|
24013
23731
|
`${func.name}: simplifying ${taken.bytecodes[taken.bytecodes.length - 1].op === 7 ? "'&&'" : "'||'"} at ${offsetToString(block.offset)}:${offsetToString(
|
|
24014
23732
|
taken.offset
|
|
24015
23733
|
)}:${offsetToString(next.offset)}:`
|
|
@@ -24058,7 +23776,7 @@ function equalSymbolToEq(block, equalsIndex) {
|
|
|
24058
23776
|
offset: invokem.offset,
|
|
24059
23777
|
size: 1
|
|
24060
23778
|
});
|
|
24061
|
-
(0,
|
|
23779
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
24062
23780
|
"optimize",
|
|
24063
23781
|
1,
|
|
24064
23782
|
`Replacing <thing>.equals(:symbol) with <thing> eq :symbol at ${offsetToString(
|
|
@@ -24118,7 +23836,7 @@ function removeUnreachableCatches(func, context) {
|
|
|
24118
23836
|
const next = func.blocks.get(block.next);
|
|
24119
23837
|
if (block.try === next.try) {
|
|
24120
23838
|
if (next.preds.size === 1) {
|
|
24121
|
-
(0,
|
|
23839
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
24122
23840
|
"cfg",
|
|
24123
23841
|
1,
|
|
24124
23842
|
() => `${func.name}: ${offsetToString(
|
|
@@ -24141,7 +23859,7 @@ function removeUnreachableCatches(func, context) {
|
|
|
24141
23859
|
delete next.preds;
|
|
24142
23860
|
removeBlock(func, next.offset);
|
|
24143
23861
|
} else if (next.next == null && next.bytecodes.length < 3 && next.bytecodes.reduce((size, bc) => size + bc.size, 0) < 3 && countFallthroughPreds(func, next) > 1) {
|
|
24144
|
-
(0,
|
|
23862
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
24145
23863
|
"cfg",
|
|
24146
23864
|
1,
|
|
24147
23865
|
() => `${func.name}: ${offsetToString(
|
|
@@ -24166,7 +23884,7 @@ function removeUnreachableCatches(func, context) {
|
|
|
24166
23884
|
switch (last.op) {
|
|
24167
23885
|
case 41:
|
|
24168
23886
|
case 40:
|
|
24169
|
-
(0,
|
|
23887
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
24170
23888
|
"cfg",
|
|
24171
23889
|
1,
|
|
24172
23890
|
() => `${func.name}: killing no-op ${bytecodeToString(
|
|
@@ -24189,7 +23907,7 @@ function removeUnreachableCatches(func, context) {
|
|
|
24189
23907
|
for (let i = block.try.length; i--; ) {
|
|
24190
23908
|
const handler = block.try[i].handler;
|
|
24191
23909
|
if (!func.blocks.get(handler)?.preds?.size) {
|
|
24192
|
-
(0,
|
|
23910
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
24193
23911
|
"cfg",
|
|
24194
23912
|
1,
|
|
24195
23913
|
`${func.name}: killing unused try-catch at ${offsetToString(
|
|
@@ -24206,8 +23924,8 @@ function removeUnreachableCatches(func, context) {
|
|
|
24206
23924
|
});
|
|
24207
23925
|
}
|
|
24208
23926
|
function cleanCfg2(func, context) {
|
|
24209
|
-
if ((0,
|
|
24210
|
-
(0,
|
|
23927
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("cfg", 10)) {
|
|
23928
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(functionBanner(func, context, "sharing"));
|
|
24211
23929
|
}
|
|
24212
23930
|
removeNoOpBlocks(func);
|
|
24213
23931
|
removeUnreachableCatches(func, context);
|
|
@@ -24222,13 +23940,13 @@ function cleanCfg2(func, context) {
|
|
|
24222
23940
|
(0, import_node_assert12.default)(!block.preds?.size);
|
|
24223
23941
|
func.blocks.delete(block.offset);
|
|
24224
23942
|
});
|
|
24225
|
-
(0,
|
|
23943
|
+
(0, import_chunk_PVBIKZYZ.setBanner)(null);
|
|
24226
23944
|
}
|
|
24227
|
-
var init_optimize2 = (0,
|
|
23945
|
+
var init_optimize2 = (0, import_chunk_ABYVSU2C.__esm)({
|
|
24228
23946
|
"src/readprg/optimize.ts"() {
|
|
24229
23947
|
"use strict";
|
|
24230
23948
|
init_pre2();
|
|
24231
|
-
(0,
|
|
23949
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
24232
23950
|
init_array_init();
|
|
24233
23951
|
init_bytecode();
|
|
24234
23952
|
init_dce();
|
|
@@ -24389,7 +24107,7 @@ function groupBlocks(func) {
|
|
|
24389
24107
|
}
|
|
24390
24108
|
});
|
|
24391
24109
|
const isCfgNode = (node) => {
|
|
24392
|
-
return hasProperty(node, "items");
|
|
24110
|
+
return (0, import_chunk_MBTLUWXR.hasProperty)(node, "items");
|
|
24393
24111
|
};
|
|
24394
24112
|
const sortHelper = (node) => {
|
|
24395
24113
|
const itemsToSort = /* @__PURE__ */ new Set();
|
|
@@ -24517,10 +24235,10 @@ function getLocalsInfo(func) {
|
|
|
24517
24235
|
);
|
|
24518
24236
|
return { liveInLocals, liveOutLocals };
|
|
24519
24237
|
}
|
|
24520
|
-
var init_emit = (0,
|
|
24238
|
+
var init_emit = (0, import_chunk_ABYVSU2C.__esm)({
|
|
24521
24239
|
"src/readprg/emit.ts"() {
|
|
24522
24240
|
"use strict";
|
|
24523
|
-
init_ast();
|
|
24241
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
24524
24242
|
init_cflow();
|
|
24525
24243
|
init_opcodes();
|
|
24526
24244
|
init_optimize2();
|
|
@@ -24577,7 +24295,7 @@ function write24(view, current, value2) {
|
|
|
24577
24295
|
view.setUint8(current + 1, value2 >>> 8);
|
|
24578
24296
|
view.setUint8(current + 2, value2);
|
|
24579
24297
|
}
|
|
24580
|
-
var init_exceptions = (0,
|
|
24298
|
+
var init_exceptions = (0, import_chunk_ABYVSU2C.__esm)({
|
|
24581
24299
|
"src/readprg/exceptions.ts"() {
|
|
24582
24300
|
"use strict";
|
|
24583
24301
|
init_bytecode();
|
|
@@ -24634,7 +24352,7 @@ function fixupHeader(context, updateInfo) {
|
|
|
24634
24352
|
view.setUint32(25, offset);
|
|
24635
24353
|
}
|
|
24636
24354
|
}
|
|
24637
|
-
var init_header = (0,
|
|
24355
|
+
var init_header = (0, import_chunk_ABYVSU2C.__esm)({
|
|
24638
24356
|
"src/readprg/header.ts"() {
|
|
24639
24357
|
"use strict";
|
|
24640
24358
|
init_bytecode();
|
|
@@ -24741,7 +24459,7 @@ function fixupLineNum(context, updateInfo) {
|
|
|
24741
24459
|
});
|
|
24742
24460
|
});
|
|
24743
24461
|
}
|
|
24744
|
-
var init_linenum = (0,
|
|
24462
|
+
var init_linenum = (0, import_chunk_ABYVSU2C.__esm)({
|
|
24745
24463
|
"src/readprg/linenum.ts"() {
|
|
24746
24464
|
"use strict";
|
|
24747
24465
|
init_sdk_util();
|
|
@@ -24831,21 +24549,21 @@ function optimizeBytecode(context) {
|
|
|
24831
24549
|
functions.forEach(callback);
|
|
24832
24550
|
return;
|
|
24833
24551
|
}
|
|
24834
|
-
(0,
|
|
24552
|
+
(0, import_chunk_PVBIKZYZ.bumpLogging)(null, 10);
|
|
24835
24553
|
functions.forEach((func) => {
|
|
24836
24554
|
if (loggerFunc.test(func.name ?? "<null>")) {
|
|
24837
|
-
(0,
|
|
24555
|
+
(0, import_chunk_PVBIKZYZ.bumpLogging)(null, -10);
|
|
24838
24556
|
callback(func);
|
|
24839
|
-
(0,
|
|
24557
|
+
(0, import_chunk_PVBIKZYZ.bumpLogging)(null, 10);
|
|
24840
24558
|
return;
|
|
24841
24559
|
}
|
|
24842
24560
|
callback(func);
|
|
24843
24561
|
});
|
|
24844
|
-
(0,
|
|
24562
|
+
(0, import_chunk_PVBIKZYZ.bumpLogging)(null, -10);
|
|
24845
24563
|
};
|
|
24846
|
-
if ((0,
|
|
24564
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("list-input", 1)) {
|
|
24847
24565
|
forEachFunction(
|
|
24848
|
-
(func) => (0,
|
|
24566
|
+
(func) => (0, import_chunk_PVBIKZYZ.wouldLog)("list-input", 1) && printFunction(func, context)
|
|
24849
24567
|
);
|
|
24850
24568
|
}
|
|
24851
24569
|
forEachFunction((func) => optimizeFunc(func, context));
|
|
@@ -24863,7 +24581,7 @@ function optimizeBytecode(context) {
|
|
|
24863
24581
|
forEachFunction((func) => {
|
|
24864
24582
|
if (!func.name)
|
|
24865
24583
|
return;
|
|
24866
|
-
(0,
|
|
24584
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
24867
24585
|
"bytecode",
|
|
24868
24586
|
5,
|
|
24869
24587
|
`${func.name}: ${offset.toString(16)} ${offset - func.offset}`
|
|
@@ -24872,7 +24590,7 @@ function optimizeBytecode(context) {
|
|
|
24872
24590
|
});
|
|
24873
24591
|
const { offsetMap } = updateInfo;
|
|
24874
24592
|
offsetMap.set(code.byteLength, offset);
|
|
24875
|
-
(0,
|
|
24593
|
+
(0, import_chunk_PVBIKZYZ.logger)(
|
|
24876
24594
|
"bytecode",
|
|
24877
24595
|
1,
|
|
24878
24596
|
`${context.filepath}: code size: ${context.sections[
|
|
@@ -24884,9 +24602,9 @@ function optimizeBytecode(context) {
|
|
|
24884
24602
|
].length - offset}`
|
|
24885
24603
|
);
|
|
24886
24604
|
fixSectionSize(-1059145026, context.sections, offset);
|
|
24887
|
-
if ((0,
|
|
24605
|
+
if ((0, import_chunk_PVBIKZYZ.wouldLog)("list-output", 1)) {
|
|
24888
24606
|
forEachFunction(
|
|
24889
|
-
(func) => (0,
|
|
24607
|
+
(func) => (0, import_chunk_PVBIKZYZ.wouldLog)("list-output", 1) && printFunction(func, context)
|
|
24890
24608
|
);
|
|
24891
24609
|
}
|
|
24892
24610
|
fixupHeader(context, updateInfo);
|
|
@@ -24976,7 +24694,7 @@ ${functionToString(
|
|
|
24976
24694
|
---------------- ${func.name} ----------------`;
|
|
24977
24695
|
}
|
|
24978
24696
|
function printFunction(func, context) {
|
|
24979
|
-
(0,
|
|
24697
|
+
(0, import_chunk_PVBIKZYZ.log)(functionToString(func, context));
|
|
24980
24698
|
}
|
|
24981
24699
|
function functionToString(func, context, extra) {
|
|
24982
24700
|
const parts = [];
|
|
@@ -25063,7 +24781,7 @@ function bytecodeToString(bytecode, symbolTable) {
|
|
|
25063
24781
|
break;
|
|
25064
24782
|
}
|
|
25065
24783
|
}
|
|
25066
|
-
if (arg == null && hasProperty(bytecode, "arg")) {
|
|
24784
|
+
if (arg == null && (0, import_chunk_MBTLUWXR.hasProperty)(bytecode, "arg")) {
|
|
25067
24785
|
arg = `${bytecode.arg}`;
|
|
25068
24786
|
}
|
|
25069
24787
|
if (arg != null) {
|
|
@@ -25384,12 +25102,12 @@ function countFallthroughPreds(func, block) {
|
|
|
25384
25102
|
}, 0);
|
|
25385
25103
|
}
|
|
25386
25104
|
var SectionKinds;
|
|
25387
|
-
var init_bytecode = (0,
|
|
25105
|
+
var init_bytecode = (0, import_chunk_ABYVSU2C.__esm)({
|
|
25388
25106
|
"src/readprg/bytecode.ts"() {
|
|
25389
25107
|
"use strict";
|
|
25390
|
-
init_ast();
|
|
25108
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
25391
25109
|
init_sdk_util();
|
|
25392
|
-
(0,
|
|
25110
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
25393
25111
|
init_data();
|
|
25394
25112
|
init_emit();
|
|
25395
25113
|
init_exceptions();
|
|
@@ -25500,7 +25218,7 @@ function signView(key, view) {
|
|
|
25500
25218
|
signer.end();
|
|
25501
25219
|
return signer.sign(key);
|
|
25502
25220
|
}
|
|
25503
|
-
var init_signer = (0,
|
|
25221
|
+
var init_signer = (0, import_chunk_ABYVSU2C.__esm)({
|
|
25504
25222
|
"src/readprg/signer.ts"() {
|
|
25505
25223
|
"use strict";
|
|
25506
25224
|
init_bytecode();
|
|
@@ -25514,7 +25232,7 @@ function hash(s) {
|
|
|
25514
25232
|
return (h ^ h >>> 9) >>> 0;
|
|
25515
25233
|
}
|
|
25516
25234
|
var SymbolTable;
|
|
25517
|
-
var init_symbols = (0,
|
|
25235
|
+
var init_symbols = (0, import_chunk_ABYVSU2C.__esm)({
|
|
25518
25236
|
"src/readprg/symbols.ts"() {
|
|
25519
25237
|
"use strict";
|
|
25520
25238
|
SymbolTable = class {
|
|
@@ -25673,20 +25391,20 @@ async function build_project(product, options, lineCallback) {
|
|
|
25673
25391
|
lineCallback || ((line) => console.log(line)),
|
|
25674
25392
|
(line) => console.error(line)
|
|
25675
25393
|
];
|
|
25676
|
-
await (0,
|
|
25394
|
+
await (0, import_chunk_PVBIKZYZ.spawnByLine)(exe, args, handlers, {
|
|
25677
25395
|
cwd: workspace
|
|
25678
25396
|
});
|
|
25679
25397
|
}
|
|
25680
25398
|
return { exe, args, program: path.resolve(workspace, program), product };
|
|
25681
25399
|
}
|
|
25682
|
-
var init_build = (0,
|
|
25400
|
+
var init_build = (0, import_chunk_ABYVSU2C.__esm)({
|
|
25683
25401
|
"src/build.ts"() {
|
|
25684
25402
|
"use strict";
|
|
25685
25403
|
init_sdk_util();
|
|
25686
|
-
(0,
|
|
25404
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
25687
25405
|
}
|
|
25688
25406
|
});
|
|
25689
|
-
var require_ms = (0,
|
|
25407
|
+
var require_ms = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
25690
25408
|
"node_modules/ms/index.js"(exports, module2) {
|
|
25691
25409
|
var s = 1e3;
|
|
25692
25410
|
var m = s * 60;
|
|
@@ -25800,7 +25518,7 @@ var require_ms = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
25800
25518
|
}
|
|
25801
25519
|
}
|
|
25802
25520
|
});
|
|
25803
|
-
var require_common = (0,
|
|
25521
|
+
var require_common = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
25804
25522
|
"node_modules/debug/src/common.js"(exports, module2) {
|
|
25805
25523
|
function setup(env) {
|
|
25806
25524
|
createDebug.debug = createDebug;
|
|
@@ -25961,7 +25679,7 @@ var require_common = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
25961
25679
|
module2.exports = setup;
|
|
25962
25680
|
}
|
|
25963
25681
|
});
|
|
25964
|
-
var require_browser = (0,
|
|
25682
|
+
var require_browser = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
25965
25683
|
"node_modules/debug/src/browser.js"(exports, module2) {
|
|
25966
25684
|
exports.formatArgs = formatArgs;
|
|
25967
25685
|
exports.save = save;
|
|
@@ -26128,7 +25846,7 @@ var require_browser = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26128
25846
|
};
|
|
26129
25847
|
}
|
|
26130
25848
|
});
|
|
26131
|
-
var require_has_flag = (0,
|
|
25849
|
+
var require_has_flag = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26132
25850
|
"node_modules/has-flag/index.js"(exports, module2) {
|
|
26133
25851
|
"use strict";
|
|
26134
25852
|
module2.exports = (flag, argv = process.argv) => {
|
|
@@ -26139,11 +25857,11 @@ var require_has_flag = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26139
25857
|
};
|
|
26140
25858
|
}
|
|
26141
25859
|
});
|
|
26142
|
-
var require_supports_color = (0,
|
|
25860
|
+
var require_supports_color = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26143
25861
|
"node_modules/supports-color/index.js"(exports, module2) {
|
|
26144
25862
|
"use strict";
|
|
26145
|
-
var os2 = (0,
|
|
26146
|
-
var tty = (0,
|
|
25863
|
+
var os2 = (0, import_chunk_ABYVSU2C.__require)("os");
|
|
25864
|
+
var tty = (0, import_chunk_ABYVSU2C.__require)("tty");
|
|
26147
25865
|
var hasFlag = require_has_flag();
|
|
26148
25866
|
var { env } = process;
|
|
26149
25867
|
var forceColor;
|
|
@@ -26239,10 +25957,10 @@ var require_supports_color = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26239
25957
|
};
|
|
26240
25958
|
}
|
|
26241
25959
|
});
|
|
26242
|
-
var require_node = (0,
|
|
25960
|
+
var require_node = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26243
25961
|
"node_modules/debug/src/node.js"(exports, module2) {
|
|
26244
|
-
var tty = (0,
|
|
26245
|
-
var util = (0,
|
|
25962
|
+
var tty = (0, import_chunk_ABYVSU2C.__require)("tty");
|
|
25963
|
+
var util = (0, import_chunk_ABYVSU2C.__require)("util");
|
|
26246
25964
|
exports.init = init;
|
|
26247
25965
|
exports.log = log2;
|
|
26248
25966
|
exports.formatArgs = formatArgs;
|
|
@@ -26411,7 +26129,7 @@ var require_node = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26411
26129
|
};
|
|
26412
26130
|
}
|
|
26413
26131
|
});
|
|
26414
|
-
var require_src = (0,
|
|
26132
|
+
var require_src = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26415
26133
|
"node_modules/debug/src/index.js"(exports, module2) {
|
|
26416
26134
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
26417
26135
|
module2.exports = require_browser();
|
|
@@ -26420,7 +26138,7 @@ var require_src = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26420
26138
|
}
|
|
26421
26139
|
}
|
|
26422
26140
|
});
|
|
26423
|
-
var require_wrappy = (0,
|
|
26141
|
+
var require_wrappy = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26424
26142
|
"node_modules/wrappy/wrappy.js"(exports, module2) {
|
|
26425
26143
|
module2.exports = wrappy;
|
|
26426
26144
|
function wrappy(fn, cb) {
|
|
@@ -26449,7 +26167,7 @@ var require_wrappy = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26449
26167
|
}
|
|
26450
26168
|
}
|
|
26451
26169
|
});
|
|
26452
|
-
var require_once = (0,
|
|
26170
|
+
var require_once = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26453
26171
|
"node_modules/once/once.js"(exports, module2) {
|
|
26454
26172
|
var wrappy = require_wrappy();
|
|
26455
26173
|
module2.exports = wrappy(once);
|
|
@@ -26492,7 +26210,7 @@ var require_once = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26492
26210
|
}
|
|
26493
26211
|
}
|
|
26494
26212
|
});
|
|
26495
|
-
var require_end_of_stream = (0,
|
|
26213
|
+
var require_end_of_stream = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26496
26214
|
"node_modules/end-of-stream/index.js"(exports, module2) {
|
|
26497
26215
|
var once = require_once();
|
|
26498
26216
|
var noop = function() {
|
|
@@ -26585,11 +26303,11 @@ var require_end_of_stream = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26585
26303
|
module2.exports = eos;
|
|
26586
26304
|
}
|
|
26587
26305
|
});
|
|
26588
|
-
var require_pump = (0,
|
|
26306
|
+
var require_pump = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26589
26307
|
"node_modules/pump/index.js"(exports, module2) {
|
|
26590
26308
|
var once = require_once();
|
|
26591
26309
|
var eos = require_end_of_stream();
|
|
26592
|
-
var fs9 = (0,
|
|
26310
|
+
var fs9 = (0, import_chunk_ABYVSU2C.__require)("fs");
|
|
26593
26311
|
var noop = function() {
|
|
26594
26312
|
};
|
|
26595
26313
|
var ancient = /^v?\.0/.test(process.version);
|
|
@@ -26667,10 +26385,10 @@ var require_pump = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26667
26385
|
module2.exports = pump;
|
|
26668
26386
|
}
|
|
26669
26387
|
});
|
|
26670
|
-
var require_buffer_stream = (0,
|
|
26388
|
+
var require_buffer_stream = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26671
26389
|
"node_modules/get-stream/buffer-stream.js"(exports, module2) {
|
|
26672
26390
|
"use strict";
|
|
26673
|
-
var { PassThrough: PassThroughStream } = (0,
|
|
26391
|
+
var { PassThrough: PassThroughStream } = (0, import_chunk_ABYVSU2C.__require)("stream");
|
|
26674
26392
|
module2.exports = (options) => {
|
|
26675
26393
|
options = { ...options };
|
|
26676
26394
|
const { array } = options;
|
|
@@ -26710,10 +26428,10 @@ var require_buffer_stream = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26710
26428
|
};
|
|
26711
26429
|
}
|
|
26712
26430
|
});
|
|
26713
|
-
var require_get_stream = (0,
|
|
26431
|
+
var require_get_stream = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26714
26432
|
"node_modules/get-stream/index.js"(exports, module2) {
|
|
26715
26433
|
"use strict";
|
|
26716
|
-
var { constants: BufferConstants } = (0,
|
|
26434
|
+
var { constants: BufferConstants } = (0, import_chunk_ABYVSU2C.__require)("buffer");
|
|
26717
26435
|
var pump = require_pump();
|
|
26718
26436
|
var bufferStream = require_buffer_stream();
|
|
26719
26437
|
var MaxBufferError = class extends Error {
|
|
@@ -26761,14 +26479,14 @@ var require_get_stream = (0, import_chunk_YZ44IUV6.__commonJS)({
|
|
|
26761
26479
|
module2.exports.MaxBufferError = MaxBufferError;
|
|
26762
26480
|
}
|
|
26763
26481
|
});
|
|
26764
|
-
var require_extract_zip = (0,
|
|
26482
|
+
var require_extract_zip = (0, import_chunk_ABYVSU2C.__commonJS)({
|
|
26765
26483
|
"node_modules/extract-zip/index.js"(exports, module2) {
|
|
26766
26484
|
var debug = require_src()("extract-zip");
|
|
26767
|
-
var { createWriteStream: createWriteStream2, promises: fs9 } = (0,
|
|
26485
|
+
var { createWriteStream: createWriteStream2, promises: fs9 } = (0, import_chunk_ABYVSU2C.__require)("fs");
|
|
26768
26486
|
var getStream = require_get_stream();
|
|
26769
|
-
var path7 = (0,
|
|
26770
|
-
var { promisify } = (0,
|
|
26771
|
-
var stream = (0,
|
|
26487
|
+
var path7 = (0, import_chunk_ABYVSU2C.__require)("path");
|
|
26488
|
+
var { promisify } = (0, import_chunk_ABYVSU2C.__require)("util");
|
|
26489
|
+
var stream = (0, import_chunk_ABYVSU2C.__require)("stream");
|
|
26772
26490
|
var yauzl2 = require_yauzl();
|
|
26773
26491
|
var openZip = promisify(yauzl2.open);
|
|
26774
26492
|
var pipeline = promisify(stream.pipeline);
|
|
@@ -28399,7 +28117,7 @@ function peg$parse2(input, options) {
|
|
|
28399
28117
|
);
|
|
28400
28118
|
}
|
|
28401
28119
|
}
|
|
28402
|
-
var init_jungle = (0,
|
|
28120
|
+
var init_jungle = (0, import_chunk_ABYVSU2C.__esm)({
|
|
28403
28121
|
"src/jungle.peggy"() {
|
|
28404
28122
|
"use strict";
|
|
28405
28123
|
peg$subclass2(peg$SyntaxError2, Error);
|
|
@@ -28625,14 +28343,14 @@ async function checkManifest(manifest, products) {
|
|
|
28625
28343
|
});
|
|
28626
28344
|
return ok;
|
|
28627
28345
|
}
|
|
28628
|
-
var init_manifest = (0,
|
|
28346
|
+
var init_manifest = (0, import_chunk_ABYVSU2C.__esm)({
|
|
28629
28347
|
"src/manifest.ts"() {
|
|
28630
28348
|
"use strict";
|
|
28631
28349
|
init_sdk_util();
|
|
28632
28350
|
}
|
|
28633
28351
|
});
|
|
28634
28352
|
function isJNode(obj) {
|
|
28635
|
-
return hasProperty(obj, "type");
|
|
28353
|
+
return (0, import_chunk_MBTLUWXR.hasProperty)(obj, "type");
|
|
28636
28354
|
}
|
|
28637
28355
|
async function default_jungle() {
|
|
28638
28356
|
const assignments = [];
|
|
@@ -28668,11 +28386,11 @@ async function default_jungle() {
|
|
|
28668
28386
|
);
|
|
28669
28387
|
}
|
|
28670
28388
|
const shape = match[1];
|
|
28671
|
-
if (!hasProperty(done, shape)) {
|
|
28389
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(done, shape)) {
|
|
28672
28390
|
rezAndLang(shape, `resources-${shape}`, "base");
|
|
28673
28391
|
done[shape] = true;
|
|
28674
28392
|
}
|
|
28675
|
-
if (!hasProperty(done, deviceFamily)) {
|
|
28393
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(done, deviceFamily)) {
|
|
28676
28394
|
rezAndLang(deviceFamily, `resources-${deviceFamily}`, shape);
|
|
28677
28395
|
done[deviceFamily] = true;
|
|
28678
28396
|
}
|
|
@@ -28685,7 +28403,7 @@ function process_assignments(assignments, current) {
|
|
|
28685
28403
|
return assignments.reduce((state, a) => {
|
|
28686
28404
|
const { node, dot, dotnames } = a.names.reduce(
|
|
28687
28405
|
(r, name) => {
|
|
28688
|
-
if (!hasProperty(r.node, name))
|
|
28406
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(r.node, name))
|
|
28689
28407
|
r.node[name] = {};
|
|
28690
28408
|
r.dotnames.push(name);
|
|
28691
28409
|
r.node = r.node[name];
|
|
@@ -28745,7 +28463,7 @@ function evaluate_locals(assignments) {
|
|
|
28745
28463
|
const process_list = (values) => {
|
|
28746
28464
|
for (let i = values.length; i--; ) {
|
|
28747
28465
|
const v = values[i];
|
|
28748
|
-
if (v.type === "QualifiedName" && v.names.length === 1 && hasProperty(locals, v.names[0])) {
|
|
28466
|
+
if (v.type === "QualifiedName" && v.names.length === 1 && (0, import_chunk_MBTLUWXR.hasProperty)(locals, v.names[0])) {
|
|
28749
28467
|
values.splice(i, 1, ...locals[v.names[0]]);
|
|
28750
28468
|
} else if (v.type === "SubList") {
|
|
28751
28469
|
process_list(v.values);
|
|
@@ -28880,9 +28598,9 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
|
28880
28598
|
/[\\/]\*\*([^\\/])/g,
|
|
28881
28599
|
"/**/*$1"
|
|
28882
28600
|
);
|
|
28883
|
-
if (!hasProperty(cache.resolvedPaths, resolved)) {
|
|
28601
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(cache.resolvedPaths, resolved)) {
|
|
28884
28602
|
if (/[*?[\]{}]/.test(resolved)) {
|
|
28885
|
-
cache.resolvedPaths[resolved] = (0,
|
|
28603
|
+
cache.resolvedPaths[resolved] = (0, import_chunk_PVBIKZYZ.globSome)(resolved, () => true);
|
|
28886
28604
|
} else {
|
|
28887
28605
|
cache.resolvedPaths[resolved] = fs5.stat(resolved).then(() => true).catch(() => false);
|
|
28888
28606
|
}
|
|
@@ -28928,7 +28646,7 @@ async function resolve_literals(qualifier, default_source, deviceInfo, cache) {
|
|
|
28928
28646
|
resolve_literal_list(qualifier, "excludeAnnotations");
|
|
28929
28647
|
const annotations = {};
|
|
28930
28648
|
Object.entries(qualifier).forEach(([k, v]) => {
|
|
28931
|
-
if (hasProperty(v, "annotations")) {
|
|
28649
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(v, "annotations")) {
|
|
28932
28650
|
annotations[k] = v["annotations"];
|
|
28933
28651
|
resolve_literal_list(annotations, k);
|
|
28934
28652
|
delete qualifier[k];
|
|
@@ -28949,20 +28667,20 @@ async function read_resource_files(targets, cache) {
|
|
|
28949
28667
|
if (!p.qualifier.resourcePath)
|
|
28950
28668
|
return null;
|
|
28951
28669
|
const key = p.qualifier.resourcePath.join(";");
|
|
28952
|
-
if (!hasProperty(resourceGroupPromises, key)) {
|
|
28670
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(resourceGroupPromises, key)) {
|
|
28953
28671
|
resourceGroupPromises[key] = Promise.all(
|
|
28954
28672
|
p.qualifier.resourcePath.map(
|
|
28955
|
-
(pattern) => (0,
|
|
28673
|
+
(pattern) => (0, import_chunk_PVBIKZYZ.globa)(pattern, { mark: true })
|
|
28956
28674
|
)
|
|
28957
28675
|
).then(
|
|
28958
28676
|
(patterns) => Promise.all(
|
|
28959
28677
|
patterns.flat().map(
|
|
28960
|
-
(path7) => path7.endsWith("/") ? (0,
|
|
28678
|
+
(path7) => path7.endsWith("/") ? (0, import_chunk_PVBIKZYZ.globa)(`${path7}**/*.xml`, { mark: true }) : path7
|
|
28961
28679
|
)
|
|
28962
28680
|
).then(
|
|
28963
28681
|
(paths) => Promise.all(
|
|
28964
28682
|
paths.flat().filter((file) => file.endsWith(".xml")).map((file) => {
|
|
28965
|
-
if (!hasProperty(cache.resources, file)) {
|
|
28683
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(cache.resources, file)) {
|
|
28966
28684
|
cache.resources[file] = fs5.readFile(file).then(
|
|
28967
28685
|
(data) => xml_util_exports.parseXml(data.toString(), file)
|
|
28968
28686
|
);
|
|
@@ -29021,7 +28739,7 @@ async function find_build_instructions_in_resource(file, rez, buildDependencies)
|
|
|
29021
28739
|
const sourceExcludes = excludes.map((e) => e.file?.value.value).filter((f) => f != null).map((f) => path2.resolve(dir, f).replace(/\\/g, "/"));
|
|
29022
28740
|
const filePatterns = excludes.map((e) => e.dir?.value.value).filter((f) => f != null).map((f) => path2.join(dir, f, "**", "*.mc").replace(/\\/g, "/"));
|
|
29023
28741
|
if (filePatterns.length) {
|
|
29024
|
-
const files = (await Promise.all(filePatterns.map((p) => (0,
|
|
28742
|
+
const files = (await Promise.all(filePatterns.map((p) => (0, import_chunk_PVBIKZYZ.globa)(p)))).flat();
|
|
29025
28743
|
sourceExcludes.push(...files);
|
|
29026
28744
|
}
|
|
29027
28745
|
const excludeAnnotations = excludes.map((e) => e.annotation?.value.value).filter((f) => f != null);
|
|
@@ -29033,9 +28751,9 @@ async function find_build_instructions(targets, resourceGroups, buildDependencie
|
|
|
29033
28751
|
if (!p.qualifier.resourcePath)
|
|
29034
28752
|
return;
|
|
29035
28753
|
const key = p.qualifier.resourcePath.join(";");
|
|
29036
|
-
if (!hasProperty(resourceGroups, key))
|
|
28754
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(resourceGroups, key))
|
|
29037
28755
|
return;
|
|
29038
|
-
if (!hasProperty(resourceGroups[key], "buildInstructions")) {
|
|
28756
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(resourceGroups[key], "buildInstructions")) {
|
|
29039
28757
|
resourceGroups[key].buildInstructions = (await Promise.all(
|
|
29040
28758
|
resourceGroups[key].resourceFiles.map(
|
|
29041
28759
|
({ path: path7, resources }) => find_build_instructions_in_resource(
|
|
@@ -29072,7 +28790,7 @@ function identify_optimizer_groups(targets, options) {
|
|
|
29072
28790
|
if (option === "*") {
|
|
29073
28791
|
return [];
|
|
29074
28792
|
} else {
|
|
29075
|
-
return strs.filter((a) => !hasProperty(option, a));
|
|
28793
|
+
return strs.filter((a) => !(0, import_chunk_MBTLUWXR.hasProperty)(option, a));
|
|
29076
28794
|
}
|
|
29077
28795
|
};
|
|
29078
28796
|
const ignoreRegExpOption = (str) => {
|
|
@@ -29095,7 +28813,7 @@ function identify_optimizer_groups(targets, options) {
|
|
|
29095
28813
|
target.qualifier.sourcePath.forEach((path7) => {
|
|
29096
28814
|
const m = path7.match(ignoredSourcePathsRe);
|
|
29097
28815
|
const key2 = m ? "key-" + m.slice(1).join("") : path7;
|
|
29098
|
-
if (!hasProperty(state.keys, key2)) {
|
|
28816
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(state.keys, key2)) {
|
|
29099
28817
|
state.keys[key2] = {};
|
|
29100
28818
|
}
|
|
29101
28819
|
state.keys[key2][path7] = true;
|
|
@@ -29161,7 +28879,7 @@ function identify_optimizer_groups(targets, options) {
|
|
|
29161
28879
|
}
|
|
29162
28880
|
return toSortedEntries(value2);
|
|
29163
28881
|
});
|
|
29164
|
-
if (!hasProperty(groups, serialized)) {
|
|
28882
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(groups, serialized)) {
|
|
29165
28883
|
groups[serialized] = {
|
|
29166
28884
|
key: "group" + key.toString().padStart(3, "0"),
|
|
29167
28885
|
optimizerConfig
|
|
@@ -29178,15 +28896,15 @@ function identify_optimizer_groups(targets, options) {
|
|
|
29178
28896
|
function find_barrels(barrelPath) {
|
|
29179
28897
|
if (Array.isArray(barrelPath)) {
|
|
29180
28898
|
return Promise.all(
|
|
29181
|
-
barrelPath.map((path7) => (0,
|
|
28899
|
+
barrelPath.map((path7) => (0, import_chunk_PVBIKZYZ.globa)(path7, { mark: true }))
|
|
29182
28900
|
).then((paths) => [
|
|
29183
28901
|
paths.flat().filter((path7) => path7.endsWith(".jungle")).join(";")
|
|
29184
28902
|
]);
|
|
29185
28903
|
}
|
|
29186
|
-
return (0,
|
|
28904
|
+
return (0, import_chunk_PVBIKZYZ.globa)(barrelPath, { mark: true }).then(
|
|
29187
28905
|
(paths) => Promise.all(
|
|
29188
28906
|
paths.map(
|
|
29189
|
-
(path7) => path7.endsWith("/") ? (0,
|
|
28907
|
+
(path7) => path7.endsWith("/") ? (0, import_chunk_PVBIKZYZ.globa)(`${path7}**/*.barrel`) : path7
|
|
29190
28908
|
)
|
|
29191
28909
|
)
|
|
29192
28910
|
).then(
|
|
@@ -29194,7 +28912,7 @@ function find_barrels(barrelPath) {
|
|
|
29194
28912
|
);
|
|
29195
28913
|
}
|
|
29196
28914
|
function resolve_barrel(barrel, barrelDir, products, options, cache, buildDependencies) {
|
|
29197
|
-
if (hasProperty(cache.barrels, barrel)) {
|
|
28915
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(cache.barrels, barrel)) {
|
|
29198
28916
|
return cache.barrels[barrel];
|
|
29199
28917
|
}
|
|
29200
28918
|
let promise = Promise.resolve();
|
|
@@ -29262,7 +28980,7 @@ function resolve_barrels(product, qualifier, barrels, products, options, cache,
|
|
|
29262
28980
|
return result;
|
|
29263
28981
|
}, {});
|
|
29264
28982
|
};
|
|
29265
|
-
if (hasProperty(cache.barrelMap, barrelMapKey)) {
|
|
28983
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(cache.barrelMap, barrelMapKey)) {
|
|
29266
28984
|
setBarrelMap(cache.barrelMap[barrelMapKey]);
|
|
29267
28985
|
return null;
|
|
29268
28986
|
}
|
|
@@ -29294,7 +29012,7 @@ function resolve_barrels(product, qualifier, barrels, products, options, cache,
|
|
|
29294
29012
|
resolvedBarrel.manifest,
|
|
29295
29013
|
resolvedBarrel.xml
|
|
29296
29014
|
);
|
|
29297
|
-
if (!hasProperty(barrelMap, name))
|
|
29015
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(barrelMap, name))
|
|
29298
29016
|
return;
|
|
29299
29017
|
const bmapName = barrelMap[name];
|
|
29300
29018
|
if (bmapName) {
|
|
@@ -29350,7 +29068,7 @@ async function get_jungle_and_barrels(jungleFiles, defaultProducts, options, cac
|
|
|
29350
29068
|
if (!options.workspace) {
|
|
29351
29069
|
options.workspace = path2.dirname(manifest);
|
|
29352
29070
|
}
|
|
29353
|
-
if (!hasProperty(cache.resources, manifest)) {
|
|
29071
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(cache.resources, manifest)) {
|
|
29354
29072
|
cache.resources[manifest] = readManifest(manifest);
|
|
29355
29073
|
}
|
|
29356
29074
|
const xml = await Promise.resolve(cache.resources[manifest]);
|
|
@@ -29392,7 +29110,7 @@ async function get_jungle_and_barrels(jungleFiles, defaultProducts, options, cac
|
|
|
29392
29110
|
});
|
|
29393
29111
|
};
|
|
29394
29112
|
products.forEach((product) => {
|
|
29395
|
-
if (hasProperty(state, product)) {
|
|
29113
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(state, product)) {
|
|
29396
29114
|
const sp = state[product];
|
|
29397
29115
|
if (sp && !Array.isArray(sp) && sp.products) {
|
|
29398
29116
|
sp.products.forEach((p) => add_one(p, product));
|
|
@@ -29451,15 +29169,15 @@ async function get_jungle(jungles, options, resources) {
|
|
|
29451
29169
|
return result;
|
|
29452
29170
|
}
|
|
29453
29171
|
var import_extract_zip;
|
|
29454
|
-
var init_jungles = (0,
|
|
29172
|
+
var init_jungles = (0, import_chunk_ABYVSU2C.__esm)({
|
|
29455
29173
|
"src/jungles.ts"() {
|
|
29456
29174
|
"use strict";
|
|
29457
|
-
import_extract_zip = (0,
|
|
29175
|
+
import_extract_zip = (0, import_chunk_ABYVSU2C.__toESM)(require_extract_zip());
|
|
29458
29176
|
init_jungle();
|
|
29459
29177
|
init_api();
|
|
29460
29178
|
init_manifest();
|
|
29461
29179
|
init_sdk_util();
|
|
29462
|
-
(0,
|
|
29180
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
29463
29181
|
}
|
|
29464
29182
|
});
|
|
29465
29183
|
async function launchSimulator(force = true) {
|
|
@@ -29517,7 +29235,7 @@ function simulateProgram(prg, device, test = false, logger2) {
|
|
|
29517
29235
|
}
|
|
29518
29236
|
}
|
|
29519
29237
|
return getSdkPath().then(
|
|
29520
|
-
(sdk) => (0,
|
|
29238
|
+
(sdk) => (0, import_chunk_PVBIKZYZ.spawnByLine)(
|
|
29521
29239
|
path3.resolve(sdk, "bin", isWin ? "monkeydo.bat" : "monkeydo"),
|
|
29522
29240
|
args,
|
|
29523
29241
|
logger2 || ((line) => console.log(line))
|
|
@@ -29526,11 +29244,11 @@ function simulateProgram(prg, device, test = false, logger2) {
|
|
|
29526
29244
|
})
|
|
29527
29245
|
);
|
|
29528
29246
|
}
|
|
29529
|
-
var init_launch = (0,
|
|
29247
|
+
var init_launch = (0, import_chunk_ABYVSU2C.__esm)({
|
|
29530
29248
|
"src/launch.ts"() {
|
|
29531
29249
|
"use strict";
|
|
29532
29250
|
init_sdk_util();
|
|
29533
|
-
(0,
|
|
29251
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
29534
29252
|
}
|
|
29535
29253
|
});
|
|
29536
29254
|
function relative_path_no_dotdot(relative2) {
|
|
@@ -29548,7 +29266,7 @@ async function getVSCodeSettings(path7) {
|
|
|
29548
29266
|
}
|
|
29549
29267
|
}
|
|
29550
29268
|
function isErrorWithLocation(e) {
|
|
29551
|
-
return hasProperty(e, "location");
|
|
29269
|
+
return (0, import_chunk_MBTLUWXR.hasProperty)(e, "location");
|
|
29552
29270
|
}
|
|
29553
29271
|
function getConfig(options) {
|
|
29554
29272
|
const config = { ...defaultConfig, ...options || {} };
|
|
@@ -29586,7 +29304,7 @@ async function buildOptimizedProject(product, options) {
|
|
|
29586
29304
|
config.products = [product];
|
|
29587
29305
|
} else {
|
|
29588
29306
|
delete config.testBuild;
|
|
29589
|
-
if (!hasProperty(config, "releaseBuild")) {
|
|
29307
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(config, "releaseBuild")) {
|
|
29590
29308
|
config.releaseBuild = true;
|
|
29591
29309
|
}
|
|
29592
29310
|
}
|
|
@@ -29642,7 +29360,7 @@ async function createLocalBarrels(targets, options) {
|
|
|
29642
29360
|
);
|
|
29643
29361
|
const sha1 = crypto3.createHash("sha1").update(rawBarrelDir, "binary").digest("base64").replace(/[/=+]/g, "");
|
|
29644
29362
|
const optBarrelDir = path4.resolve(barrelDir, `${barrel}-${sha1}`);
|
|
29645
|
-
if (!hasProperty(optBarrels, barrel)) {
|
|
29363
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(optBarrels, barrel)) {
|
|
29646
29364
|
optBarrels[barrel] = {
|
|
29647
29365
|
rawBarrelDir,
|
|
29648
29366
|
manifest,
|
|
@@ -29650,7 +29368,7 @@ async function createLocalBarrels(targets, options) {
|
|
|
29650
29368
|
optBarrelDir
|
|
29651
29369
|
};
|
|
29652
29370
|
return promise2.then(
|
|
29653
|
-
() => (0,
|
|
29371
|
+
() => (0, import_chunk_PVBIKZYZ.copyRecursiveAsNeeded)(
|
|
29654
29372
|
rawBarrelDir,
|
|
29655
29373
|
optBarrelDir,
|
|
29656
29374
|
(src) => !src.endsWith(".mc")
|
|
@@ -29724,7 +29442,7 @@ async function generateOptimizedProject(options) {
|
|
|
29724
29442
|
throw new Error(`Missing group in build target ${p.product}`);
|
|
29725
29443
|
}
|
|
29726
29444
|
const key = configKey(p);
|
|
29727
|
-
if (!hasProperty(buildConfigs, key)) {
|
|
29445
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(buildConfigs, key)) {
|
|
29728
29446
|
p.group.dir = key;
|
|
29729
29447
|
if (p.group.optimizerConfig.barrelMap && !p.group.optimizerConfig.optBarrels) {
|
|
29730
29448
|
dropBarrels = true;
|
|
@@ -29762,6 +29480,7 @@ async function generateOptimizedProject(options) {
|
|
|
29762
29480
|
if (configsToBuild > 1) {
|
|
29763
29481
|
poolStarted = startPool();
|
|
29764
29482
|
}
|
|
29483
|
+
let hasPersonality = false;
|
|
29765
29484
|
const promises = Object.keys(buildConfigs).sort().map((key) => {
|
|
29766
29485
|
const buildConfig = buildConfigs[key];
|
|
29767
29486
|
const outputPath = path4.join(config.outputPath, key);
|
|
@@ -29790,6 +29509,9 @@ async function generateOptimizedProject(options) {
|
|
|
29790
29509
|
if (t.diagnostics) {
|
|
29791
29510
|
diagnostics = { ...diagnostics, ...t.diagnostics };
|
|
29792
29511
|
}
|
|
29512
|
+
if (t.sdkVersion != null && t.sdkVersion >= 4002001) {
|
|
29513
|
+
hasPersonality = true;
|
|
29514
|
+
}
|
|
29793
29515
|
}) : fs6.rm(path4.resolve(workspace, outputPath), {
|
|
29794
29516
|
recursive: true,
|
|
29795
29517
|
force: true
|
|
@@ -29895,7 +29617,7 @@ async function generateOptimizedProject(options) {
|
|
|
29895
29617
|
if (qlang) {
|
|
29896
29618
|
const devLang = devices[product].languages;
|
|
29897
29619
|
const unsupportedLangs = Object.keys(qlang).sort().map((key) => {
|
|
29898
|
-
if (hasProperty(devLang, key) || !hasProperty(languagesToInclude, key)) {
|
|
29620
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(devLang, key) || !(0, import_chunk_MBTLUWXR.hasProperty)(languagesToInclude, key)) {
|
|
29899
29621
|
return null;
|
|
29900
29622
|
}
|
|
29901
29623
|
const mapped = map_field(qlang, key, relative_path);
|
|
@@ -29906,7 +29628,7 @@ async function generateOptimizedProject(options) {
|
|
|
29906
29628
|
let keysToSkip = null;
|
|
29907
29629
|
if (unsupportedLangs.length) {
|
|
29908
29630
|
const key = JSON.stringify(unsupportedLangs);
|
|
29909
|
-
if (!hasProperty(unsupportedLangsCache, key)) {
|
|
29631
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(unsupportedLangsCache, key)) {
|
|
29910
29632
|
const base = nextAvailableDefault();
|
|
29911
29633
|
if (base) {
|
|
29912
29634
|
unsupportedLangs.forEach(
|
|
@@ -29915,18 +29637,21 @@ async function generateOptimizedProject(options) {
|
|
|
29915
29637
|
unsupportedLangsCache[key] = `${base}.lang`;
|
|
29916
29638
|
}
|
|
29917
29639
|
}
|
|
29918
|
-
if (hasProperty(unsupportedLangsCache, key)) {
|
|
29640
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(unsupportedLangsCache, key)) {
|
|
29919
29641
|
keysToSkip = Object.fromEntries(unsupportedLangs);
|
|
29920
29642
|
parts.push(`${prefix}lang = $(${unsupportedLangsCache[key]})`);
|
|
29921
29643
|
}
|
|
29922
29644
|
}
|
|
29923
29645
|
Object.keys(qlang).forEach((key) => {
|
|
29924
|
-
hasProperty(keysToSkip, key) || !hasProperty(languagesToInclude, key) || process_field(`${prefix}lang.`, qlang, key, relative_path);
|
|
29646
|
+
(0, import_chunk_MBTLUWXR.hasProperty)(keysToSkip, key) || !(0, import_chunk_MBTLUWXR.hasProperty)(languagesToInclude, key) || process_field(`${prefix}lang.`, qlang, key, relative_path);
|
|
29925
29647
|
});
|
|
29926
29648
|
}
|
|
29927
29649
|
});
|
|
29928
|
-
promises.push(fs6.writeFile(jungleFiles, parts.join("\n")));
|
|
29929
29650
|
await Promise.all(promises);
|
|
29651
|
+
await fs6.writeFile(
|
|
29652
|
+
jungleFiles,
|
|
29653
|
+
(hasPersonality ? parts : parts.filter((part) => !/\.personality = /.test(part))).join("\n")
|
|
29654
|
+
);
|
|
29930
29655
|
} finally {
|
|
29931
29656
|
if (poolStarted) {
|
|
29932
29657
|
stopPool();
|
|
@@ -29942,11 +29667,11 @@ async function generateOptimizedProject(options) {
|
|
|
29942
29667
|
}
|
|
29943
29668
|
async function filesFromPaths(workspace, paths, extension) {
|
|
29944
29669
|
paths = (await Promise.all(
|
|
29945
|
-
paths?.map((pattern) => (0,
|
|
29670
|
+
paths?.map((pattern) => (0, import_chunk_PVBIKZYZ.globa)(pattern, { cwd: workspace, mark: true })) || []
|
|
29946
29671
|
)).flat();
|
|
29947
29672
|
const files = await Promise.all(
|
|
29948
29673
|
paths.map(
|
|
29949
|
-
(path7) => path7.endsWith("/") ? (0,
|
|
29674
|
+
(path7) => path7.endsWith("/") ? (0, import_chunk_PVBIKZYZ.globa)(`${path7}**/*${extension}`, { cwd: workspace, mark: true }) : path7
|
|
29950
29675
|
)
|
|
29951
29676
|
);
|
|
29952
29677
|
return {
|
|
@@ -30058,10 +29783,11 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
30058
29783
|
);
|
|
30059
29784
|
barrelFnMaps.forEach((barrelFnMap) => Object.assign(fnMap, barrelFnMap));
|
|
30060
29785
|
}
|
|
30061
|
-
const actualOptimizedFiles = (await (0,
|
|
29786
|
+
const actualOptimizedFiles = (await (0, import_chunk_PVBIKZYZ.globa)(path4.join(output, "**", "*.mc"), { mark: true })).filter((file) => !file.endsWith("/")).sort();
|
|
30062
29787
|
const {
|
|
30063
29788
|
hasTests,
|
|
30064
29789
|
diagnostics: prevDiagnostics,
|
|
29790
|
+
sdkVersion: prevSdkVersion,
|
|
30065
29791
|
...prevOptions
|
|
30066
29792
|
} = JSON.parse(
|
|
30067
29793
|
await fs6.readFile(path4.join(output, "build-info.json"), "utf-8").catch(() => "{}")
|
|
@@ -30070,14 +29796,18 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
30070
29796
|
if (hasTests != null && !config.checkBuildPragmas && configOptionsToCheck.every(
|
|
30071
29797
|
(option) => prevOptions[option] === config[option]
|
|
30072
29798
|
) && actualOptimizedFiles.length === mcFiles.length && mcFiles.map((v) => v.output).sort().every((f, i) => f === actualOptimizedFiles[i])) {
|
|
30073
|
-
const source_time = await (0,
|
|
29799
|
+
const source_time = await (0, import_chunk_PVBIKZYZ.last_modified)(
|
|
30074
29800
|
Object.keys(fnMap).concat(dependencyFiles)
|
|
30075
29801
|
);
|
|
30076
|
-
const opt_time = await (0,
|
|
29802
|
+
const opt_time = await (0, import_chunk_PVBIKZYZ.first_modified)(
|
|
30077
29803
|
Object.values(fnMap).map((v) => v.output)
|
|
30078
29804
|
);
|
|
30079
|
-
if (source_time < opt_time &&
|
|
30080
|
-
return {
|
|
29805
|
+
if (source_time < opt_time && 1684251991147 < opt_time) {
|
|
29806
|
+
return {
|
|
29807
|
+
hasTests,
|
|
29808
|
+
diagnostics: prevDiagnostics,
|
|
29809
|
+
sdkVersion: prevSdkVersion
|
|
29810
|
+
};
|
|
30081
29811
|
}
|
|
30082
29812
|
}
|
|
30083
29813
|
const [, , prettierConfig] = await Promise.all([
|
|
@@ -30089,7 +29819,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
30089
29819
|
})
|
|
30090
29820
|
]);
|
|
30091
29821
|
return optimizeMonkeyC(fnMap, resourcesMap, manifestXML, config).then(
|
|
30092
|
-
(diagnostics) => {
|
|
29822
|
+
({ diagnostics, sdkVersion }) => {
|
|
30093
29823
|
const options = { ...prettierConfig, ...config.prettier || {} };
|
|
30094
29824
|
return Promise.all(
|
|
30095
29825
|
mcFiles.map(async (info) => {
|
|
@@ -30108,12 +29838,13 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
30108
29838
|
JSON.stringify({
|
|
30109
29839
|
hasTests: hasTests2,
|
|
30110
29840
|
diagnostics,
|
|
30111
|
-
|
|
29841
|
+
sdkVersion,
|
|
29842
|
+
optimizerVersion: "1.1.28",
|
|
30112
29843
|
...Object.fromEntries(
|
|
30113
29844
|
configOptionsToCheck.map((option) => [option, config[option]])
|
|
30114
29845
|
)
|
|
30115
29846
|
})
|
|
30116
|
-
).then(() => ({ hasTests: hasTests2, diagnostics }));
|
|
29847
|
+
).then(() => ({ hasTests: hasTests2, diagnostics, sdkVersion }));
|
|
30117
29848
|
});
|
|
30118
29849
|
}
|
|
30119
29850
|
);
|
|
@@ -30169,7 +29900,7 @@ async function getProjectAnalysis(targets, analysis, manifestXML, options) {
|
|
|
30169
29900
|
);
|
|
30170
29901
|
if (analysis) {
|
|
30171
29902
|
Object.entries(fnMap).forEach(([k, v]) => {
|
|
30172
|
-
if (hasProperty(analysis.fnMap, k)) {
|
|
29903
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(analysis.fnMap, k)) {
|
|
30173
29904
|
const old = analysis.fnMap[k];
|
|
30174
29905
|
if (old.monkeyCSource)
|
|
30175
29906
|
v.monkeyCSource = old.monkeyCSource;
|
|
@@ -30185,7 +29916,7 @@ async function getProjectAnalysis(targets, analysis, manifestXML, options) {
|
|
|
30185
29916
|
const addResources = (name, resources) => {
|
|
30186
29917
|
if (!resources)
|
|
30187
29918
|
return;
|
|
30188
|
-
if (!hasProperty(resourcesMap, name)) {
|
|
29919
|
+
if (!(0, import_chunk_MBTLUWXR.hasProperty)(resourcesMap, name)) {
|
|
30189
29920
|
resourcesMap[name] = { ...resources };
|
|
30190
29921
|
} else {
|
|
30191
29922
|
Object.assign(resourcesMap[name], resources);
|
|
@@ -30286,7 +30017,7 @@ async function generateApiMirTests(options) {
|
|
|
30286
30017
|
return fs6.writeFile(`${workspace}/source/apiTest.mc`, source);
|
|
30287
30018
|
}
|
|
30288
30019
|
var defaultConfig, configOptionsToCheck;
|
|
30289
|
-
var init_optimizer = (0,
|
|
30020
|
+
var init_optimizer = (0, import_chunk_ABYVSU2C.__esm)({
|
|
30290
30021
|
"src/optimizer.ts"() {
|
|
30291
30022
|
init_api();
|
|
30292
30023
|
init_build();
|
|
@@ -30299,7 +30030,7 @@ var init_optimizer = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
30299
30030
|
init_could_be();
|
|
30300
30031
|
init_interp();
|
|
30301
30032
|
init_sub_type();
|
|
30302
|
-
(0,
|
|
30033
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
30303
30034
|
init_worker_pool();
|
|
30304
30035
|
init_optimizer_types();
|
|
30305
30036
|
init_types();
|
|
@@ -30340,7 +30071,7 @@ async function performTask(task) {
|
|
|
30340
30071
|
return handler(task.data);
|
|
30341
30072
|
}
|
|
30342
30073
|
var workerTaskHandlers;
|
|
30343
|
-
var init_worker_task = (0,
|
|
30074
|
+
var init_worker_task = (0, import_chunk_ABYVSU2C.__esm)({
|
|
30344
30075
|
"src/worker-task.ts"() {
|
|
30345
30076
|
"use strict";
|
|
30346
30077
|
init_optimizer();
|
|
@@ -30420,7 +30151,7 @@ function runTaskInPool(task) {
|
|
|
30420
30151
|
return performTask(task);
|
|
30421
30152
|
}
|
|
30422
30153
|
var kTaskInfo, kWorkerFreedEvent, WorkerPoolTaskInfo, WorkerPool, pool;
|
|
30423
|
-
var init_worker_pool = (0,
|
|
30154
|
+
var init_worker_pool = (0, import_chunk_ABYVSU2C.__esm)({
|
|
30424
30155
|
"src/worker-pool.ts"() {
|
|
30425
30156
|
"use strict";
|
|
30426
30157
|
init_worker_task();
|
|
@@ -30563,9 +30294,9 @@ async function optimizeProgram(filepath, devKey, output, config) {
|
|
|
30563
30294
|
}
|
|
30564
30295
|
function optimizeProgramBuffer(filepath, view, debugXml, key, config) {
|
|
30565
30296
|
const { sections } = readPrgWithOffsets(view);
|
|
30566
|
-
(0,
|
|
30297
|
+
(0, import_chunk_PVBIKZYZ.logger)("readprg", 5, sections);
|
|
30567
30298
|
const symbolTable = new SymbolTable();
|
|
30568
|
-
if (hasProperty(sections, 1461170197 .toString())) {
|
|
30299
|
+
if ((0, import_chunk_MBTLUWXR.hasProperty)(sections, 1461170197 .toString())) {
|
|
30569
30300
|
symbolTable.parse(sections[
|
|
30570
30301
|
1461170197
|
|
30571
30302
|
/* SYMBOLS */
|
|
@@ -30836,12 +30567,12 @@ function optimizePrgAndDebug(prgName, prgBuffer, prgOffset, prgLength, xmlName,
|
|
|
30836
30567
|
});
|
|
30837
30568
|
}
|
|
30838
30569
|
var yauzl, yazl;
|
|
30839
|
-
var init_readprg = (0,
|
|
30570
|
+
var init_readprg = (0, import_chunk_ABYVSU2C.__esm)({
|
|
30840
30571
|
"src/readprg.ts"() {
|
|
30841
30572
|
"use strict";
|
|
30842
|
-
yauzl = (0,
|
|
30843
|
-
yazl = (0,
|
|
30844
|
-
init_ast();
|
|
30573
|
+
yauzl = (0, import_chunk_ABYVSU2C.__toESM)(require_yauzl());
|
|
30574
|
+
yazl = (0, import_chunk_ABYVSU2C.__toESM)(require_yazl());
|
|
30575
|
+
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
30845
30576
|
init_bytecode();
|
|
30846
30577
|
init_data();
|
|
30847
30578
|
init_exceptions();
|
|
@@ -30851,7 +30582,7 @@ var init_readprg = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
30851
30582
|
init_signer();
|
|
30852
30583
|
init_symbols();
|
|
30853
30584
|
init_sdk_util();
|
|
30854
|
-
(0,
|
|
30585
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
30855
30586
|
init_worker_pool();
|
|
30856
30587
|
}
|
|
30857
30588
|
});
|
|
@@ -30863,7 +30594,7 @@ function getSdkPath() {
|
|
|
30863
30594
|
});
|
|
30864
30595
|
}
|
|
30865
30596
|
async function getDeviceInfo() {
|
|
30866
|
-
const files = await (0,
|
|
30597
|
+
const files = await (0, import_chunk_PVBIKZYZ.globa)(`${connectiq}/Devices/*/compiler.json`);
|
|
30867
30598
|
if (!files.length) {
|
|
30868
30599
|
throw new Error(
|
|
30869
30600
|
`No devices found at '${connectiq}/Devices'. Check your sdk is correctly installed`
|
|
@@ -30928,9 +30659,9 @@ async function getFunctionDocumentation() {
|
|
|
30928
30659
|
return entries;
|
|
30929
30660
|
}
|
|
30930
30661
|
var isWin, appSupport, connectiq;
|
|
30931
|
-
var init_sdk_util = (0,
|
|
30662
|
+
var init_sdk_util = (0, import_chunk_ABYVSU2C.__esm)({
|
|
30932
30663
|
"src/sdk-util.ts"() {
|
|
30933
|
-
(0,
|
|
30664
|
+
(0, import_chunk_PVBIKZYZ.init_util)();
|
|
30934
30665
|
init_xml_util();
|
|
30935
30666
|
init_readprg();
|
|
30936
30667
|
init_bytecode();
|
|
@@ -30979,9 +30710,7 @@ var init_sdk_util = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
30979
30710
|
getSdkPath,
|
|
30980
30711
|
getSuperClasses,
|
|
30981
30712
|
get_jungle,
|
|
30982
|
-
hasProperty,
|
|
30983
30713
|
init_api,
|
|
30984
|
-
init_ast,
|
|
30985
30714
|
init_bytecode,
|
|
30986
30715
|
init_could_be,
|
|
30987
30716
|
init_intersection_type,
|
|
@@ -31030,7 +30759,6 @@ var init_sdk_util = (0, import_chunk_YZ44IUV6.__esm)({
|
|
|
31030
30759
|
startPool,
|
|
31031
30760
|
stopPool,
|
|
31032
30761
|
subtypeOf,
|
|
31033
|
-
traverseAst,
|
|
31034
30762
|
typeFromTypeStateNode,
|
|
31035
30763
|
unionInto,
|
|
31036
30764
|
variableDeclarationName,
|