@markw65/monkeyc-optimizer 1.1.75 → 1.1.76

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.76
6
+
7
+ - Fix member expression lookup when base type is exact
8
+ - Fix path-resolution inside locals in jungle files
9
+
5
10
  ### 1.1.75
6
11
 
7
12
  - Fix issues using personality files from barrels
package/build/api.cjs CHANGED
@@ -18,55 +18,57 @@ 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_7GXXJDR3.checkCompilerVersion,
22
- collectNamespaces: () => import_chunk_7GXXJDR3.collectNamespaces,
23
- createDocumentationMap: () => import_chunk_7GXXJDR3.createDocumentationMap,
24
- diagnostic: () => import_chunk_7GXXJDR3.diagnostic,
25
- diagnosticHelper: () => import_chunk_7GXXJDR3.diagnosticHelper,
26
- findNamesInScope: () => import_chunk_7GXXJDR3.findNamesInScope,
27
- findUsingForNode: () => import_chunk_7GXXJDR3.findUsingForNode,
28
- formatAst: () => import_chunk_7GXXJDR3.formatAst,
29
- formatAstLongLines: () => import_chunk_7GXXJDR3.formatAstLongLines,
30
- formatScopedName: () => import_chunk_7GXXJDR3.formatScopedName,
31
- getApiFunctionInfo: () => import_chunk_7GXXJDR3.getApiFunctionInfo,
32
- getApiMapping: () => import_chunk_7GXXJDR3.getApiMapping,
33
- getSuperClasses: () => import_chunk_7GXXJDR3.getSuperClasses,
34
- handleImportUsing: () => import_chunk_7GXXJDR3.handleImportUsing,
21
+ checkCompilerVersion: () => import_chunk_3OBK4E4Q.checkCompilerVersion,
22
+ collectNamespaces: () => import_chunk_3OBK4E4Q.collectNamespaces,
23
+ createDocumentationMap: () => import_chunk_3OBK4E4Q.createDocumentationMap,
24
+ declKey: () => import_chunk_3OBK4E4Q.declKey,
25
+ diagnostic: () => import_chunk_3OBK4E4Q.diagnostic,
26
+ diagnosticHelper: () => import_chunk_3OBK4E4Q.diagnosticHelper,
27
+ findNamesInScope: () => import_chunk_3OBK4E4Q.findNamesInScope,
28
+ findUsingForNode: () => import_chunk_3OBK4E4Q.findUsingForNode,
29
+ formatAst: () => import_chunk_3OBK4E4Q.formatAst,
30
+ formatAstLongLines: () => import_chunk_3OBK4E4Q.formatAstLongLines,
31
+ formatScopedName: () => import_chunk_3OBK4E4Q.formatScopedName,
32
+ getApiFunctionInfo: () => import_chunk_3OBK4E4Q.getApiFunctionInfo,
33
+ getApiMapping: () => import_chunk_3OBK4E4Q.getApiMapping,
34
+ getSuperClasses: () => import_chunk_3OBK4E4Q.getSuperClasses,
35
+ handleImportUsing: () => import_chunk_3OBK4E4Q.handleImportUsing,
35
36
  hasProperty: () => import_chunk_JDC43A3I.hasProperty,
36
- isClassVariable: () => import_chunk_7GXXJDR3.isClassVariable,
37
- isLocal: () => import_chunk_7GXXJDR3.isLocal,
38
- isLookupCandidate: () => import_chunk_7GXXJDR3.isLookupCandidate,
39
- isStateNode: () => import_chunk_7GXXJDR3.isStateNode,
40
- lookupByFullName: () => import_chunk_7GXXJDR3.lookupByFullName,
41
- lookupNext: () => import_chunk_7GXXJDR3.lookupNext,
42
- lookupResultContains: () => import_chunk_7GXXJDR3.lookupResultContains,
43
- lookupWithType: () => import_chunk_7GXXJDR3.lookupWithType,
44
- makeToyboxLink: () => import_chunk_7GXXJDR3.makeToyboxLink,
45
- mapVarDeclsByType: () => import_chunk_7GXXJDR3.mapVarDeclsByType,
46
- markInvokeClassMethod: () => import_chunk_7GXXJDR3.markInvokeClassMethod,
47
- parseSdkVersion: () => import_chunk_7GXXJDR3.parseSdkVersion,
48
- popRootNode: () => import_chunk_7GXXJDR3.popRootNode,
49
- pushRootNode: () => import_chunk_7GXXJDR3.pushRootNode,
50
- resolveDiagnostics: () => import_chunk_7GXXJDR3.resolveDiagnostics,
51
- resolveDiagnosticsMap: () => import_chunk_7GXXJDR3.resolveDiagnosticsMap,
52
- sameLookupResult: () => import_chunk_7GXXJDR3.sameLookupResult,
37
+ isClassVariable: () => import_chunk_3OBK4E4Q.isClassVariable,
38
+ isLocal: () => import_chunk_3OBK4E4Q.isLocal,
39
+ isLookupCandidate: () => import_chunk_3OBK4E4Q.isLookupCandidate,
40
+ isStateNode: () => import_chunk_3OBK4E4Q.isStateNode,
41
+ lookupByFullName: () => import_chunk_3OBK4E4Q.lookupByFullName,
42
+ lookupNext: () => import_chunk_3OBK4E4Q.lookupNext,
43
+ lookupResultContains: () => import_chunk_3OBK4E4Q.lookupResultContains,
44
+ lookupWithType: () => import_chunk_3OBK4E4Q.lookupWithType,
45
+ makeToyboxLink: () => import_chunk_3OBK4E4Q.makeToyboxLink,
46
+ mapVarDeclsByType: () => import_chunk_3OBK4E4Q.mapVarDeclsByType,
47
+ markInvokeClassMethod: () => import_chunk_3OBK4E4Q.markInvokeClassMethod,
48
+ parseSdkVersion: () => import_chunk_3OBK4E4Q.parseSdkVersion,
49
+ popRootNode: () => import_chunk_3OBK4E4Q.popRootNode,
50
+ pushRootNode: () => import_chunk_3OBK4E4Q.pushRootNode,
51
+ resolveDiagnostics: () => import_chunk_3OBK4E4Q.resolveDiagnostics,
52
+ resolveDiagnosticsMap: () => import_chunk_3OBK4E4Q.resolveDiagnosticsMap,
53
+ sameLookupResult: () => import_chunk_3OBK4E4Q.sameLookupResult,
53
54
  traverseAst: () => import_chunk_JDC43A3I.traverseAst,
54
- variableDeclarationName: () => import_chunk_7GXXJDR3.variableDeclarationName,
55
- visitReferences: () => import_chunk_7GXXJDR3.visitReferences,
56
- visit_resources: () => import_chunk_7GXXJDR3.visit_resources,
57
- visitorNode: () => import_chunk_7GXXJDR3.visitorNode
55
+ variableDeclarationName: () => import_chunk_3OBK4E4Q.variableDeclarationName,
56
+ visitReferences: () => import_chunk_3OBK4E4Q.visitReferences,
57
+ visit_resources: () => import_chunk_3OBK4E4Q.visit_resources,
58
+ visitorNode: () => import_chunk_3OBK4E4Q.visitorNode
58
59
  });
59
60
  module.exports = __toCommonJS(api_exports);
60
- var import_chunk_7GXXJDR3 = require("./chunk-7GXXJDR3.cjs");
61
+ var import_chunk_3OBK4E4Q = require("./chunk-3OBK4E4Q.cjs");
61
62
  var import_chunk_NHZRKHZO = require("./chunk-NHZRKHZO.cjs");
62
63
  var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
63
64
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
64
- (0, import_chunk_7GXXJDR3.init_api)();
65
+ (0, import_chunk_3OBK4E4Q.init_api)();
65
66
  // Annotate the CommonJS export names for ESM import in node:
66
67
  0 && (module.exports = {
67
68
  checkCompilerVersion,
68
69
  collectNamespaces,
69
70
  createDocumentationMap,
71
+ declKey,
70
72
  diagnostic,
71
73
  diagnosticHelper,
72
74
  findNamesInScope,
@@ -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_7GXXJDR3_exports = {};
30
- __export(chunk_7GXXJDR3_exports, {
29
+ var chunk_3OBK4E4Q_exports = {};
30
+ __export(chunk_3OBK4E4Q_exports, {
31
31
  EnumTagsConst: () => EnumTagsConst,
32
32
  LastTypeTag: () => LastTypeTag,
33
33
  ObjectLikeTagsConst: () => ObjectLikeTagsConst,
@@ -44,6 +44,7 @@ __export(chunk_7GXXJDR3_exports, {
44
44
  connectiq: () => connectiq,
45
45
  couldBe: () => couldBe,
46
46
  createDocumentationMap: () => createDocumentationMap,
47
+ declKey: () => declKey,
47
48
  defaultConfig: () => defaultConfig,
48
49
  diagnostic: () => diagnostic,
49
50
  diagnosticHelper: () => diagnosticHelper,
@@ -138,7 +139,7 @@ __export(chunk_7GXXJDR3_exports, {
138
139
  visitorNode: () => visitorNode,
139
140
  xml_util_exports: () => xml_util_exports
140
141
  });
141
- module.exports = __toCommonJS(chunk_7GXXJDR3_exports);
142
+ module.exports = __toCommonJS(chunk_3OBK4E4Q_exports);
142
143
  var import_chunk_NHZRKHZO = require("./chunk-NHZRKHZO.cjs");
143
144
  var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
144
145
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
@@ -9273,89 +9274,84 @@ function printBlockTrailer(block) {
9273
9274
  `Succs: ${(block.succs || []).map((block2) => block2.order).join(", ")} ExSucc: ${block.exsucc ? block.exsucc.order : ""}`
9274
9275
  );
9275
9276
  }
9276
- function filterDecls(decls, possible, name) {
9277
+ function filterDecls(state, decls, next) {
9278
+ const possible = (0, import_chunk_JDC43A3I.hasProperty)(state.allDeclarations, next.name) && state.allDeclarations[next.name];
9277
9279
  if (!possible)
9278
9280
  return [null, null];
9279
- const result = decls.reduce(
9280
- (cur, decl) => {
9281
- let declSups;
9282
- const found = possible.reduce((flag, poss) => {
9283
- if (decl === poss || poss.type === "ClassDeclaration" && getSuperClasses(poss)?.has(decl)) {
9284
- if (!cur[0]) {
9285
- cur = [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()];
9286
- }
9287
- cur[0].add(poss);
9288
- cur[1].add(poss);
9289
- return true;
9290
- } else if (declSups !== void 0 ? declSups?.has(poss) : decl.type === "ClassDeclaration" && (declSups = getSuperClasses(decl))?.has(poss)) {
9291
- if (!cur[0]) {
9292
- cur = [/* @__PURE__ */ new Set([decl]), /* @__PURE__ */ new Set([poss])];
9293
- } else {
9294
- cur[0].add(decl);
9295
- if (Array.from(cur[1]).every((d) => {
9296
- if (decl === d)
9297
- return false;
9298
- if (!declSups.has(d))
9299
- return true;
9300
- if (d.type === "ClassDeclaration" && getSuperClasses(d)?.has(poss)) {
9301
- return false;
9302
- }
9303
- if (poss.type === "ClassDeclaration" && getSuperClasses(poss)?.has(d)) {
9304
- cur[1].delete(d);
9305
- }
9306
- return true;
9307
- })) {
9308
- cur[1].add(poss);
9309
- }
9281
+ const result = decls.reduce((cur, { sn: decl, exact }) => {
9282
+ let declSups;
9283
+ const getDeclSups = () => declSups !== void 0 ? declSups : decl.type === "ClassDeclaration" ? declSups = getSuperClasses(decl) : null;
9284
+ const found = possible.reduce((flag, poss) => {
9285
+ if (decl === poss || !exact && poss.type === "ClassDeclaration" && getSuperClasses(poss)?.has(decl)) {
9286
+ if (!cur) {
9287
+ cur = [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()];
9288
+ }
9289
+ cur[0].add(poss);
9290
+ cur[1].add(poss);
9291
+ if (cur[2].size && decl === poss && decl.type === "ClassDeclaration") {
9292
+ const posSupers = getSuperClasses(decl);
9293
+ if (posSupers) {
9294
+ cur[2].forEach((s) => posSupers.has(s) && cur[2].delete(s));
9310
9295
  }
9311
- return true;
9312
9296
  }
9313
- return flag;
9314
- }, false);
9315
- if (!found) {
9316
- let d = [decl];
9317
- do {
9318
- d.forEach((d2) => {
9319
- const stack = d2.stack;
9320
- possible.forEach((poss) => {
9321
- for (let i = stack.length; i--; ) {
9322
- const sn = stack[i].sn;
9323
- if (sn.decls === poss.decls) {
9324
- if (!cur[0]) {
9325
- cur = [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()];
9326
- }
9327
- cur[0].add(decl);
9328
- cur[1].add(poss);
9329
- break;
9330
- }
9331
- if ((0, import_chunk_JDC43A3I.hasProperty)(sn.decls, name)) {
9332
- break;
9297
+ return true;
9298
+ } else if (poss.type === "ClassDeclaration" && getDeclSups()?.has(poss)) {
9299
+ if (!cur) {
9300
+ cur = [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()];
9301
+ }
9302
+ cur[0].add(decl);
9303
+ const supers = Array.from(cur[2]);
9304
+ if (!supers.some((s) => getSuperClasses(s)?.has(poss))) {
9305
+ const posSupers = getSuperClasses(poss);
9306
+ posSupers && supers.forEach((s) => posSupers.has(s) && cur[2].delete(s));
9307
+ cur[2].add(poss);
9308
+ }
9309
+ return true;
9310
+ }
9311
+ return flag;
9312
+ }, false);
9313
+ if (!found) {
9314
+ let d = [decl];
9315
+ do {
9316
+ d.forEach((d2) => {
9317
+ const stack = d2.stack;
9318
+ possible.forEach((poss) => {
9319
+ for (let i = stack.length; i--; ) {
9320
+ const sn = stack[i].sn;
9321
+ if (sn.decls === poss.decls) {
9322
+ if (!cur) {
9323
+ cur = [/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set()];
9333
9324
  }
9325
+ cur[0].add(decl);
9326
+ cur[1].add(poss);
9327
+ break;
9328
+ }
9329
+ if ((0, import_chunk_JDC43A3I.hasProperty)(sn.decls, next.name)) {
9330
+ break;
9334
9331
  }
9335
- });
9336
- });
9337
- d = d.flatMap((d2) => {
9338
- if (d2.type !== "ClassDeclaration" || !d2.superClass || d2.superClass === true) {
9339
- return [];
9340
9332
  }
9341
- return d2.superClass;
9342
9333
  });
9343
- } while (d.length);
9344
- }
9345
- return cur;
9346
- },
9347
- [null, null]
9348
- );
9349
- if (!result[0])
9334
+ });
9335
+ d = d.flatMap((d2) => {
9336
+ if (d2.type !== "ClassDeclaration" || !d2.superClass || d2.superClass === true) {
9337
+ return [];
9338
+ }
9339
+ return d2.superClass;
9340
+ });
9341
+ } while (d.length);
9342
+ }
9343
+ return cur;
9344
+ }, null);
9345
+ if (!result)
9350
9346
  return [null, null];
9347
+ result[2].forEach((c) => result[1].add(c));
9351
9348
  return [Array.from(result[0]), Array.from(result[1])];
9352
9349
  }
9353
9350
  function findObjectDeclsByProperty(state, object, next) {
9354
- const decls = getStateNodeDeclsFromType(state, object);
9351
+ const decls = getStateNodeDeclsWithExactFromType(state, object);
9355
9352
  if (!decls)
9356
9353
  return [null, null];
9357
- const possibleDecls = (0, import_chunk_JDC43A3I.hasProperty)(state.allDeclarations, next.name) && state.allDeclarations[next.name];
9358
- return filterDecls(decls, possibleDecls, next.name);
9354
+ return filterDecls(state, decls, next);
9359
9355
  }
9360
9356
  function refineObjectTypeByDecls(istate, object, trueDecls) {
9361
9357
  const refinedType = typeFromTypeStateNodes(istate.state, trueDecls);
@@ -12207,6 +12203,9 @@ function setUnionComponent(v, tag, c) {
12207
12203
  }
12208
12204
  }
12209
12205
  function getStateNodeDeclsFromType(state, object) {
12206
+ return getStateNodeDeclsWithExactFromType(state, object).map(({ sn }) => sn);
12207
+ }
12208
+ function getStateNodeDeclsWithExactFromType(state, object) {
12210
12209
  const decls = [];
12211
12210
  if (object.value != null && object.type & (4096 | 16384 | 32768)) {
12212
12211
  forEachUnionComponent(
@@ -12218,20 +12217,15 @@ function getStateNodeDeclsFromType(state, object) {
12218
12217
  switch (type.type) {
12219
12218
  case 32768:
12220
12219
  if (type.value.klass.type === 16384 && type.value.klass.value) {
12221
- if (Array.isArray(type.value.klass.value)) {
12222
- decls.push(...type.value.klass.value);
12223
- } else {
12224
- decls.push(type.value.klass.value);
12225
- }
12220
+ (0, import_chunk_NHZRKHZO.forEach)(
12221
+ type.value.klass.value,
12222
+ (sn) => decls.push({ sn, exact: false })
12223
+ );
12226
12224
  }
12227
12225
  break;
12228
12226
  case 4096:
12229
12227
  case 16384:
12230
- if (Array.isArray(type.value)) {
12231
- decls.push(...type.value);
12232
- } else {
12233
- decls.push(type.value);
12234
- }
12228
+ (0, import_chunk_NHZRKHZO.forEach)(type.value, (sn) => decls.push({ sn, exact: true }));
12235
12229
  break;
12236
12230
  }
12237
12231
  }
@@ -12251,7 +12245,7 @@ function getStateNodeDeclsFromType(state, object) {
12251
12245
  }
12252
12246
  const name = `Toybox.Lang.${typeTagName(bit)}`;
12253
12247
  const sns = lookupByFullName(state, name);
12254
- sns.forEach((sn) => isStateNode(sn) && decls.push(sn));
12248
+ sns.forEach((sn) => isStateNode(sn) && decls.push({ sn, exact: true }));
12255
12249
  bits = next;
12256
12250
  } while (bits);
12257
12251
  }
@@ -28599,7 +28593,13 @@ function evaluate_locals(assignments) {
28599
28593
  while (true) {
28600
28594
  assignments = assignments.filter((a) => {
28601
28595
  if (a.names.length === 1 && a.values.every((v) => v.type === "Literal")) {
28602
- locals[a.names[0]] = a.values;
28596
+ locals[a.names[0]] = a.values.map((v) => {
28597
+ if ("source" in v) {
28598
+ v = { ...v };
28599
+ delete v.source;
28600
+ }
28601
+ return v;
28602
+ });
28603
28603
  return false;
28604
28604
  }
28605
28605
  return true;
@@ -30184,7 +30184,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
30184
30184
  const opt_time = await (0, import_chunk_NHZRKHZO.first_modified)(
30185
30185
  Object.values(fnMap).map((v) => v.output)
30186
30186
  );
30187
- if (source_time < opt_time && 1726412336564 < opt_time) {
30187
+ if (source_time < opt_time && 1726690662875 < opt_time) {
30188
30188
  return {
30189
30189
  hasTests,
30190
30190
  diagnostics: prevDiagnostics,
@@ -30222,7 +30222,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
30222
30222
  hasTests: hasTests2,
30223
30223
  diagnostics,
30224
30224
  sdkVersion,
30225
- optimizerVersion: "1.1.75",
30225
+ optimizerVersion: "1.1.76",
30226
30226
  ...Object.fromEntries(
30227
30227
  configOptionsToCheck.map((option) => [option, config[option]])
30228
30228
  )
@@ -31057,6 +31057,7 @@ var init_sdk_util = (0, import_chunk_ABYVSU2C.__esm)({
31057
31057
  connectiq,
31058
31058
  couldBe,
31059
31059
  createDocumentationMap,
31060
+ declKey,
31060
31061
  defaultConfig,
31061
31062
  diagnostic,
31062
31063
  diagnosticHelper,
@@ -18,30 +18,30 @@ 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_7GXXJDR3.StateNodeAttributes,
22
- buildConfigDescription: () => import_chunk_7GXXJDR3.buildConfigDescription,
23
- buildOptimizedProject: () => import_chunk_7GXXJDR3.buildOptimizedProject,
21
+ StateNodeAttributes: () => import_chunk_3OBK4E4Q.StateNodeAttributes,
22
+ buildConfigDescription: () => import_chunk_3OBK4E4Q.buildConfigDescription,
23
+ buildOptimizedProject: () => import_chunk_3OBK4E4Q.buildOptimizedProject,
24
24
  copyRecursiveAsNeeded: () => import_chunk_NHZRKHZO.copyRecursiveAsNeeded,
25
- defaultConfig: () => import_chunk_7GXXJDR3.defaultConfig,
26
- display: () => import_chunk_7GXXJDR3.display,
27
- generateOneConfig: () => import_chunk_7GXXJDR3.generateOneConfig,
28
- generateOptimizedProject: () => import_chunk_7GXXJDR3.generateOptimizedProject,
29
- getConfig: () => import_chunk_7GXXJDR3.getConfig,
30
- getFnMapAnalysis: () => import_chunk_7GXXJDR3.getFnMapAnalysis,
31
- getProjectAnalysis: () => import_chunk_7GXXJDR3.getProjectAnalysis,
32
- get_jungle: () => import_chunk_7GXXJDR3.get_jungle,
33
- isErrorWithLocation: () => import_chunk_7GXXJDR3.isErrorWithLocation,
34
- launchSimulator: () => import_chunk_7GXXJDR3.launchSimulator,
35
- manifestProducts: () => import_chunk_7GXXJDR3.manifestProducts,
36
- mctree: () => import_chunk_7GXXJDR3.mctree,
37
- simulateProgram: () => import_chunk_7GXXJDR3.simulateProgram
25
+ defaultConfig: () => import_chunk_3OBK4E4Q.defaultConfig,
26
+ display: () => import_chunk_3OBK4E4Q.display,
27
+ generateOneConfig: () => import_chunk_3OBK4E4Q.generateOneConfig,
28
+ generateOptimizedProject: () => import_chunk_3OBK4E4Q.generateOptimizedProject,
29
+ getConfig: () => import_chunk_3OBK4E4Q.getConfig,
30
+ getFnMapAnalysis: () => import_chunk_3OBK4E4Q.getFnMapAnalysis,
31
+ getProjectAnalysis: () => import_chunk_3OBK4E4Q.getProjectAnalysis,
32
+ get_jungle: () => import_chunk_3OBK4E4Q.get_jungle,
33
+ isErrorWithLocation: () => import_chunk_3OBK4E4Q.isErrorWithLocation,
34
+ launchSimulator: () => import_chunk_3OBK4E4Q.launchSimulator,
35
+ manifestProducts: () => import_chunk_3OBK4E4Q.manifestProducts,
36
+ mctree: () => import_chunk_3OBK4E4Q.mctree,
37
+ simulateProgram: () => import_chunk_3OBK4E4Q.simulateProgram
38
38
  });
39
39
  module.exports = __toCommonJS(optimizer_exports);
40
- var import_chunk_7GXXJDR3 = require("./chunk-7GXXJDR3.cjs");
40
+ var import_chunk_3OBK4E4Q = require("./chunk-3OBK4E4Q.cjs");
41
41
  var import_chunk_NHZRKHZO = require("./chunk-NHZRKHZO.cjs");
42
42
  var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
43
43
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
44
- (0, import_chunk_7GXXJDR3.init_optimizer)();
44
+ (0, import_chunk_3OBK4E4Q.init_optimizer)();
45
45
  // Annotate the CommonJS export names for ESM import in node:
46
46
  0 && (module.exports = {
47
47
  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_7GXXJDR3.SectionKinds,
22
- appSupport: () => import_chunk_7GXXJDR3.appSupport,
23
- connectiq: () => import_chunk_7GXXJDR3.connectiq,
24
- getDeviceInfo: () => import_chunk_7GXXJDR3.getDeviceInfo,
25
- getFunctionDocumentation: () => import_chunk_7GXXJDR3.getFunctionDocumentation,
26
- getLanguages: () => import_chunk_7GXXJDR3.getLanguages,
27
- getSdkPath: () => import_chunk_7GXXJDR3.getSdkPath,
28
- isWin: () => import_chunk_7GXXJDR3.isWin,
29
- optimizeProgram: () => import_chunk_7GXXJDR3.optimizeProgram,
30
- readPrg: () => import_chunk_7GXXJDR3.readPrg,
31
- readPrgWithOffsets: () => import_chunk_7GXXJDR3.readPrgWithOffsets,
32
- xmlUtil: () => import_chunk_7GXXJDR3.xml_util_exports
21
+ SectionKinds: () => import_chunk_3OBK4E4Q.SectionKinds,
22
+ appSupport: () => import_chunk_3OBK4E4Q.appSupport,
23
+ connectiq: () => import_chunk_3OBK4E4Q.connectiq,
24
+ getDeviceInfo: () => import_chunk_3OBK4E4Q.getDeviceInfo,
25
+ getFunctionDocumentation: () => import_chunk_3OBK4E4Q.getFunctionDocumentation,
26
+ getLanguages: () => import_chunk_3OBK4E4Q.getLanguages,
27
+ getSdkPath: () => import_chunk_3OBK4E4Q.getSdkPath,
28
+ isWin: () => import_chunk_3OBK4E4Q.isWin,
29
+ optimizeProgram: () => import_chunk_3OBK4E4Q.optimizeProgram,
30
+ readPrg: () => import_chunk_3OBK4E4Q.readPrg,
31
+ readPrgWithOffsets: () => import_chunk_3OBK4E4Q.readPrgWithOffsets,
32
+ xmlUtil: () => import_chunk_3OBK4E4Q.xml_util_exports
33
33
  });
34
34
  module.exports = __toCommonJS(sdk_util_exports);
35
- var import_chunk_7GXXJDR3 = require("./chunk-7GXXJDR3.cjs");
35
+ var import_chunk_3OBK4E4Q = require("./chunk-3OBK4E4Q.cjs");
36
36
  var import_chunk_NHZRKHZO = require("./chunk-NHZRKHZO.cjs");
37
37
  var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.cjs");
38
38
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
39
- (0, import_chunk_7GXXJDR3.init_sdk_util)();
39
+ (0, import_chunk_3OBK4E4Q.init_sdk_util)();
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
42
  SectionKinds,
@@ -19,6 +19,7 @@ export declare function isStateNode(node: {
19
19
  export declare function variableDeclarationName(node: mctree.TypedIdentifier | mctree.InstanceofIdentifier): string;
20
20
  type DeclKind = "decls" | "type_decls";
21
21
  export declare function sameLookupResult(a: LookupDefinition[], b: LookupDefinition[]): boolean;
22
+ export declare function declKey(decl: StateNodeDecl): string | mctree.Identifier | mctree.Program | mctree.VariableDeclarator | mctree.EnumStringMember | mctree.BlockStatement | mctree.ForStatement | mctree.ClassDeclaration | mctree.EnumDeclaration | mctree.FunctionDeclaration | mctree.TypedefDeclaration | mctree.AsIdentifier | undefined;
22
23
  export declare function lookupResultContains(a: LookupDefinition[], b: LookupDefinition[]): boolean;
23
24
  export declare function isLookupCandidate(node: mctree.MemberExpression): false | mctree.Identifier;
24
25
  export declare function lookupNext(state: ProgramStateLive, results: LookupDefinition[], decls: DeclKind, property: mctree.Identifier): LookupDefinition[] | null;
@@ -211,4 +211,8 @@ export declare function forEachUnionComponent(v: ExactOrUnion, bits: TypeTag, fn
211
211
  export declare function getUnionComponent<T extends ExactTypeTags>(v: ExactOrUnion, tag: T): ExactData<T> | null;
212
212
  export declare function setUnionComponent<T extends ExactTypeTags>(v: ExactOrUnion, tag: T, c: ExactData<T>): void;
213
213
  export declare function getStateNodeDeclsFromType(state: ProgramStateAnalysis, object: ExactOrUnion): StateNode[];
214
+ export declare function getStateNodeDeclsWithExactFromType(state: ProgramStateAnalysis, object: ExactOrUnion): {
215
+ sn: StateNode;
216
+ exact: boolean;
217
+ }[];
214
218
  export {};
@@ -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_7GXXJDR3 = require("./chunk-7GXXJDR3.cjs");
24
+ var import_chunk_3OBK4E4Q = require("./chunk-3OBK4E4Q.cjs");
25
25
  var import_chunk_NHZRKHZO = require("./chunk-NHZRKHZO.cjs");
26
26
  var import_chunk_JDC43A3I = require("./chunk-JDC43A3I.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_7GXXJDR3.init_worker_task)();
31
+ (0, import_chunk_3OBK4E4Q.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_7GXXJDR3.performTask)(task));
34
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_3OBK4E4Q.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.75",
4
+ "version": "1.1.76",
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",