@markw65/monkeyc-optimizer 1.0.40 → 1.0.41
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 +5 -0
- package/build/api.cjs +26 -1
- package/build/optimizer.cjs +2 -2
- package/build/src/visitor.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -485,3 +485,8 @@ Bug Fixes
|
|
|
485
485
|
- Bug fixes
|
|
486
486
|
- Fix optimization of `and` and `or` (alternate names for `&&` and `||`)
|
|
487
487
|
- Fix a bug that could sometimes prevent the `has` optimization from kicking in.
|
|
488
|
+
|
|
489
|
+
### 1.0.41
|
|
490
|
+
|
|
491
|
+
- Bug fixes
|
|
492
|
+
- The fix to avoid visiting definitions from visitReferences was incomplete
|
package/build/api.cjs
CHANGED
|
@@ -4771,7 +4771,7 @@ function visitorNode(node) {
|
|
|
4771
4771
|
}
|
|
4772
4772
|
return node;
|
|
4773
4773
|
}
|
|
4774
|
-
function visitor_visitReferences(state, ast, name, defn, callback) {
|
|
4774
|
+
function visitor_visitReferences(state, ast, name, defn, callback, includeDefs = false) {
|
|
4775
4775
|
const checkResults = ([name, results], node) => {
|
|
4776
4776
|
if (name && results) {
|
|
4777
4777
|
if (!defn || (0,external_api_cjs_namespaceObject.sameLookupResult)(results, defn)) {
|
|
@@ -4857,11 +4857,36 @@ function visitor_visitReferences(state, ast, name, defn, callback) {
|
|
|
4857
4857
|
return ["returnType"];
|
|
4858
4858
|
}
|
|
4859
4859
|
case "ModuleDeclaration":
|
|
4860
|
+
if (includeDefs)
|
|
4861
|
+
break;
|
|
4860
4862
|
return ["body"];
|
|
4861
4863
|
case "ClassDeclaration":
|
|
4864
|
+
if (includeDefs)
|
|
4865
|
+
break;
|
|
4862
4866
|
return ["body", "superClass"];
|
|
4863
4867
|
case "FunctionDeclaration":
|
|
4868
|
+
if (includeDefs)
|
|
4869
|
+
break;
|
|
4864
4870
|
return ["params", "returnType", "body"];
|
|
4871
|
+
case "TypedefDeclaration":
|
|
4872
|
+
if (includeDefs)
|
|
4873
|
+
break;
|
|
4874
|
+
return ["ts"];
|
|
4875
|
+
case "VariableDeclarator":
|
|
4876
|
+
if (includeDefs)
|
|
4877
|
+
break;
|
|
4878
|
+
return ["init"];
|
|
4879
|
+
case "EnumDeclaration":
|
|
4880
|
+
if (includeDefs)
|
|
4881
|
+
break;
|
|
4882
|
+
return [];
|
|
4883
|
+
case "CatchClause":
|
|
4884
|
+
if (includeDefs)
|
|
4885
|
+
break;
|
|
4886
|
+
if (node.param && node.param.type !== "Identifier") {
|
|
4887
|
+
state.traverse(node.param.right);
|
|
4888
|
+
}
|
|
4889
|
+
return ["body"];
|
|
4865
4890
|
}
|
|
4866
4891
|
return null;
|
|
4867
4892
|
};
|
package/build/optimizer.cjs
CHANGED
|
@@ -9143,7 +9143,7 @@ async function generateOneConfig(buildConfig, dependencyFiles, config) {
|
|
|
9143
9143
|
// the oldest optimized file, we don't need to regenerate
|
|
9144
9144
|
const source_time = await (0,external_util_cjs_namespaceObject.last_modified)(Object.keys(fnMap).concat(dependencyFiles));
|
|
9145
9145
|
const opt_time = await (0,external_util_cjs_namespaceObject.first_modified)(Object.values(fnMap).map((v) => v.output));
|
|
9146
|
-
if (source_time < opt_time &&
|
|
9146
|
+
if (source_time < opt_time && 1669495636842 < opt_time) {
|
|
9147
9147
|
return { hasTests, diagnostics: prevDiagnostics };
|
|
9148
9148
|
}
|
|
9149
9149
|
}
|
|
@@ -9168,7 +9168,7 @@ async function generateOneConfig(buildConfig, dependencyFiles, config) {
|
|
|
9168
9168
|
return promises_namespaceObject.writeFile(external_path_.join(output, "build-info.json"), JSON.stringify({
|
|
9169
9169
|
hasTests,
|
|
9170
9170
|
diagnostics,
|
|
9171
|
-
optimizerVersion: "1.0.
|
|
9171
|
+
optimizerVersion: "1.0.41",
|
|
9172
9172
|
...Object.fromEntries(configOptionsToCheck.map((option) => [option, config[option]])),
|
|
9173
9173
|
}))
|
|
9174
9174
|
.then(() => ({ hasTests, diagnostics }));
|
package/build/src/visitor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { mctree } from "@markw65/prettier-plugin-monkeyc";
|
|
2
2
|
import { LookupDefinition, ProgramStateAnalysis } from "./optimizer-types";
|
|
3
3
|
export declare function visitorNode(node: mctree.Node): mctree.Node;
|
|
4
|
-
export declare function visitReferences(state: ProgramStateAnalysis, ast: mctree.Program, name: string | null, defn: LookupDefinition[] | null | false, callback: (node: mctree.Node, results: LookupDefinition[], error: boolean) => undefined | false): void;
|
|
4
|
+
export declare function visitReferences(state: ProgramStateAnalysis, ast: mctree.Program, name: string | null, defn: LookupDefinition[] | null | false, callback: (node: mctree.Node, results: LookupDefinition[], error: boolean) => undefined | false, includeDefs?: boolean): void;
|
package/package.json
CHANGED