@markw65/monkeyc-optimizer 1.1.6 → 1.1.7
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 +6 -1
- package/build/api.cjs +4 -8
- package/build/optimizer.cjs +14 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -648,4 +648,9 @@ Bug Fixes
|
|
|
648
648
|
- Bug fixes
|
|
649
649
|
- Fix an issue in restrictByEquality when restricting a union including an Enum, to a specific value of the enum.
|
|
650
650
|
- Fix the display of Method types to match the syntax used in MonkeyC.
|
|
651
|
-
- Infer the type of method(:symbol) by looking up symbol.
|
|
651
|
+
- Infer the type of `method(:symbol)` by looking up symbol.
|
|
652
|
+
|
|
653
|
+
### 1.1.7
|
|
654
|
+
|
|
655
|
+
- Bug fixes
|
|
656
|
+
- Fix a problem with inlining that could inadvertently make locals from the callee function appear to belong to the callee's class or module. This could sometimes block optimizations, and also cause confusion for the type checker.
|
package/build/api.cjs
CHANGED
|
@@ -1851,9 +1851,7 @@ function findCalleesByNode(state, callee) {
|
|
|
1851
1851
|
/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_api__WEBPACK_IMPORTED_MODULE_0__);
|
|
1852
1852
|
/* harmony import */ var _ast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6652);
|
|
1853
1853
|
/* harmony import */ var _function_info__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(819);
|
|
1854
|
-
/* harmony import */ var
|
|
1855
|
-
/* harmony import */ var _variable_renamer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4405);
|
|
1856
|
-
|
|
1854
|
+
/* harmony import */ var _variable_renamer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4405);
|
|
1857
1855
|
|
|
1858
1856
|
|
|
1859
1857
|
|
|
@@ -2075,7 +2073,7 @@ function getArgSafety(state, func, args, requireAll) {
|
|
|
2075
2073
|
}
|
|
2076
2074
|
return null;
|
|
2077
2075
|
};
|
|
2078
|
-
state.stack = func.stack;
|
|
2076
|
+
state.stack = func.stack.concat(func);
|
|
2079
2077
|
state.traverse(func.node.body);
|
|
2080
2078
|
}
|
|
2081
2079
|
finally {
|
|
@@ -2186,9 +2184,7 @@ function processInlineBody(state, func, call, root, params) {
|
|
|
2186
2184
|
// lookup determines static-ness of the lookup context based on seeing
|
|
2187
2185
|
// a static FunctionDeclaration, but the FunctionDeclaration's stack
|
|
2188
2186
|
// doesn't include the FunctionDeclaration itself.
|
|
2189
|
-
const
|
|
2190
|
-
? func.stack.concat(func)
|
|
2191
|
-
: func.stack;
|
|
2187
|
+
const lookupStack = func.stack.concat(func);
|
|
2192
2188
|
try {
|
|
2193
2189
|
state.pre = (node) => {
|
|
2194
2190
|
if (failed)
|
|
@@ -2244,7 +2240,7 @@ function processInlineBody(state, func, call, root, params) {
|
|
|
2244
2240
|
}
|
|
2245
2241
|
return null;
|
|
2246
2242
|
}
|
|
2247
|
-
const replacement = fixNodeScope(state, node,
|
|
2243
|
+
const replacement = fixNodeScope(state, node, lookupStack);
|
|
2248
2244
|
if (!replacement) {
|
|
2249
2245
|
failed = true;
|
|
2250
2246
|
inlineDiagnostic(state, func, call, `Failed to resolve '${node.name}'`);
|
package/build/optimizer.cjs
CHANGED
|
@@ -5035,15 +5035,6 @@ function findCalleesByNode(state, callee) {
|
|
|
5035
5035
|
return ((hasProperty(state.allFunctions, name) && state.allFunctions[name]) || null);
|
|
5036
5036
|
}
|
|
5037
5037
|
|
|
5038
|
-
;// CONCATENATED MODULE: ./src/optimizer-types.ts
|
|
5039
|
-
var StateNodeAttributes;
|
|
5040
|
-
(function (StateNodeAttributes) {
|
|
5041
|
-
StateNodeAttributes[StateNodeAttributes["PUBLIC"] = 1] = "PUBLIC";
|
|
5042
|
-
StateNodeAttributes[StateNodeAttributes["PROTECTED"] = 2] = "PROTECTED";
|
|
5043
|
-
StateNodeAttributes[StateNodeAttributes["PRIVATE"] = 4] = "PRIVATE";
|
|
5044
|
-
StateNodeAttributes[StateNodeAttributes["STATIC"] = 8] = "STATIC";
|
|
5045
|
-
})(StateNodeAttributes || (StateNodeAttributes = {}));
|
|
5046
|
-
|
|
5047
5038
|
;// CONCATENATED MODULE: ./src/variable-renamer.ts
|
|
5048
5039
|
|
|
5049
5040
|
|
|
@@ -5110,7 +5101,6 @@ function renameVariable(state, locals, declName) {
|
|
|
5110
5101
|
|
|
5111
5102
|
|
|
5112
5103
|
|
|
5113
|
-
|
|
5114
5104
|
// Note: Keep in sync with replaceInlinedSubExpression below
|
|
5115
5105
|
function inlinableSubExpression(expr) {
|
|
5116
5106
|
while (true) {
|
|
@@ -5328,7 +5318,7 @@ function getArgSafety(state, func, args, requireAll) {
|
|
|
5328
5318
|
}
|
|
5329
5319
|
return null;
|
|
5330
5320
|
};
|
|
5331
|
-
state.stack = func.stack;
|
|
5321
|
+
state.stack = func.stack.concat(func);
|
|
5332
5322
|
state.traverse(func.node.body);
|
|
5333
5323
|
}
|
|
5334
5324
|
finally {
|
|
@@ -5439,9 +5429,7 @@ function processInlineBody(state, func, call, root, params) {
|
|
|
5439
5429
|
// lookup determines static-ness of the lookup context based on seeing
|
|
5440
5430
|
// a static FunctionDeclaration, but the FunctionDeclaration's stack
|
|
5441
5431
|
// doesn't include the FunctionDeclaration itself.
|
|
5442
|
-
const
|
|
5443
|
-
? func.stack.concat(func)
|
|
5444
|
-
: func.stack;
|
|
5432
|
+
const lookupStack = func.stack.concat(func);
|
|
5445
5433
|
try {
|
|
5446
5434
|
state.pre = (node) => {
|
|
5447
5435
|
if (failed)
|
|
@@ -5497,7 +5485,7 @@ function processInlineBody(state, func, call, root, params) {
|
|
|
5497
5485
|
}
|
|
5498
5486
|
return null;
|
|
5499
5487
|
}
|
|
5500
|
-
const replacement = fixNodeScope(state, node,
|
|
5488
|
+
const replacement = fixNodeScope(state, node, lookupStack);
|
|
5501
5489
|
if (!replacement) {
|
|
5502
5490
|
failed = true;
|
|
5503
5491
|
inlineDiagnostic(state, func, call, `Failed to resolve '${node.name}'`);
|
|
@@ -5953,6 +5941,15 @@ function fixNodeScope(state, lookupNode, nodeStack) {
|
|
|
5953
5941
|
return null;
|
|
5954
5942
|
}
|
|
5955
5943
|
|
|
5944
|
+
;// CONCATENATED MODULE: ./src/optimizer-types.ts
|
|
5945
|
+
var StateNodeAttributes;
|
|
5946
|
+
(function (StateNodeAttributes) {
|
|
5947
|
+
StateNodeAttributes[StateNodeAttributes["PUBLIC"] = 1] = "PUBLIC";
|
|
5948
|
+
StateNodeAttributes[StateNodeAttributes["PROTECTED"] = 2] = "PROTECTED";
|
|
5949
|
+
StateNodeAttributes[StateNodeAttributes["PRIVATE"] = 4] = "PRIVATE";
|
|
5950
|
+
StateNodeAttributes[StateNodeAttributes["STATIC"] = 8] = "STATIC";
|
|
5951
|
+
})(StateNodeAttributes || (StateNodeAttributes = {}));
|
|
5952
|
+
|
|
5956
5953
|
;// CONCATENATED MODULE: ./src/pragma-checker.ts
|
|
5957
5954
|
|
|
5958
5955
|
|
|
@@ -15381,7 +15378,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
15381
15378
|
// the oldest optimized file, we don't need to regenerate
|
|
15382
15379
|
const source_time = await (0,external_util_cjs_namespaceObject.last_modified)(Object.keys(fnMap).concat(dependencyFiles));
|
|
15383
15380
|
const opt_time = await (0,external_util_cjs_namespaceObject.first_modified)(Object.values(fnMap).map((v) => v.output));
|
|
15384
|
-
if (source_time < opt_time &&
|
|
15381
|
+
if (source_time < opt_time && 1674746701563 < opt_time) {
|
|
15385
15382
|
return { hasTests, diagnostics: prevDiagnostics };
|
|
15386
15383
|
}
|
|
15387
15384
|
}
|
|
@@ -15408,7 +15405,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
15408
15405
|
return promises_namespaceObject.writeFile(external_path_.join(output, "build-info.json"), JSON.stringify({
|
|
15409
15406
|
hasTests,
|
|
15410
15407
|
diagnostics,
|
|
15411
|
-
optimizerVersion: "1.1.
|
|
15408
|
+
optimizerVersion: "1.1.7",
|
|
15412
15409
|
...Object.fromEntries(configOptionsToCheck.map((option) => [option, config[option]])),
|
|
15413
15410
|
}))
|
|
15414
15411
|
.then(() => ({ hasTests, diagnostics }));
|
package/package.json
CHANGED