@markw65/monkeyc-optimizer 1.1.50 → 1.1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to the "monkeyc-optimizer" package will be documented in this file.
4
4
 
5
+ ### 1.1.51
6
+
7
+ - Fix a bug where a call with mismatched arguments could be marked as side-effect free, and then removed.
8
+ - Don't inline functions with mis-matched arguments, and issue a diagnostic.
9
+
5
10
  ### 1.1.50
6
11
 
7
12
  - Add a diagnostic when an inline function doesn't get removed
package/build/api.cjs CHANGED
@@ -18,47 +18,47 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var api_exports = {};
20
20
  __export(api_exports, {
21
- checkCompilerVersion: () => import_chunk_6KP65YOB.checkCompilerVersion,
22
- collectNamespaces: () => import_chunk_6KP65YOB.collectNamespaces,
23
- createDocumentationMap: () => import_chunk_6KP65YOB.createDocumentationMap,
24
- diagnostic: () => import_chunk_6KP65YOB.diagnostic,
25
- diagnosticHelper: () => import_chunk_6KP65YOB.diagnosticHelper,
26
- findNamesInScope: () => import_chunk_6KP65YOB.findNamesInScope,
27
- findUsingForNode: () => import_chunk_6KP65YOB.findUsingForNode,
28
- formatAst: () => import_chunk_6KP65YOB.formatAst,
29
- formatAstLongLines: () => import_chunk_6KP65YOB.formatAstLongLines,
30
- formatScopedName: () => import_chunk_6KP65YOB.formatScopedName,
31
- getApiFunctionInfo: () => import_chunk_6KP65YOB.getApiFunctionInfo,
32
- getApiMapping: () => import_chunk_6KP65YOB.getApiMapping,
33
- getSuperClasses: () => import_chunk_6KP65YOB.getSuperClasses,
21
+ checkCompilerVersion: () => import_chunk_HKWBVOEL.checkCompilerVersion,
22
+ collectNamespaces: () => import_chunk_HKWBVOEL.collectNamespaces,
23
+ createDocumentationMap: () => import_chunk_HKWBVOEL.createDocumentationMap,
24
+ diagnostic: () => import_chunk_HKWBVOEL.diagnostic,
25
+ diagnosticHelper: () => import_chunk_HKWBVOEL.diagnosticHelper,
26
+ findNamesInScope: () => import_chunk_HKWBVOEL.findNamesInScope,
27
+ findUsingForNode: () => import_chunk_HKWBVOEL.findUsingForNode,
28
+ formatAst: () => import_chunk_HKWBVOEL.formatAst,
29
+ formatAstLongLines: () => import_chunk_HKWBVOEL.formatAstLongLines,
30
+ formatScopedName: () => import_chunk_HKWBVOEL.formatScopedName,
31
+ getApiFunctionInfo: () => import_chunk_HKWBVOEL.getApiFunctionInfo,
32
+ getApiMapping: () => import_chunk_HKWBVOEL.getApiMapping,
33
+ getSuperClasses: () => import_chunk_HKWBVOEL.getSuperClasses,
34
34
  hasProperty: () => import_chunk_MBTLUWXR.hasProperty,
35
- isClassVariable: () => import_chunk_6KP65YOB.isClassVariable,
36
- isLocal: () => import_chunk_6KP65YOB.isLocal,
37
- isLookupCandidate: () => import_chunk_6KP65YOB.isLookupCandidate,
38
- isStateNode: () => import_chunk_6KP65YOB.isStateNode,
39
- lookupByFullName: () => import_chunk_6KP65YOB.lookupByFullName,
40
- lookupNext: () => import_chunk_6KP65YOB.lookupNext,
41
- lookupResultContains: () => import_chunk_6KP65YOB.lookupResultContains,
42
- lookupWithType: () => import_chunk_6KP65YOB.lookupWithType,
43
- makeToyboxLink: () => import_chunk_6KP65YOB.makeToyboxLink,
44
- mapVarDeclsByType: () => import_chunk_6KP65YOB.mapVarDeclsByType,
45
- markInvokeClassMethod: () => import_chunk_6KP65YOB.markInvokeClassMethod,
46
- parseSdkVersion: () => import_chunk_6KP65YOB.parseSdkVersion,
47
- resolveDiagnostics: () => import_chunk_6KP65YOB.resolveDiagnostics,
48
- resolveDiagnosticsMap: () => import_chunk_6KP65YOB.resolveDiagnosticsMap,
49
- sameLookupResult: () => import_chunk_6KP65YOB.sameLookupResult,
35
+ isClassVariable: () => import_chunk_HKWBVOEL.isClassVariable,
36
+ isLocal: () => import_chunk_HKWBVOEL.isLocal,
37
+ isLookupCandidate: () => import_chunk_HKWBVOEL.isLookupCandidate,
38
+ isStateNode: () => import_chunk_HKWBVOEL.isStateNode,
39
+ lookupByFullName: () => import_chunk_HKWBVOEL.lookupByFullName,
40
+ lookupNext: () => import_chunk_HKWBVOEL.lookupNext,
41
+ lookupResultContains: () => import_chunk_HKWBVOEL.lookupResultContains,
42
+ lookupWithType: () => import_chunk_HKWBVOEL.lookupWithType,
43
+ makeToyboxLink: () => import_chunk_HKWBVOEL.makeToyboxLink,
44
+ mapVarDeclsByType: () => import_chunk_HKWBVOEL.mapVarDeclsByType,
45
+ markInvokeClassMethod: () => import_chunk_HKWBVOEL.markInvokeClassMethod,
46
+ parseSdkVersion: () => import_chunk_HKWBVOEL.parseSdkVersion,
47
+ resolveDiagnostics: () => import_chunk_HKWBVOEL.resolveDiagnostics,
48
+ resolveDiagnosticsMap: () => import_chunk_HKWBVOEL.resolveDiagnosticsMap,
49
+ sameLookupResult: () => import_chunk_HKWBVOEL.sameLookupResult,
50
50
  traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
51
- variableDeclarationName: () => import_chunk_6KP65YOB.variableDeclarationName,
52
- visitReferences: () => import_chunk_6KP65YOB.visitReferences,
53
- visit_resources: () => import_chunk_6KP65YOB.visit_resources,
54
- visitorNode: () => import_chunk_6KP65YOB.visitorNode
51
+ variableDeclarationName: () => import_chunk_HKWBVOEL.variableDeclarationName,
52
+ visitReferences: () => import_chunk_HKWBVOEL.visitReferences,
53
+ visit_resources: () => import_chunk_HKWBVOEL.visit_resources,
54
+ visitorNode: () => import_chunk_HKWBVOEL.visitorNode
55
55
  });
56
56
  module.exports = __toCommonJS(api_exports);
57
- var import_chunk_6KP65YOB = require("./chunk-6KP65YOB.cjs");
57
+ var import_chunk_HKWBVOEL = require("./chunk-HKWBVOEL.cjs");
58
58
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
59
59
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
60
60
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
61
- (0, import_chunk_6KP65YOB.init_api)();
61
+ (0, import_chunk_HKWBVOEL.init_api)();
62
62
  // Annotate the CommonJS export names for ESM import in node:
63
63
  0 && (module.exports = {
64
64
  checkCompilerVersion,
@@ -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 chunk_6KP65YOB_exports = {};
30
- __export(chunk_6KP65YOB_exports, {
29
+ var chunk_HKWBVOEL_exports = {};
30
+ __export(chunk_HKWBVOEL_exports, {
31
31
  EnumTagsConst: () => EnumTagsConst,
32
32
  LastTypeTag: () => LastTypeTag,
33
33
  ObjectLikeTagsConst: () => ObjectLikeTagsConst,
@@ -133,7 +133,7 @@ __export(chunk_6KP65YOB_exports, {
133
133
  visitorNode: () => visitorNode,
134
134
  xml_util_exports: () => xml_util_exports
135
135
  });
136
- module.exports = __toCommonJS(chunk_6KP65YOB_exports);
136
+ module.exports = __toCommonJS(chunk_HKWBVOEL_exports);
137
137
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
138
138
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
139
139
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
@@ -5864,6 +5864,15 @@ function shouldInline(state, func, call, context) {
5864
5864
  return true;
5865
5865
  }
5866
5866
  }
5867
+ if (requested && func.node.params.length !== args.length) {
5868
+ inlineDiagnostic(
5869
+ state,
5870
+ func,
5871
+ call,
5872
+ "This function cannot be inlined due to incorrect arguments"
5873
+ );
5874
+ return false;
5875
+ }
5867
5876
  if (!context && requested) {
5868
5877
  inlineDiagnostic(
5869
5878
  state,
@@ -9071,6 +9080,8 @@ function checkCallArgs(istate, node, callees, args) {
9071
9080
  if (cur.info === false) {
9072
9081
  argEffects = false;
9073
9082
  }
9083
+ if (effects)
9084
+ result.embeddedEffects = true;
9074
9085
  const needsCheck = checker && (cur === callees || !isOverride(cur, callees));
9075
9086
  const expectedArgs = (argTypes || cur.node.params).length;
9076
9087
  if (args.length !== expectedArgs) {
@@ -9177,8 +9188,6 @@ function checkCallArgs(istate, node, callees, args) {
9177
9188
  result.value.type = 524287;
9178
9189
  delete result.value.value;
9179
9190
  }
9180
- if (effects)
9181
- result.embeddedEffects = true;
9182
9191
  return result;
9183
9192
  },
9184
9193
  {
@@ -28556,7 +28565,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
28556
28565
  const opt_time = await (0, import_chunk_SG7ODKRM.first_modified)(
28557
28566
  Object.values(fnMap).map((v) => v.output)
28558
28567
  );
28559
- if (source_time < opt_time && 1711236925504 < opt_time) {
28568
+ if (source_time < opt_time && 1711474096407 < opt_time) {
28560
28569
  return {
28561
28570
  hasTests,
28562
28571
  diagnostics: prevDiagnostics,
@@ -28595,7 +28604,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
28595
28604
  hasTests: hasTests2,
28596
28605
  diagnostics,
28597
28606
  sdkVersion,
28598
- optimizerVersion: "1.1.50",
28607
+ optimizerVersion: "1.1.51",
28599
28608
  ...Object.fromEntries(
28600
28609
  configOptionsToCheck.map((option) => [option, config[option]])
28601
28610
  )
@@ -18,28 +18,28 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var optimizer_exports = {};
20
20
  __export(optimizer_exports, {
21
- StateNodeAttributes: () => import_chunk_6KP65YOB.StateNodeAttributes,
22
- buildOptimizedProject: () => import_chunk_6KP65YOB.buildOptimizedProject,
21
+ StateNodeAttributes: () => import_chunk_HKWBVOEL.StateNodeAttributes,
22
+ buildOptimizedProject: () => import_chunk_HKWBVOEL.buildOptimizedProject,
23
23
  copyRecursiveAsNeeded: () => import_chunk_SG7ODKRM.copyRecursiveAsNeeded,
24
- defaultConfig: () => import_chunk_6KP65YOB.defaultConfig,
25
- display: () => import_chunk_6KP65YOB.display,
26
- generateOneConfig: () => import_chunk_6KP65YOB.generateOneConfig,
27
- generateOptimizedProject: () => import_chunk_6KP65YOB.generateOptimizedProject,
28
- getConfig: () => import_chunk_6KP65YOB.getConfig,
29
- getProjectAnalysis: () => import_chunk_6KP65YOB.getProjectAnalysis,
30
- get_jungle: () => import_chunk_6KP65YOB.get_jungle,
31
- isErrorWithLocation: () => import_chunk_6KP65YOB.isErrorWithLocation,
32
- launchSimulator: () => import_chunk_6KP65YOB.launchSimulator,
33
- manifestProducts: () => import_chunk_6KP65YOB.manifestProducts,
34
- mctree: () => import_chunk_6KP65YOB.mctree,
35
- simulateProgram: () => import_chunk_6KP65YOB.simulateProgram
24
+ defaultConfig: () => import_chunk_HKWBVOEL.defaultConfig,
25
+ display: () => import_chunk_HKWBVOEL.display,
26
+ generateOneConfig: () => import_chunk_HKWBVOEL.generateOneConfig,
27
+ generateOptimizedProject: () => import_chunk_HKWBVOEL.generateOptimizedProject,
28
+ getConfig: () => import_chunk_HKWBVOEL.getConfig,
29
+ getProjectAnalysis: () => import_chunk_HKWBVOEL.getProjectAnalysis,
30
+ get_jungle: () => import_chunk_HKWBVOEL.get_jungle,
31
+ isErrorWithLocation: () => import_chunk_HKWBVOEL.isErrorWithLocation,
32
+ launchSimulator: () => import_chunk_HKWBVOEL.launchSimulator,
33
+ manifestProducts: () => import_chunk_HKWBVOEL.manifestProducts,
34
+ mctree: () => import_chunk_HKWBVOEL.mctree,
35
+ simulateProgram: () => import_chunk_HKWBVOEL.simulateProgram
36
36
  });
37
37
  module.exports = __toCommonJS(optimizer_exports);
38
- var import_chunk_6KP65YOB = require("./chunk-6KP65YOB.cjs");
38
+ var import_chunk_HKWBVOEL = require("./chunk-HKWBVOEL.cjs");
39
39
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
40
40
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
41
41
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
42
- (0, import_chunk_6KP65YOB.init_optimizer)();
42
+ (0, import_chunk_HKWBVOEL.init_optimizer)();
43
43
  // Annotate the CommonJS export names for ESM import in node:
44
44
  0 && (module.exports = {
45
45
  StateNodeAttributes,
@@ -18,25 +18,25 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var sdk_util_exports = {};
20
20
  __export(sdk_util_exports, {
21
- SectionKinds: () => import_chunk_6KP65YOB.SectionKinds,
22
- appSupport: () => import_chunk_6KP65YOB.appSupport,
23
- connectiq: () => import_chunk_6KP65YOB.connectiq,
24
- getDeviceInfo: () => import_chunk_6KP65YOB.getDeviceInfo,
25
- getFunctionDocumentation: () => import_chunk_6KP65YOB.getFunctionDocumentation,
26
- getLanguages: () => import_chunk_6KP65YOB.getLanguages,
27
- getSdkPath: () => import_chunk_6KP65YOB.getSdkPath,
28
- isWin: () => import_chunk_6KP65YOB.isWin,
29
- optimizeProgram: () => import_chunk_6KP65YOB.optimizeProgram,
30
- readPrg: () => import_chunk_6KP65YOB.readPrg,
31
- readPrgWithOffsets: () => import_chunk_6KP65YOB.readPrgWithOffsets,
32
- xmlUtil: () => import_chunk_6KP65YOB.xml_util_exports
21
+ SectionKinds: () => import_chunk_HKWBVOEL.SectionKinds,
22
+ appSupport: () => import_chunk_HKWBVOEL.appSupport,
23
+ connectiq: () => import_chunk_HKWBVOEL.connectiq,
24
+ getDeviceInfo: () => import_chunk_HKWBVOEL.getDeviceInfo,
25
+ getFunctionDocumentation: () => import_chunk_HKWBVOEL.getFunctionDocumentation,
26
+ getLanguages: () => import_chunk_HKWBVOEL.getLanguages,
27
+ getSdkPath: () => import_chunk_HKWBVOEL.getSdkPath,
28
+ isWin: () => import_chunk_HKWBVOEL.isWin,
29
+ optimizeProgram: () => import_chunk_HKWBVOEL.optimizeProgram,
30
+ readPrg: () => import_chunk_HKWBVOEL.readPrg,
31
+ readPrgWithOffsets: () => import_chunk_HKWBVOEL.readPrgWithOffsets,
32
+ xmlUtil: () => import_chunk_HKWBVOEL.xml_util_exports
33
33
  });
34
34
  module.exports = __toCommonJS(sdk_util_exports);
35
- var import_chunk_6KP65YOB = require("./chunk-6KP65YOB.cjs");
35
+ var import_chunk_HKWBVOEL = require("./chunk-HKWBVOEL.cjs");
36
36
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
37
37
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
38
38
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
39
- (0, import_chunk_6KP65YOB.init_sdk_util)();
39
+ (0, import_chunk_HKWBVOEL.init_sdk_util)();
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
42
  SectionKinds,
@@ -21,17 +21,17 @@ __export(worker_thread_exports, {
21
21
  default: () => worker_thread_default
22
22
  });
23
23
  module.exports = __toCommonJS(worker_thread_exports);
24
- var import_chunk_6KP65YOB = require("./chunk-6KP65YOB.cjs");
24
+ var import_chunk_HKWBVOEL = require("./chunk-HKWBVOEL.cjs");
25
25
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
26
26
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
27
27
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
28
28
  var import_node_worker_threads = require("node:worker_threads");
29
29
  var require_worker_thread = (0, import_chunk_ABYVSU2C.__commonJS)({
30
30
  "src/worker-thread.ts"() {
31
- (0, import_chunk_6KP65YOB.init_worker_task)();
31
+ (0, import_chunk_HKWBVOEL.init_worker_task)();
32
32
  if (import_node_worker_threads.parentPort) {
33
33
  import_node_worker_threads.parentPort.on("message", async (task) => {
34
- return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_6KP65YOB.performTask)(task));
34
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_HKWBVOEL.performTask)(task));
35
35
  });
36
36
  }
37
37
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@markw65/monkeyc-optimizer",
3
3
  "type": "commonjs",
4
- "version": "1.1.50",
4
+ "version": "1.1.51",
5
5
  "description": "Source to source optimizer for Garmin Monkey C code",
6
6
  "main": "build/optimizer.cjs",
7
7
  "types": "build/src/optimizer.d.ts",