@markw65/monkeyc-optimizer 1.1.52 → 1.1.54

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,22 @@
2
2
 
3
3
  All notable changes to the "monkeyc-optimizer" package will be documented in this file.
4
4
 
5
+ ### 1.1.54
6
+
7
+ - Fix return types of Dictionary.values() and Dictionary.keys()
8
+ - Fix issue with single-copy-prop creating stores that the Garmin compiler can't parse
9
+ - Handle percentage strings in resources
10
+ - Handle special strings in <param> nodes
11
+ - Don't treat '@Dotted.Name' as special in strings and jsonData
12
+ - Include ipush2 and ipush3 in pre
13
+
14
+ ### 1.1.53
15
+
16
+ - Update to [@markw65/prettier-plugin-monkeyc@1.0.56](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1056)
17
+ - Allows excludeAnnotations on typedefs
18
+ - Allows arbitrary initializers for enums
19
+ - Fix a few nits with the post build optimizer
20
+
5
21
  ### 1.1.52
6
22
 
7
23
  - Add support for System 5 .prg files, including new bytecodes.
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_J5XJWBYV.checkCompilerVersion,
22
- collectNamespaces: () => import_chunk_J5XJWBYV.collectNamespaces,
23
- createDocumentationMap: () => import_chunk_J5XJWBYV.createDocumentationMap,
24
- diagnostic: () => import_chunk_J5XJWBYV.diagnostic,
25
- diagnosticHelper: () => import_chunk_J5XJWBYV.diagnosticHelper,
26
- findNamesInScope: () => import_chunk_J5XJWBYV.findNamesInScope,
27
- findUsingForNode: () => import_chunk_J5XJWBYV.findUsingForNode,
28
- formatAst: () => import_chunk_J5XJWBYV.formatAst,
29
- formatAstLongLines: () => import_chunk_J5XJWBYV.formatAstLongLines,
30
- formatScopedName: () => import_chunk_J5XJWBYV.formatScopedName,
31
- getApiFunctionInfo: () => import_chunk_J5XJWBYV.getApiFunctionInfo,
32
- getApiMapping: () => import_chunk_J5XJWBYV.getApiMapping,
33
- getSuperClasses: () => import_chunk_J5XJWBYV.getSuperClasses,
21
+ checkCompilerVersion: () => import_chunk_5K64MLXC.checkCompilerVersion,
22
+ collectNamespaces: () => import_chunk_5K64MLXC.collectNamespaces,
23
+ createDocumentationMap: () => import_chunk_5K64MLXC.createDocumentationMap,
24
+ diagnostic: () => import_chunk_5K64MLXC.diagnostic,
25
+ diagnosticHelper: () => import_chunk_5K64MLXC.diagnosticHelper,
26
+ findNamesInScope: () => import_chunk_5K64MLXC.findNamesInScope,
27
+ findUsingForNode: () => import_chunk_5K64MLXC.findUsingForNode,
28
+ formatAst: () => import_chunk_5K64MLXC.formatAst,
29
+ formatAstLongLines: () => import_chunk_5K64MLXC.formatAstLongLines,
30
+ formatScopedName: () => import_chunk_5K64MLXC.formatScopedName,
31
+ getApiFunctionInfo: () => import_chunk_5K64MLXC.getApiFunctionInfo,
32
+ getApiMapping: () => import_chunk_5K64MLXC.getApiMapping,
33
+ getSuperClasses: () => import_chunk_5K64MLXC.getSuperClasses,
34
34
  hasProperty: () => import_chunk_MBTLUWXR.hasProperty,
35
- isClassVariable: () => import_chunk_J5XJWBYV.isClassVariable,
36
- isLocal: () => import_chunk_J5XJWBYV.isLocal,
37
- isLookupCandidate: () => import_chunk_J5XJWBYV.isLookupCandidate,
38
- isStateNode: () => import_chunk_J5XJWBYV.isStateNode,
39
- lookupByFullName: () => import_chunk_J5XJWBYV.lookupByFullName,
40
- lookupNext: () => import_chunk_J5XJWBYV.lookupNext,
41
- lookupResultContains: () => import_chunk_J5XJWBYV.lookupResultContains,
42
- lookupWithType: () => import_chunk_J5XJWBYV.lookupWithType,
43
- makeToyboxLink: () => import_chunk_J5XJWBYV.makeToyboxLink,
44
- mapVarDeclsByType: () => import_chunk_J5XJWBYV.mapVarDeclsByType,
45
- markInvokeClassMethod: () => import_chunk_J5XJWBYV.markInvokeClassMethod,
46
- parseSdkVersion: () => import_chunk_J5XJWBYV.parseSdkVersion,
47
- resolveDiagnostics: () => import_chunk_J5XJWBYV.resolveDiagnostics,
48
- resolveDiagnosticsMap: () => import_chunk_J5XJWBYV.resolveDiagnosticsMap,
49
- sameLookupResult: () => import_chunk_J5XJWBYV.sameLookupResult,
35
+ isClassVariable: () => import_chunk_5K64MLXC.isClassVariable,
36
+ isLocal: () => import_chunk_5K64MLXC.isLocal,
37
+ isLookupCandidate: () => import_chunk_5K64MLXC.isLookupCandidate,
38
+ isStateNode: () => import_chunk_5K64MLXC.isStateNode,
39
+ lookupByFullName: () => import_chunk_5K64MLXC.lookupByFullName,
40
+ lookupNext: () => import_chunk_5K64MLXC.lookupNext,
41
+ lookupResultContains: () => import_chunk_5K64MLXC.lookupResultContains,
42
+ lookupWithType: () => import_chunk_5K64MLXC.lookupWithType,
43
+ makeToyboxLink: () => import_chunk_5K64MLXC.makeToyboxLink,
44
+ mapVarDeclsByType: () => import_chunk_5K64MLXC.mapVarDeclsByType,
45
+ markInvokeClassMethod: () => import_chunk_5K64MLXC.markInvokeClassMethod,
46
+ parseSdkVersion: () => import_chunk_5K64MLXC.parseSdkVersion,
47
+ resolveDiagnostics: () => import_chunk_5K64MLXC.resolveDiagnostics,
48
+ resolveDiagnosticsMap: () => import_chunk_5K64MLXC.resolveDiagnosticsMap,
49
+ sameLookupResult: () => import_chunk_5K64MLXC.sameLookupResult,
50
50
  traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
51
- variableDeclarationName: () => import_chunk_J5XJWBYV.variableDeclarationName,
52
- visitReferences: () => import_chunk_J5XJWBYV.visitReferences,
53
- visit_resources: () => import_chunk_J5XJWBYV.visit_resources,
54
- visitorNode: () => import_chunk_J5XJWBYV.visitorNode
51
+ variableDeclarationName: () => import_chunk_5K64MLXC.variableDeclarationName,
52
+ visitReferences: () => import_chunk_5K64MLXC.visitReferences,
53
+ visit_resources: () => import_chunk_5K64MLXC.visit_resources,
54
+ visitorNode: () => import_chunk_5K64MLXC.visitorNode
55
55
  });
56
56
  module.exports = __toCommonJS(api_exports);
57
- var import_chunk_J5XJWBYV = require("./chunk-J5XJWBYV.cjs");
57
+ var import_chunk_5K64MLXC = require("./chunk-5K64MLXC.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_J5XJWBYV.init_api)();
61
+ (0, import_chunk_5K64MLXC.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_J5XJWBYV_exports = {};
30
- __export(chunk_J5XJWBYV_exports, {
29
+ var chunk_5K64MLXC_exports = {};
30
+ __export(chunk_5K64MLXC_exports, {
31
31
  EnumTagsConst: () => EnumTagsConst,
32
32
  LastTypeTag: () => LastTypeTag,
33
33
  ObjectLikeTagsConst: () => ObjectLikeTagsConst,
@@ -133,7 +133,7 @@ __export(chunk_J5XJWBYV_exports, {
133
133
  visitorNode: () => visitorNode,
134
134
  xml_util_exports: () => xml_util_exports
135
135
  });
136
- module.exports = __toCommonJS(chunk_J5XJWBYV_exports);
136
+ module.exports = __toCommonJS(chunk_5K64MLXC_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");
@@ -5896,7 +5896,11 @@ function shouldInline(state, func, call, context) {
5896
5896
  state,
5897
5897
  func,
5898
5898
  call,
5899
- "This function can only be inlined in statement, assignment, if or return contexts"
5899
+ "This function can only be inlined in statement, assignment, if or return contexts",
5900
+ {
5901
+ uri: "https://github.com/markw65/monkeyc-optimizer/wiki/Inlining#so-inlining-is-restricted-to-a-few-fairly-common-places-or-contexts",
5902
+ message: "contexts"
5903
+ }
5900
5904
  );
5901
5905
  }
5902
5906
  return context != null;
@@ -6128,7 +6132,7 @@ function unused(state, expression, top) {
6128
6132
  }
6129
6133
  return top ? null : [estmt(expression)];
6130
6134
  }
6131
- function inlineDiagnostic(state, func, call, message) {
6135
+ function inlineDiagnostic(state, func, call, message, extra) {
6132
6136
  if (inlineRequested(state, func)) {
6133
6137
  if (!state.inlineDiagnostics) {
6134
6138
  state.inlineDiagnostics = {};
@@ -6138,7 +6142,7 @@ function inlineDiagnostic(state, func, call, message) {
6138
6142
  call,
6139
6143
  message && `While inlining ${func.node.id.name}: ${message}`,
6140
6144
  "INFO",
6141
- void 0
6145
+ extra
6142
6146
  );
6143
6147
  }
6144
6148
  }
@@ -9382,7 +9386,7 @@ function getSystemCallTable(state) {
9382
9386
  returnType.value = value2;
9383
9387
  }
9384
9388
  }
9385
- ret.returnType = { type: 512, value: returnType };
9389
+ ret.returnType = returnType;
9386
9390
  }
9387
9391
  }
9388
9392
  return ret;
@@ -9414,7 +9418,7 @@ function getSystemCallTable(state) {
9414
9418
  returnType.value = value2;
9415
9419
  }
9416
9420
  }
9417
- ret.returnType = { type: 512, value: returnType };
9421
+ ret.returnType = returnType;
9418
9422
  }
9419
9423
  }
9420
9424
  return ret;
@@ -13576,6 +13580,20 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
13576
13580
  case "def": {
13577
13581
  const lval = event.node.type === "UpdateExpression" ? event.node.argument : event.node.type === "AssignmentExpression" ? event.node.left : null;
13578
13582
  if (lval) {
13583
+ if (nodeCopyProp.size && lval.type === "MemberExpression") {
13584
+ let t = lval;
13585
+ while (t.type === "MemberExpression") {
13586
+ t = t.object;
13587
+ }
13588
+ const target = nodeCopyProp.get(t);
13589
+ if (target) {
13590
+ const copyExpr = target.type === "AssignmentExpression" ? target.right : target.type === "VariableDeclarator" ? target.init : null;
13591
+ if (copyExpr?.type === "BinaryExpression") {
13592
+ nodeCopyProp.set(target, false);
13593
+ nodeCopyProp.delete(t);
13594
+ }
13595
+ }
13596
+ }
13579
13597
  if (declIsLocal(event.decl)) {
13580
13598
  if (!istate.localLvals) {
13581
13599
  istate.localLvals = /* @__PURE__ */ new Set();
@@ -16674,7 +16692,11 @@ async function optimizeMonkeyCHelper(fnMap, resourcesMap, manifestXML, config) {
16674
16692
  const ret = preEvaluate(istate, node);
16675
16693
  switch (node.type) {
16676
16694
  case "EnumDeclaration":
16677
- return [];
16695
+ return ["body"];
16696
+ case "EnumStringBody":
16697
+ return ["members"];
16698
+ case "EnumStringMember":
16699
+ return ["init"];
16678
16700
  case "ForStatement": {
16679
16701
  const map2 = topLocals().map;
16680
16702
  if (map2) {
@@ -17101,20 +17123,18 @@ function cleanup(state, node, ast) {
17101
17123
  const name = "name" in m ? m.name : m.id.name;
17102
17124
  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);
17103
17125
  })) {
17104
- node.enumType = [
17105
- ...new Set(
17106
- node.members.map((m) => {
17107
- if (!("init" in m))
17108
- return "Number";
17109
- const [node2, type] = (0, import_chunk_MBTLUWXR.getNodeValue)(m.init);
17110
- if (!node2) {
17111
- throw new Error("Failed to get type for eliminated enum");
17112
- }
17113
- return type;
17114
- })
17115
- )
17116
- ].join(" or ");
17117
- node.members.splice(0);
17126
+ const enumType = new Set(
17127
+ node.members.map((m) => {
17128
+ if (!("init" in m))
17129
+ return "Number";
17130
+ const [node2, type] = (0, import_chunk_MBTLUWXR.getNodeValue)(m.init);
17131
+ return node2 ? type : null;
17132
+ })
17133
+ );
17134
+ if (!enumType.has(null)) {
17135
+ node.enumType = [...enumType].join(" or ");
17136
+ node.members.splice(0);
17137
+ }
17118
17138
  }
17119
17139
  break;
17120
17140
  case "EnumDeclaration":
@@ -17514,7 +17534,7 @@ function visit_resource_refs(state, doc, e) {
17514
17534
  name = name.substring(1);
17515
17535
  loc = (0, import_chunk_MBTLUWXR.adjustLoc)(loc, 1, 0);
17516
17536
  }
17517
- if ((0, import_chunk_MBTLUWXR.hasProperty)(skip, name)) {
17537
+ if ((0, import_chunk_MBTLUWXR.hasProperty)(skip, name) || /^\d+(\.\d+)?%?$/.test(name)) {
17518
17538
  return;
17519
17539
  }
17520
17540
  if (/^([-\w_$]+\s*\.\s*)*[-\w_$]+$/.test(name)) {
@@ -17588,7 +17608,12 @@ function visit_resource_refs(state, doc, e) {
17588
17608
  switch (element.name) {
17589
17609
  case "param":
17590
17610
  if (id === null) {
17591
- parseArg(dotted, l);
17611
+ const name = element.attr.name?.value.value;
17612
+ parseArg(
17613
+ dotted,
17614
+ l,
17615
+ name && (0, import_chunk_MBTLUWXR.hasProperty)(drawableSkips, name) ? drawableSkips[name] : null
17616
+ );
17592
17617
  }
17593
17618
  return;
17594
17619
  case "drawable":
@@ -17626,16 +17651,22 @@ function visit_resource_refs(state, doc, e) {
17626
17651
  });
17627
17652
  const content = doc.textContent(node);
17628
17653
  if (content) {
17629
- stringToScopedName(
17630
- node,
17631
- null,
17632
- content,
17633
- (0, import_chunk_MBTLUWXR.locRange)(
17634
- node.children[0].loc,
17635
- node.children[node.children.length - 1].loc
17636
- )
17637
- );
17638
- return false;
17654
+ switch (node.name) {
17655
+ case "string":
17656
+ case "jsonData":
17657
+ return false;
17658
+ default:
17659
+ stringToScopedName(
17660
+ node,
17661
+ null,
17662
+ content,
17663
+ (0, import_chunk_MBTLUWXR.locRange)(
17664
+ node.children[0].loc,
17665
+ node.children[node.children.length - 1].loc
17666
+ )
17667
+ );
17668
+ return false;
17669
+ }
17639
17670
  }
17640
17671
  return;
17641
17672
  }
@@ -17831,7 +17862,9 @@ var init_resources = (0, import_chunk_ABYVSU2C.__esm)({
17831
17862
  init_sdk_util();
17832
17863
  drawableSkips = {
17833
17864
  x: { center: true, left: true, right: true, start: true },
17865
+ locX: { center: true, left: true, right: true, start: true },
17834
17866
  y: { center: true, top: true, bottom: true, start: true },
17867
+ locY: { center: true, top: true, bottom: true, start: true },
17835
17868
  width: { fill: true },
17836
17869
  height: { fill: true },
17837
17870
  a: { fill: true },
@@ -18723,17 +18756,16 @@ function stateFuncs() {
18723
18756
  }
18724
18757
  const name = m.id.name;
18725
18758
  const init = (0, import_chunk_MBTLUWXR.getLiteralNode)(m.init);
18726
- if (!init) {
18727
- throw new Error("Unexpected enum initializer");
18728
- }
18729
- if (init !== m.init) {
18730
- if (m.init.enumType) {
18731
- init.enumType = m.init.enumType;
18759
+ if (init) {
18760
+ if (init !== m.init) {
18761
+ if (m.init.enumType) {
18762
+ init.enumType = m.init.enumType;
18763
+ }
18764
+ m.init = init;
18765
+ }
18766
+ if (init.type === "Literal" && init.raw && import_prettier_plugin_monkeyc4.LiteralIntegerRe.test(init.raw)) {
18767
+ prev = init.value;
18732
18768
  }
18733
- m.init = init;
18734
- }
18735
- if (init.type === "Literal" && init.raw && import_prettier_plugin_monkeyc4.LiteralIntegerRe.test(init.raw)) {
18736
- prev = init.value;
18737
18769
  }
18738
18770
  if (!(0, import_chunk_MBTLUWXR.hasProperty)(values, name)) {
18739
18771
  values[name] = [];
@@ -19762,7 +19794,7 @@ function parseCode(view, lineTable) {
19762
19794
  case 29:
19763
19795
  case 30:
19764
19796
  case 31:
19765
- return { op, offset, size: 1 };
19797
+ return { op, offset };
19766
19798
  case 42:
19767
19799
  case 34:
19768
19800
  case 33:
@@ -19786,7 +19818,7 @@ function parseCode(view, lineTable) {
19786
19818
  case 68:
19787
19819
  case 73:
19788
19820
  case 75:
19789
- return { op, offset, size: 1 };
19821
+ return { op, offset };
19790
19822
  case 1:
19791
19823
  case 15:
19792
19824
  case 18:
@@ -19795,7 +19827,7 @@ function parseCode(view, lineTable) {
19795
19827
  case 46:
19796
19828
  case 53:
19797
19829
  case 56:
19798
- return { op, arg: view.getUint8(current++), offset, size: 2 };
19830
+ return { op, arg: view.getUint8(current++), offset };
19799
19831
  case 25:
19800
19832
  case 35:
19801
19833
  case 40:
@@ -19803,22 +19835,19 @@ function parseCode(view, lineTable) {
19803
19835
  return {
19804
19836
  op,
19805
19837
  arg: offset + view.getInt16((current += 2) - 2) + 3,
19806
- offset,
19807
- size: 3
19838
+ offset
19808
19839
  };
19809
19840
  case 57:
19810
19841
  return {
19811
19842
  op,
19812
19843
  arg: view.getInt16((current += 2) - 2),
19813
- offset,
19814
- size: 3
19844
+ offset
19815
19845
  };
19816
19846
  case 58:
19817
19847
  return {
19818
19848
  op,
19819
19849
  arg: view.getInt32((current += 3) - 3) >> 8,
19820
- offset,
19821
- size: 4
19850
+ offset
19822
19851
  };
19823
19852
  case 24:
19824
19853
  case 64:
@@ -19829,7 +19858,7 @@ function parseCode(view, lineTable) {
19829
19858
  case 52:
19830
19859
  case 71:
19831
19860
  case 67:
19832
- return { op, arg: view.getInt32((current += 4) - 4), offset, size: 5 };
19861
+ return { op, arg: view.getInt32((current += 4) - 4), offset };
19833
19862
  case 69:
19834
19863
  return {
19835
19864
  op,
@@ -19837,8 +19866,7 @@ function parseCode(view, lineTable) {
19837
19866
  module: view.getInt32((current += 4) - 4),
19838
19867
  var: view.getInt32((current += 4) - 4)
19839
19868
  },
19840
- offset,
19841
- size: 9
19869
+ offset
19842
19870
  };
19843
19871
  case 70:
19844
19872
  return {
@@ -19847,8 +19875,7 @@ function parseCode(view, lineTable) {
19847
19875
  local: view.getUint8(current++),
19848
19876
  var: view.getInt32((current += 4) - 4)
19849
19877
  },
19850
- offset,
19851
- size: 6
19878
+ offset
19852
19879
  };
19853
19880
  case 74:
19854
19881
  return {
@@ -19857,29 +19884,25 @@ function parseCode(view, lineTable) {
19857
19884
  argc: view.getUint8(current++),
19858
19885
  incsp: view.getUint8(current++)
19859
19886
  },
19860
- offset,
19861
- size: 3
19887
+ offset
19862
19888
  };
19863
19889
  case 49:
19864
19890
  return {
19865
19891
  op,
19866
19892
  arg: view.getBigInt64((current += 8) - 8),
19867
- offset,
19868
- size: 9
19893
+ offset
19869
19894
  };
19870
19895
  case 38:
19871
19896
  return {
19872
19897
  op,
19873
19898
  arg: view.getFloat32((current += 4) - 4),
19874
- offset,
19875
- size: 5
19899
+ offset
19876
19900
  };
19877
19901
  case 50:
19878
19902
  return {
19879
19903
  op,
19880
19904
  arg: view.getFloat64((current += 8) - 8),
19881
- offset,
19882
- size: 9
19905
+ offset
19883
19906
  };
19884
19907
  case 36:
19885
19908
  throw new Error(`Unknown opcode ${op}`);
@@ -19896,7 +19919,7 @@ function parseCode(view, lineTable) {
19896
19919
  }
19897
19920
  results.push(nextOp);
19898
19921
  }
19899
- results.push({ op: 0, size: 1, offset: current });
19922
+ results.push({ op: 0, offset: current });
19900
19923
  return results;
19901
19924
  }
19902
19925
  function opcodeSize(op) {
@@ -19945,6 +19968,8 @@ function opcodeSize(op) {
19945
19968
  case 68:
19946
19969
  case 73:
19947
19970
  case 75:
19971
+ case 10:
19972
+ case 11:
19948
19973
  return 1;
19949
19974
  case 1:
19950
19975
  case 15:
@@ -19953,8 +19978,6 @@ function opcodeSize(op) {
19953
19978
  case 43:
19954
19979
  case 46:
19955
19980
  case 53:
19956
- case 10:
19957
- case 11:
19958
19981
  case 56:
19959
19982
  return 2;
19960
19983
  case 25:
@@ -21191,6 +21214,8 @@ function interpFunc(func, context) {
21191
21214
  break;
21192
21215
  }
21193
21216
  case 37:
21217
+ case 57:
21218
+ case 58:
21194
21219
  case 49:
21195
21220
  case 38:
21196
21221
  case 50:
@@ -21212,7 +21237,6 @@ function interpFunc(func, context) {
21212
21237
  op: 46,
21213
21238
  arg,
21214
21239
  offset: bc.offset,
21215
- size: 2,
21216
21240
  invert: localState.stack.length <= ~index
21217
21241
  });
21218
21242
  } else {
@@ -21221,7 +21245,6 @@ function interpFunc(func, context) {
21221
21245
  op: 18,
21222
21246
  arg,
21223
21247
  offset: bc.offset,
21224
- size: 2,
21225
21248
  invert: localState.locals.length <= index
21226
21249
  });
21227
21250
  }
@@ -21400,11 +21423,9 @@ function interpFunc(func, context) {
21400
21423
  } else {
21401
21424
  delete orig.arg;
21402
21425
  }
21403
- orig.size = rep.size;
21404
21426
  if (rep.invert) {
21405
21427
  const invv = { ...orig };
21406
21428
  invv.op = 45;
21407
- invv.size = 1;
21408
21429
  invv.offset = context.nextOffset++;
21409
21430
  delete invv.arg;
21410
21431
  block.bytecodes.splice(i + 1, 0, invv);
@@ -21434,7 +21455,6 @@ function interpFunc(func, context) {
21434
21455
  for (let i = 0; i < pops; i++) {
21435
21456
  block.bytecodes.push({
21436
21457
  op: 2,
21437
- size: 1,
21438
21458
  offset: context.nextOffset++
21439
21459
  });
21440
21460
  }
@@ -21453,38 +21473,35 @@ function instForType(type, offset) {
21453
21473
  return null;
21454
21474
  switch (type.type) {
21455
21475
  case 1:
21456
- return { op: 44, offset, size: 1 };
21476
+ return { op: 44, offset };
21457
21477
  case 2:
21458
21478
  case 4:
21459
21479
  return {
21460
21480
  op: 43,
21461
21481
  arg: type.type === 2 ? 0 : 1,
21462
- offset,
21463
- size: 1
21482
+ offset
21464
21483
  };
21465
21484
  case 8:
21466
- return { op: 37, arg: type.value, offset, size: 1 };
21485
+ return { op: 37, arg: type.value, offset };
21467
21486
  case 16:
21468
- return { op: 49, arg: type.value, offset, size: 1 };
21487
+ return { op: 49, arg: type.value, offset };
21469
21488
  case 32:
21470
- return { op: 38, arg: type.value, offset, size: 1 };
21489
+ return { op: 38, arg: type.value, offset };
21471
21490
  case 64:
21472
- return { op: 50, arg: type.value, offset, size: 1 };
21491
+ return { op: 50, arg: type.value, offset };
21473
21492
  case 128:
21474
21493
  return {
21475
21494
  op: 52,
21476
21495
  arg: type.value.charCodeAt(0),
21477
- offset,
21478
- size: 1
21496
+ offset
21479
21497
  };
21480
21498
  case 131072: {
21481
21499
  const match = type.value.match(/<(\d+)>$/);
21482
21500
  (0, import_node_assert7.default)(match);
21483
21501
  return {
21484
- op: 37,
21502
+ op: 39,
21485
21503
  arg: parseInt(match[1], 10),
21486
- offset,
21487
- size: 1
21504
+ offset
21488
21505
  };
21489
21506
  }
21490
21507
  }
@@ -21590,7 +21607,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
21590
21607
  }
21591
21608
  if (initType) {
21592
21609
  const bc = block.bytecodes[found - 1];
21593
- if (bc.op !== 46 && (!initInst || initInst.size > bc.size)) {
21610
+ if (bc.op !== 46 && (!initInst || opcodeSize(initInst.op) > opcodeSize(bc.op))) {
21594
21611
  const { push, pop } = getOpInfo(bc);
21595
21612
  if (push === 1 && pop === 0) {
21596
21613
  initInst = bc;
@@ -21624,7 +21641,6 @@ function optimizeArrayInit(func, block, index, context, interpState) {
21624
21641
  const bc = block.bytecodes[i2];
21625
21642
  const op = bc.op;
21626
21643
  bc.op = 2;
21627
- bc.size = 1;
21628
21644
  delete bc.arg;
21629
21645
  (0, import_node_assert8.default)(
21630
21646
  op === 17
@@ -21687,7 +21703,7 @@ function optimizeArrayInit(func, block, index, context, interpState) {
21687
21703
  } else {
21688
21704
  initInst = null;
21689
21705
  }
21690
- if (initLocal && (!initInst || initInst.size > initLocal.size)) {
21706
+ if (initLocal && (!initInst || opcodeSize(initInst.op) > opcodeSize(initLocal.op))) {
21691
21707
  initInst = initLocal;
21692
21708
  }
21693
21709
  if (initInst) {
@@ -22278,7 +22294,6 @@ function minimizeLocals2(func, equivSets, context) {
22278
22294
  const argCount = bc;
22279
22295
  argCount.op = 53;
22280
22296
  argCount.arg = argc;
22281
- argCount.size = 2;
22282
22297
  filter = true;
22283
22298
  }
22284
22299
  break;
@@ -22299,7 +22314,6 @@ function minimizeLocals2(func, equivSets, context) {
22299
22314
  const nop = bc;
22300
22315
  nop.op = 0;
22301
22316
  delete nop.arg;
22302
- nop.size = 1;
22303
22317
  filter = true;
22304
22318
  }
22305
22319
  break;
@@ -22543,11 +22557,17 @@ function sizeBasedPRE2(func, context) {
22543
22557
  view.setFloat32(0, bc.arg);
22544
22558
  return BigInt(view.getInt32(0)) << 8n | BigInt(bc.op);
22545
22559
  }
22560
+ case 37:
22561
+ case 57:
22562
+ case 58:
22563
+ return BigInt(bc.arg) << 8n | BigInt(
22564
+ 37
22565
+ /* ipush */
22566
+ );
22546
22567
  case 39:
22547
22568
  if (bcs[index + 1]?.op === 48) {
22548
22569
  break;
22549
22570
  }
22550
- case 37:
22551
22571
  case 49:
22552
22572
  case 52:
22553
22573
  case 24:
@@ -22672,7 +22692,6 @@ function sizeBasedPRE2(func, context) {
22672
22692
  bc2.op = 0;
22673
22693
  prev.op = 18;
22674
22694
  prev.arg = slot;
22675
- prev.size = 2;
22676
22695
  }
22677
22696
  })
22678
22697
  );
@@ -22697,7 +22716,6 @@ function sizeBasedPRE2(func, context) {
22697
22716
  bcs.forEach((bc2) => {
22698
22717
  bc2.op = 18;
22699
22718
  bc2.arg = slot;
22700
- bc2.size = 2;
22701
22719
  });
22702
22720
  }
22703
22721
  });
@@ -22762,7 +22780,7 @@ function blockSharing(func, context) {
22762
22780
  blocks.forEach((block) => {
22763
22781
  const blockEnd = block.bytecodes[block.bytecodes.length - 1];
22764
22782
  if (!group.length) {
22765
- size = blockEnd.size;
22783
+ size = opcodeSize(blockEnd.op);
22766
22784
  } else {
22767
22785
  const key = group[0];
22768
22786
  const keyEnd = key.bytecodes[key.bytecodes.length - 1];
@@ -22831,7 +22849,7 @@ function blockSharing(func, context) {
22831
22849
  }
22832
22850
  entry.group.delete(block);
22833
22851
  } else {
22834
- const sz = size2 + (bc?.size ?? 0);
22852
+ const sz = size2 + (bc ? opcodeSize(bc.op) : 0);
22835
22853
  nextState.push({ group: blocks2.map((b) => group2[b]), size: sz });
22836
22854
  }
22837
22855
  });
@@ -23013,11 +23031,9 @@ function simpleOpts(func, context) {
23013
23031
  const dup = prev;
23014
23032
  dup.op = 46;
23015
23033
  dup.arg = 0;
23016
- dup.size = 2;
23017
23034
  const add = cur;
23018
23035
  add.op = 3;
23019
23036
  delete add.arg;
23020
- add.size = 1;
23021
23037
  logging3 && (0, import_chunk_SG7ODKRM.log)(`${func.name}: converting "ipush 1; shlv" to "dup 0; addv"`);
23022
23038
  continue;
23023
23039
  }
@@ -23034,7 +23050,6 @@ function simpleOpts(func, context) {
23034
23050
  changes = true;
23035
23051
  const mulv = cur;
23036
23052
  mulv.op = 5;
23037
- mulv.size = 1;
23038
23053
  delete mulv.arg;
23039
23054
  }
23040
23055
  }
@@ -23126,8 +23141,7 @@ function equalSymbolToEq(block, equalsIndex) {
23126
23141
  }
23127
23142
  block.bytecodes.splice(equalsIndex, 5, spush, {
23128
23143
  op: 26,
23129
- offset: invokem.offset,
23130
- size: 1
23144
+ offset: invokem.offset
23131
23145
  });
23132
23146
  (0, import_chunk_SG7ODKRM.logger)(
23133
23147
  "optimize",
@@ -23211,7 +23225,7 @@ function removeUnreachableCatches(func, context) {
23211
23225
  }
23212
23226
  delete next.preds;
23213
23227
  removeBlock(func, next.offset);
23214
- } else if (next.next == null && next.bytecodes.length < 3 && next.bytecodes.reduce((size, bc) => size + bc.size, 0) < 3 && countFallthroughPreds(func, next) > 1) {
23228
+ } else if (next.next == null && next.bytecodes.length < 3 && next.bytecodes.reduce((size, bc) => size + opcodeSize(bc.op), 0) < 3 && countFallthroughPreds(func, next) > 1) {
23215
23229
  (0, import_chunk_SG7ODKRM.logger)(
23216
23230
  "cfg",
23217
23231
  1,
@@ -23225,7 +23239,7 @@ function removeUnreachableCatches(func, context) {
23225
23239
  let offset = context.nextOffset;
23226
23240
  next.bytecodes.forEach((bc) => {
23227
23241
  block.bytecodes.push({ ...bc, offset });
23228
- offset += bc.size;
23242
+ offset += opcodeSize(bc.op);
23229
23243
  });
23230
23244
  context.nextOffset = offset;
23231
23245
  redirect(func, block, next.offset, null);
@@ -23414,8 +23428,7 @@ function emitFunc(func, view, start, updateInfo, context) {
23414
23428
  const bc = {
23415
23429
  op: 25,
23416
23430
  arg: block.next,
23417
- offset: block.offset,
23418
- size: 3
23431
+ offset: block.offset
23419
23432
  };
23420
23433
  offset = emitBytecode(bc, view, offset, linktable, shift_hack);
23421
23434
  }
@@ -24161,6 +24174,9 @@ function bytecodeToString(bytecode, symbolTable) {
24161
24174
  }
24162
24175
  return `${Opcodes[bytecode.op]}${arg ?? ""}`;
24163
24176
  }
24177
+ function offsetAfter(bc) {
24178
+ return bc.offset + opcodeSize(bc.op);
24179
+ }
24164
24180
  function findFunctions({
24165
24181
  bytecodes,
24166
24182
  symbolTable,
@@ -24180,13 +24196,13 @@ function findFunctions({
24180
24196
  case 41:
24181
24197
  case 25:
24182
24198
  case 35:
24183
- blockStarts.add(bytecode.offset + bytecode.size);
24199
+ blockStarts.add(offsetAfter(bytecode));
24184
24200
  blockStarts.add(bytecode.arg);
24185
24201
  return;
24186
24202
  case 22:
24187
24203
  case 23:
24188
24204
  case 51:
24189
- blockStarts.add(bytecode.offset + bytecode.size);
24205
+ blockStarts.add(offsetAfter(bytecode));
24190
24206
  return;
24191
24207
  }
24192
24208
  });
@@ -24197,7 +24213,7 @@ function findFunctions({
24197
24213
  let next;
24198
24214
  let taken;
24199
24215
  bytecodes.forEach((bytecode, i) => {
24200
- const nextBcOffset = bytecode.offset + bytecode.size;
24216
+ const nextBcOffset = offsetAfter(bytecode);
24201
24217
  next = nextBcOffset;
24202
24218
  taken = void 0;
24203
24219
  switch (bytecode.op) {
@@ -24327,7 +24343,6 @@ function findFunctions({
24327
24343
  function makeArgless(bc, op) {
24328
24344
  bc.op = op;
24329
24345
  delete bc.arg;
24330
- bc.size = 1;
24331
24346
  }
24332
24347
  function removeBlock(func, offset) {
24333
24348
  const block = func.blocks.get(offset);
@@ -28366,7 +28381,7 @@ async function launchSimulator(force = true) {
28366
28381
  for (let i = 0; ; i++) {
28367
28382
  if (await checkIfSimulatorRunning())
28368
28383
  return;
28369
- if (i === 10)
28384
+ if (i === 25)
28370
28385
  return;
28371
28386
  await new Promise((r) => setTimeout(r, 200));
28372
28387
  }
@@ -28591,19 +28606,6 @@ async function generateOptimizedProject(options) {
28591
28606
  const pick_one = config.products ? config.products.indexOf("pick-one") : -1;
28592
28607
  if (pick_one >= 0) {
28593
28608
  let preferredProduct = 0;
28594
- targets.every((t, i) => {
28595
- const dev = devices[t.product];
28596
- if (!dev)
28597
- return true;
28598
- if (dev.ciqVersions.every((ciq) => ciq.startsWith("5"))) {
28599
- preferredProduct = i;
28600
- return false;
28601
- }
28602
- if (dev.ciqVersions.some((ciq) => ciq.startsWith("5"))) {
28603
- preferredProduct = i;
28604
- }
28605
- return true;
28606
- });
28607
28609
  options.products = [...options.products];
28608
28610
  options.products[pick_one] = targets[preferredProduct].product;
28609
28611
  }
@@ -28981,7 +28983,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
28981
28983
  const opt_time = await (0, import_chunk_SG7ODKRM.first_modified)(
28982
28984
  Object.values(fnMap).map((v) => v.output)
28983
28985
  );
28984
- if (source_time < opt_time && 1712442631755 < opt_time) {
28986
+ if (source_time < opt_time && 1713154555665 < opt_time) {
28985
28987
  return {
28986
28988
  hasTests,
28987
28989
  diagnostics: prevDiagnostics,
@@ -29020,7 +29022,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
29020
29022
  hasTests: hasTests2,
29021
29023
  diagnostics,
29022
29024
  sdkVersion,
29023
- optimizerVersion: "1.1.52",
29025
+ optimizerVersion: "1.1.54",
29024
29026
  ...Object.fromEntries(
29025
29027
  configOptionsToCheck.map((option) => [option, config[option]])
29026
29028
  )
@@ -29517,7 +29519,7 @@ function optimizeProgramBuffer(filepath, view, debugXml, apiDebugXml, key, confi
29517
29519
  exceptionsMap,
29518
29520
  key,
29519
29521
  debugXml,
29520
- nextOffset: (bytecodes[bytecodes.length - 1]?.offset ?? 0) + (bytecodes[bytecodes.length - 1]?.size ?? 0),
29522
+ nextOffset: bytecodes[bytecodes.length - 1] ? offsetAfter(bytecodes[bytecodes.length - 1]) : 0,
29521
29523
  nextLocalId: 0
29522
29524
  };
29523
29525
  optimizeBytecode(context);
@@ -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_J5XJWBYV.StateNodeAttributes,
22
- buildOptimizedProject: () => import_chunk_J5XJWBYV.buildOptimizedProject,
21
+ StateNodeAttributes: () => import_chunk_5K64MLXC.StateNodeAttributes,
22
+ buildOptimizedProject: () => import_chunk_5K64MLXC.buildOptimizedProject,
23
23
  copyRecursiveAsNeeded: () => import_chunk_SG7ODKRM.copyRecursiveAsNeeded,
24
- defaultConfig: () => import_chunk_J5XJWBYV.defaultConfig,
25
- display: () => import_chunk_J5XJWBYV.display,
26
- generateOneConfig: () => import_chunk_J5XJWBYV.generateOneConfig,
27
- generateOptimizedProject: () => import_chunk_J5XJWBYV.generateOptimizedProject,
28
- getConfig: () => import_chunk_J5XJWBYV.getConfig,
29
- getProjectAnalysis: () => import_chunk_J5XJWBYV.getProjectAnalysis,
30
- get_jungle: () => import_chunk_J5XJWBYV.get_jungle,
31
- isErrorWithLocation: () => import_chunk_J5XJWBYV.isErrorWithLocation,
32
- launchSimulator: () => import_chunk_J5XJWBYV.launchSimulator,
33
- manifestProducts: () => import_chunk_J5XJWBYV.manifestProducts,
34
- mctree: () => import_chunk_J5XJWBYV.mctree,
35
- simulateProgram: () => import_chunk_J5XJWBYV.simulateProgram
24
+ defaultConfig: () => import_chunk_5K64MLXC.defaultConfig,
25
+ display: () => import_chunk_5K64MLXC.display,
26
+ generateOneConfig: () => import_chunk_5K64MLXC.generateOneConfig,
27
+ generateOptimizedProject: () => import_chunk_5K64MLXC.generateOptimizedProject,
28
+ getConfig: () => import_chunk_5K64MLXC.getConfig,
29
+ getProjectAnalysis: () => import_chunk_5K64MLXC.getProjectAnalysis,
30
+ get_jungle: () => import_chunk_5K64MLXC.get_jungle,
31
+ isErrorWithLocation: () => import_chunk_5K64MLXC.isErrorWithLocation,
32
+ launchSimulator: () => import_chunk_5K64MLXC.launchSimulator,
33
+ manifestProducts: () => import_chunk_5K64MLXC.manifestProducts,
34
+ mctree: () => import_chunk_5K64MLXC.mctree,
35
+ simulateProgram: () => import_chunk_5K64MLXC.simulateProgram
36
36
  });
37
37
  module.exports = __toCommonJS(optimizer_exports);
38
- var import_chunk_J5XJWBYV = require("./chunk-J5XJWBYV.cjs");
38
+ var import_chunk_5K64MLXC = require("./chunk-5K64MLXC.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_J5XJWBYV.init_optimizer)();
42
+ (0, import_chunk_5K64MLXC.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_J5XJWBYV.SectionKinds,
22
- appSupport: () => import_chunk_J5XJWBYV.appSupport,
23
- connectiq: () => import_chunk_J5XJWBYV.connectiq,
24
- getDeviceInfo: () => import_chunk_J5XJWBYV.getDeviceInfo,
25
- getFunctionDocumentation: () => import_chunk_J5XJWBYV.getFunctionDocumentation,
26
- getLanguages: () => import_chunk_J5XJWBYV.getLanguages,
27
- getSdkPath: () => import_chunk_J5XJWBYV.getSdkPath,
28
- isWin: () => import_chunk_J5XJWBYV.isWin,
29
- optimizeProgram: () => import_chunk_J5XJWBYV.optimizeProgram,
30
- readPrg: () => import_chunk_J5XJWBYV.readPrg,
31
- readPrgWithOffsets: () => import_chunk_J5XJWBYV.readPrgWithOffsets,
32
- xmlUtil: () => import_chunk_J5XJWBYV.xml_util_exports
21
+ SectionKinds: () => import_chunk_5K64MLXC.SectionKinds,
22
+ appSupport: () => import_chunk_5K64MLXC.appSupport,
23
+ connectiq: () => import_chunk_5K64MLXC.connectiq,
24
+ getDeviceInfo: () => import_chunk_5K64MLXC.getDeviceInfo,
25
+ getFunctionDocumentation: () => import_chunk_5K64MLXC.getFunctionDocumentation,
26
+ getLanguages: () => import_chunk_5K64MLXC.getLanguages,
27
+ getSdkPath: () => import_chunk_5K64MLXC.getSdkPath,
28
+ isWin: () => import_chunk_5K64MLXC.isWin,
29
+ optimizeProgram: () => import_chunk_5K64MLXC.optimizeProgram,
30
+ readPrg: () => import_chunk_5K64MLXC.readPrg,
31
+ readPrgWithOffsets: () => import_chunk_5K64MLXC.readPrgWithOffsets,
32
+ xmlUtil: () => import_chunk_5K64MLXC.xml_util_exports
33
33
  });
34
34
  module.exports = __toCommonJS(sdk_util_exports);
35
- var import_chunk_J5XJWBYV = require("./chunk-J5XJWBYV.cjs");
35
+ var import_chunk_5K64MLXC = require("./chunk-5K64MLXC.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_J5XJWBYV.init_sdk_util)();
39
+ (0, import_chunk_5K64MLXC.init_sdk_util)();
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
42
  SectionKinds,
@@ -1,12 +1,12 @@
1
1
  import { mctree } from "@markw65/prettier-plugin-monkeyc";
2
- import { FunctionStateNode, ProgramStateAnalysis } from "./optimizer-types";
2
+ import { Diagnostic, FunctionStateNode, ProgramStateAnalysis } from "./optimizer-types";
3
3
  export declare function inlinableSubExpression(expr: mctree.Expression): mctree.SimpleCallExpression | null;
4
4
  export declare function inlineRequested(state: ProgramStateAnalysis, func: FunctionStateNode): boolean;
5
5
  export declare function shouldInline(state: ProgramStateAnalysis, func: FunctionStateNode, call: mctree.CallExpression, context: InlineContext | null): boolean;
6
6
  type InlineBody = mctree.BlockStatement | mctree.ExpressionStatement["expression"];
7
7
  export declare function unused(state: ProgramStateAnalysis, expression: mctree.ExpressionStatement["expression"]): mctree.Statement[];
8
8
  export declare function unused(state: ProgramStateAnalysis, expression: mctree.ExpressionStatement["expression"], top: true): mctree.Statement[] | null;
9
- export declare function inlineDiagnostic(state: ProgramStateAnalysis, func: FunctionStateNode, call: mctree.CallExpression, message: string | null): void;
9
+ export declare function inlineDiagnostic(state: ProgramStateAnalysis, func: FunctionStateNode, call: mctree.CallExpression, message: string | null, extra?: Diagnostic["extra"]): void;
10
10
  export type InlineContext = mctree.ReturnStatement | mctree.IfStatement | mctree.AssignmentExpression | mctree.ExpressionStatement | mctree.VariableDeclarator;
11
11
  export declare function inlineFunction(state: ProgramStateAnalysis, func: FunctionStateNode, call: mctree.CallExpression, context: InlineContext | null): InlineBody | null;
12
12
  export declare function applyTypeIfNeeded(node: mctree.Node): mctree.Node;
@@ -1,5 +1,4 @@
1
1
  import { mctree } from "@markw65/prettier-plugin-monkeyc";
2
- import { EnumStringMember } from "@markw65/prettier-plugin-monkeyc/build/estree-types";
3
2
  import { xmlUtil } from "./sdk-util";
4
3
  import { ExactOrUnion } from "./type-flow/types";
5
4
  export type DiagnosticType = "ERROR" | "WARNING" | "INFO";
@@ -228,7 +227,7 @@ export type ProgramState = {
228
227
  };
229
228
  diagnostics?: Record<string, PreDiagnostic[]>;
230
229
  inlineDiagnostics?: Record<string, Diagnostic[]>;
231
- enumMap?: Map<EnumStringMember, EnumStateNode>;
230
+ enumMap?: Map<mctree.EnumStringMember, EnumStateNode>;
232
231
  };
233
232
  export type Finalized<T, Keys extends keyof T> = T & {
234
233
  [key in Keys]-?: NonNullable<T[key]>;
@@ -62,6 +62,7 @@ export declare function functionToString(func: FuncEntry, context: Context | nul
62
62
  export declare function blockToString(block: Block, context: Context | null): string;
63
63
  export declare function lineInfoToString(lineInfo: LineNumber, context: Context | null): string;
64
64
  export declare function bytecodeToString(bytecode: Bytecode, symbolTable: SymbolTable | null | undefined): string;
65
+ export declare function offsetAfter(bc: Bytecode): number;
65
66
  export declare function findFunctions({ bytecodes, symbolTable, exceptionsMap, }: Context): Map<number, FuncEntry>;
66
67
  export declare function makeArgless(bc: Bytecode, op: Opcodes): void;
67
68
  export declare function equalBlocks(b1: Block, b2: Block): boolean;
@@ -80,7 +80,6 @@ export declare enum Opcodes {
80
80
  interface BaseOpcode {
81
81
  op: Opcodes;
82
82
  offset: number;
83
- size: number;
84
83
  lineNum?: LineNumber;
85
84
  arg?: unknown;
86
85
  }
@@ -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_J5XJWBYV = require("./chunk-J5XJWBYV.cjs");
24
+ var import_chunk_5K64MLXC = require("./chunk-5K64MLXC.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_J5XJWBYV.init_worker_task)();
31
+ (0, import_chunk_5K64MLXC.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_J5XJWBYV.performTask)(task));
34
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_5K64MLXC.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.52",
4
+ "version": "1.1.54",
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",
@@ -52,7 +52,7 @@
52
52
  "author": "markw65",
53
53
  "license": "MIT",
54
54
  "dependencies": {
55
- "@markw65/prettier-plugin-monkeyc": "^1.0.55"
55
+ "@markw65/prettier-plugin-monkeyc": "^1.0.56"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@markw65/peggy-optimizer": "^1.0.1",