@markw65/monkeyc-optimizer 1.1.61 → 1.1.63
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 +13 -0
- package/README.md +83 -1
- package/build/api.cjs +34 -34
- package/build/{chunk-KCCFA2PP.cjs → chunk-Y2ZRISYL.cjs} +56 -19
- package/build/optimizer.cjs +16 -16
- package/build/sdk-util.cjs +14 -14
- package/build/worker-thread.cjs +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the "monkeyc-optimizer" package will be documented in this file.
|
|
4
4
|
|
|
5
|
+
### 1.1.63
|
|
6
|
+
|
|
7
|
+
- Fixes #31 again, after the fix for #35 broke it
|
|
8
|
+
- Adds some example code in the README, describing how to use the project without `@markw65/prettier-extension-monkeyc`, or `VSCode`
|
|
9
|
+
|
|
10
|
+
### 1.1.62
|
|
11
|
+
|
|
12
|
+
- Update to [@markw65/prettier-plugin-monkeyc@1.0.58](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1058)
|
|
13
|
+
- Fix an indentation issue with interfaces
|
|
14
|
+
- Track uninitialized fields in class initializers (Part of fix for #35)
|
|
15
|
+
- Fix lookups for MemberExpressions with literal objects (Rest of fix for #35)
|
|
16
|
+
- Don't report parameters as missing symbols in interface functions (Fixes #36)
|
|
17
|
+
|
|
5
18
|
### 1.1.61
|
|
6
19
|
|
|
7
20
|
- Disable more post-build optimizations to allow apps to verify.
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ This package provides a set of utilities for working with Garmin Monkey-C projec
|
|
|
4
4
|
|
|
5
5
|
#### Optimization and analysis
|
|
6
6
|
|
|
7
|
-
Its primary purpose is to serve as the optimization and analysis engine behind [prettier-extension-monkeyc](https://marketplace.visualstudio.com/items?itemName=markw65.prettier-extension-monkeyc)
|
|
7
|
+
Its primary purpose is to serve as the optimization and analysis engine behind [prettier-extension-monkeyc](https://marketplace.visualstudio.com/items?itemName=markw65.prettier-extension-monkeyc), but it's [API](#api) can also be used to optimize code directly.
|
|
8
8
|
|
|
9
9
|
#### Font analysis
|
|
10
10
|
|
|
@@ -13,3 +13,85 @@ It also provides a tool to report information about the builtin fonts on a devic
|
|
|
13
13
|
## Release Notes
|
|
14
14
|
|
|
15
15
|
See [Change Log](CHANGELOG.md)
|
|
16
|
+
|
|
17
|
+
## API
|
|
18
|
+
|
|
19
|
+
First you will need to [install nodejs/npm](https://nodejs.org/en/download).
|
|
20
|
+
|
|
21
|
+
Then you can install the package. From the directory where you want to use it:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
npm install -D @markw65/monkeyc-optimizer
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then you need some javascript (or typescript) to invoke it. Here's a sample
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { buildOptimizedProject, getConfig } from "@markw65/monkeyc-optimizer";
|
|
31
|
+
import { optimizeProgram } from "@markw65/monkeyc-optimizer/sdk-util.js";
|
|
32
|
+
import * as path from "node:path";
|
|
33
|
+
|
|
34
|
+
const jungleFiles = process.argv[2];
|
|
35
|
+
const workspace = path.dirname(jungleFiles);
|
|
36
|
+
|
|
37
|
+
getConfig({
|
|
38
|
+
// These are largely the same options that can be passed to tasks in
|
|
39
|
+
// @markw65/prettier-extension-monkeyc (see the descriptions there)
|
|
40
|
+
// getConfig will read a number of options (such as developerKeyPath)
|
|
41
|
+
// from the vscode user settings, and the project settings, but anything
|
|
42
|
+
// passed in here will override those values.
|
|
43
|
+
//
|
|
44
|
+
// The root that output paths are relative to
|
|
45
|
+
// Defaults to the current directory
|
|
46
|
+
workspace,
|
|
47
|
+
// Where to put the files built by MonkeyC.
|
|
48
|
+
// Defaults to bin. Relative paths are relative to workspace
|
|
49
|
+
buildDir: "bin",
|
|
50
|
+
// Where to put the files generated by the source-to-source optimizer
|
|
51
|
+
// Defaults to bin/optimized. Relative paths are relative to workspace
|
|
52
|
+
outputPath: "bin/optimized",
|
|
53
|
+
// Semi-colon separated list of jungle files
|
|
54
|
+
jungleFiles,
|
|
55
|
+
// If true, don't actually run the MonkeyC compiler, just return the
|
|
56
|
+
// command to do so.
|
|
57
|
+
returnCommand: false,
|
|
58
|
+
}).then((options) =>
|
|
59
|
+
// Passing null instead of a device id will build an .iq file
|
|
60
|
+
buildOptimizedProject("fr955", options)
|
|
61
|
+
.then((result) => {
|
|
62
|
+
// The return value includes:
|
|
63
|
+
//
|
|
64
|
+
// exe - the executable to run to build the generated code ('java')
|
|
65
|
+
// args - the arguments to pass to exe
|
|
66
|
+
// diagnostics - collection of diagnostics raised by monkeyc-optimizer
|
|
67
|
+
// program - the program that was generated by monkeyc (or that would
|
|
68
|
+
// be generated, if returnCommand is true)
|
|
69
|
+
// product - the device that was targeted.
|
|
70
|
+
// hasTests - true if any functions marked by (:test) were found
|
|
71
|
+
|
|
72
|
+
// If you passed `returnCommand: true` above, you would want
|
|
73
|
+
// to execute (exe, args) here
|
|
74
|
+
console.log(`Built: ${result.program}`);
|
|
75
|
+
return result;
|
|
76
|
+
})
|
|
77
|
+
.then((result) =>
|
|
78
|
+
optimizeProgram(
|
|
79
|
+
// program to optimize
|
|
80
|
+
result.program,
|
|
81
|
+
options.developerKeyPath,
|
|
82
|
+
// output program. default will insert ".opt" before the input's extension
|
|
83
|
+
// so foo.prg => foo.opt.prg, and foo.iq => foo.opt.iq
|
|
84
|
+
undefined,
|
|
85
|
+
// A few of the BuildConfig options apply to the post build optimizer
|
|
86
|
+
options
|
|
87
|
+
)
|
|
88
|
+
)
|
|
89
|
+
.then(({ output }) => console.log(`Optimized: ${output}`))
|
|
90
|
+
);
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
If you save the above as `optimize.mjs`, you can then optimize a project via:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
node optimize.mjs path-to-my-project-monkey.jungle
|
|
97
|
+
```
|
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: () =>
|
|
22
|
-
collectNamespaces: () =>
|
|
23
|
-
createDocumentationMap: () =>
|
|
24
|
-
diagnostic: () =>
|
|
25
|
-
diagnosticHelper: () =>
|
|
26
|
-
findNamesInScope: () =>
|
|
27
|
-
findUsingForNode: () =>
|
|
28
|
-
formatAst: () =>
|
|
29
|
-
formatAstLongLines: () =>
|
|
30
|
-
formatScopedName: () =>
|
|
31
|
-
getApiFunctionInfo: () =>
|
|
32
|
-
getApiMapping: () =>
|
|
33
|
-
getSuperClasses: () =>
|
|
21
|
+
checkCompilerVersion: () => import_chunk_Y2ZRISYL.checkCompilerVersion,
|
|
22
|
+
collectNamespaces: () => import_chunk_Y2ZRISYL.collectNamespaces,
|
|
23
|
+
createDocumentationMap: () => import_chunk_Y2ZRISYL.createDocumentationMap,
|
|
24
|
+
diagnostic: () => import_chunk_Y2ZRISYL.diagnostic,
|
|
25
|
+
diagnosticHelper: () => import_chunk_Y2ZRISYL.diagnosticHelper,
|
|
26
|
+
findNamesInScope: () => import_chunk_Y2ZRISYL.findNamesInScope,
|
|
27
|
+
findUsingForNode: () => import_chunk_Y2ZRISYL.findUsingForNode,
|
|
28
|
+
formatAst: () => import_chunk_Y2ZRISYL.formatAst,
|
|
29
|
+
formatAstLongLines: () => import_chunk_Y2ZRISYL.formatAstLongLines,
|
|
30
|
+
formatScopedName: () => import_chunk_Y2ZRISYL.formatScopedName,
|
|
31
|
+
getApiFunctionInfo: () => import_chunk_Y2ZRISYL.getApiFunctionInfo,
|
|
32
|
+
getApiMapping: () => import_chunk_Y2ZRISYL.getApiMapping,
|
|
33
|
+
getSuperClasses: () => import_chunk_Y2ZRISYL.getSuperClasses,
|
|
34
34
|
hasProperty: () => import_chunk_MBTLUWXR.hasProperty,
|
|
35
|
-
isClassVariable: () =>
|
|
36
|
-
isLocal: () =>
|
|
37
|
-
isLookupCandidate: () =>
|
|
38
|
-
isStateNode: () =>
|
|
39
|
-
lookupByFullName: () =>
|
|
40
|
-
lookupNext: () =>
|
|
41
|
-
lookupResultContains: () =>
|
|
42
|
-
lookupWithType: () =>
|
|
43
|
-
makeToyboxLink: () =>
|
|
44
|
-
mapVarDeclsByType: () =>
|
|
45
|
-
markInvokeClassMethod: () =>
|
|
46
|
-
parseSdkVersion: () =>
|
|
47
|
-
resolveDiagnostics: () =>
|
|
48
|
-
resolveDiagnosticsMap: () =>
|
|
49
|
-
sameLookupResult: () =>
|
|
35
|
+
isClassVariable: () => import_chunk_Y2ZRISYL.isClassVariable,
|
|
36
|
+
isLocal: () => import_chunk_Y2ZRISYL.isLocal,
|
|
37
|
+
isLookupCandidate: () => import_chunk_Y2ZRISYL.isLookupCandidate,
|
|
38
|
+
isStateNode: () => import_chunk_Y2ZRISYL.isStateNode,
|
|
39
|
+
lookupByFullName: () => import_chunk_Y2ZRISYL.lookupByFullName,
|
|
40
|
+
lookupNext: () => import_chunk_Y2ZRISYL.lookupNext,
|
|
41
|
+
lookupResultContains: () => import_chunk_Y2ZRISYL.lookupResultContains,
|
|
42
|
+
lookupWithType: () => import_chunk_Y2ZRISYL.lookupWithType,
|
|
43
|
+
makeToyboxLink: () => import_chunk_Y2ZRISYL.makeToyboxLink,
|
|
44
|
+
mapVarDeclsByType: () => import_chunk_Y2ZRISYL.mapVarDeclsByType,
|
|
45
|
+
markInvokeClassMethod: () => import_chunk_Y2ZRISYL.markInvokeClassMethod,
|
|
46
|
+
parseSdkVersion: () => import_chunk_Y2ZRISYL.parseSdkVersion,
|
|
47
|
+
resolveDiagnostics: () => import_chunk_Y2ZRISYL.resolveDiagnostics,
|
|
48
|
+
resolveDiagnosticsMap: () => import_chunk_Y2ZRISYL.resolveDiagnosticsMap,
|
|
49
|
+
sameLookupResult: () => import_chunk_Y2ZRISYL.sameLookupResult,
|
|
50
50
|
traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
|
|
51
|
-
variableDeclarationName: () =>
|
|
52
|
-
visitReferences: () =>
|
|
53
|
-
visit_resources: () =>
|
|
54
|
-
visitorNode: () =>
|
|
51
|
+
variableDeclarationName: () => import_chunk_Y2ZRISYL.variableDeclarationName,
|
|
52
|
+
visitReferences: () => import_chunk_Y2ZRISYL.visitReferences,
|
|
53
|
+
visit_resources: () => import_chunk_Y2ZRISYL.visit_resources,
|
|
54
|
+
visitorNode: () => import_chunk_Y2ZRISYL.visitorNode
|
|
55
55
|
});
|
|
56
56
|
module.exports = __toCommonJS(api_exports);
|
|
57
|
-
var
|
|
57
|
+
var import_chunk_Y2ZRISYL = require("./chunk-Y2ZRISYL.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,
|
|
61
|
+
(0, import_chunk_Y2ZRISYL.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
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_Y2ZRISYL_exports = {};
|
|
30
|
+
__export(chunk_Y2ZRISYL_exports, {
|
|
31
31
|
EnumTagsConst: () => EnumTagsConst,
|
|
32
32
|
LastTypeTag: () => LastTypeTag,
|
|
33
33
|
ObjectLikeTagsConst: () => ObjectLikeTagsConst,
|
|
@@ -133,7 +133,7 @@ __export(chunk_KCCFA2PP_exports, {
|
|
|
133
133
|
visitorNode: () => visitorNode,
|
|
134
134
|
xml_util_exports: () => xml_util_exports
|
|
135
135
|
});
|
|
136
|
-
module.exports = __toCommonJS(
|
|
136
|
+
module.exports = __toCommonJS(chunk_Y2ZRISYL_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");
|
|
@@ -12477,8 +12477,14 @@ function clearAssocPaths(blockState, decl, v) {
|
|
|
12477
12477
|
}
|
|
12478
12478
|
}
|
|
12479
12479
|
function cloneTypeState(blockState) {
|
|
12480
|
-
const { map: map2, trackedMemberDecls, liveCopyPropEvents, ...rest } = blockState;
|
|
12481
|
-
const clone = {
|
|
12480
|
+
const { map: map2, inited, trackedMemberDecls, liveCopyPropEvents, ...rest } = blockState;
|
|
12481
|
+
const clone = {
|
|
12482
|
+
map: new Map(map2),
|
|
12483
|
+
...rest
|
|
12484
|
+
};
|
|
12485
|
+
if (inited) {
|
|
12486
|
+
clone.inited = new Set(inited);
|
|
12487
|
+
}
|
|
12482
12488
|
clone.map.forEach((value2, key) => {
|
|
12483
12489
|
if (value2.equivSet) {
|
|
12484
12490
|
if (key === Array.from(value2.equivSet)[0]) {
|
|
@@ -12675,6 +12681,7 @@ function mergeTypeState(blockStates, index, from, nodeCopyProp) {
|
|
|
12675
12681
|
tov.curType = result;
|
|
12676
12682
|
changes = true;
|
|
12677
12683
|
});
|
|
12684
|
+
to.inited?.forEach((k) => from.inited.has(k) || to.inited?.delete(k));
|
|
12678
12685
|
return changes;
|
|
12679
12686
|
}
|
|
12680
12687
|
function typeStateEntry(value2, key) {
|
|
@@ -12788,13 +12795,16 @@ function updateAffected(blockState, objectType, baseDecl, assignedPath, affected
|
|
|
12788
12795
|
function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStores, logThisRun) {
|
|
12789
12796
|
const order = getPostOrder(graph).reverse();
|
|
12790
12797
|
const queue = new DataflowQueue();
|
|
12791
|
-
let selfClassDecl = null;
|
|
12792
12798
|
const isStatic = !!(func.attributes & 8);
|
|
12793
12799
|
const klass = func.stack?.[func.stack?.length - 1].sn;
|
|
12794
|
-
|
|
12795
|
-
|
|
12796
|
-
|
|
12797
|
-
|
|
12800
|
+
const selfClassDecl = klass && klass.type === "ClassDeclaration" ? klass : null;
|
|
12801
|
+
const uninitClassDecls = selfClassDecl && func.name === "initialize" && selfClassDecl.decls ? new Set(
|
|
12802
|
+
Object.values(selfClassDecl.decls).filter(
|
|
12803
|
+
(decls) => decls.some(
|
|
12804
|
+
(decl) => decl.type === "VariableDeclarator" && decl.node.kind === "var" && !decl.node.init
|
|
12805
|
+
)
|
|
12806
|
+
).flat()
|
|
12807
|
+
) : null;
|
|
12798
12808
|
order.forEach((block, i) => {
|
|
12799
12809
|
block.order = i;
|
|
12800
12810
|
});
|
|
@@ -13040,7 +13050,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13040
13050
|
}
|
|
13041
13051
|
return [cur, updateAny];
|
|
13042
13052
|
}
|
|
13043
|
-
function typeConstraint(decls) {
|
|
13053
|
+
function typeConstraint(decls, blockState) {
|
|
13044
13054
|
return (0, import_chunk_SG7ODKRM.reduce)(
|
|
13045
13055
|
decls,
|
|
13046
13056
|
(cur, decl) => {
|
|
@@ -13055,7 +13065,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13055
13065
|
cur,
|
|
13056
13066
|
decl.type === "Literal" ? typeFromLiteral(decl) : typeFromTypeStateNode(state, decl, true)
|
|
13057
13067
|
);
|
|
13058
|
-
if (
|
|
13068
|
+
if (blockState.inited && !blockState.inited.has(decl) && decl.type === "VariableDeclarator" && !decl.node.init && decl.node.kind === "var" && decl.stack[decl.stack.length - 1].sn === selfClassDecl) {
|
|
13059
13069
|
cur.type |= 1;
|
|
13060
13070
|
}
|
|
13061
13071
|
return cur;
|
|
@@ -13112,7 +13122,7 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13112
13122
|
if (Array.isArray(decl) || decl.type !== "MemberDecl" && decl.type !== "Unknown") {
|
|
13113
13123
|
let tsVal = blockState.map.get(decl);
|
|
13114
13124
|
if (!tsVal) {
|
|
13115
|
-
tsVal = { curType: typeConstraint(decl) };
|
|
13125
|
+
tsVal = { curType: typeConstraint(decl, blockState) };
|
|
13116
13126
|
blockState.map.set(decl, tsVal);
|
|
13117
13127
|
}
|
|
13118
13128
|
return tsVal;
|
|
@@ -13592,7 +13602,9 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13592
13602
|
}
|
|
13593
13603
|
(0, import_node_assert3.default)(!tsv.copyPropItem);
|
|
13594
13604
|
clearRelatedCopyPropEvents(curState, decl, nodeCopyProp);
|
|
13595
|
-
curState.map.set(decl, {
|
|
13605
|
+
curState.map.set(decl, {
|
|
13606
|
+
curType: typeConstraint(decl, curState)
|
|
13607
|
+
});
|
|
13596
13608
|
} else if (type.type & (32768 | 512 | 1024) && (calleeEffects == null ? calleeEffects = !callees || !(0, import_chunk_SG7ODKRM.every)(callees, (callee) => callee.info === false) : calleeEffects)) {
|
|
13597
13609
|
if (type.value != null && type.type & 32768) {
|
|
13598
13610
|
const odata = getObjectValue(tsv.curType);
|
|
@@ -13701,7 +13713,9 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13701
13713
|
clearAssocPaths(curState, decls, value2);
|
|
13702
13714
|
}
|
|
13703
13715
|
(0, import_node_assert3.default)(!value2.copyPropItem);
|
|
13704
|
-
curState.map.set(decls, {
|
|
13716
|
+
curState.map.set(decls, {
|
|
13717
|
+
curType: typeConstraint(decls, curState)
|
|
13718
|
+
});
|
|
13705
13719
|
clearRelatedCopyPropEvents(curState, decls, nodeCopyProp);
|
|
13706
13720
|
}
|
|
13707
13721
|
});
|
|
@@ -13779,6 +13793,12 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13779
13793
|
locals.add(event.decl);
|
|
13780
13794
|
}
|
|
13781
13795
|
}
|
|
13796
|
+
if (uninitClassDecls?.size) {
|
|
13797
|
+
(0, import_chunk_SG7ODKRM.forEach)(
|
|
13798
|
+
event.decl,
|
|
13799
|
+
(decl) => uninitClassDecls.has(decl) && curState.inited?.add(decl)
|
|
13800
|
+
);
|
|
13801
|
+
}
|
|
13782
13802
|
if (logThisRun) {
|
|
13783
13803
|
(0, import_chunk_SG7ODKRM.log)(
|
|
13784
13804
|
describeEvent(event).then(
|
|
@@ -13818,6 +13838,8 @@ function propagateTypes(state, func, graph, optimizeEquivalencies, copyPropStore
|
|
|
13818
13838
|
};
|
|
13819
13839
|
blockStates[0] = { map: /* @__PURE__ */ new Map(), visits: 0 };
|
|
13820
13840
|
const head = blockStates[0];
|
|
13841
|
+
if (uninitClassDecls?.size)
|
|
13842
|
+
head.inited = /* @__PURE__ */ new Set();
|
|
13821
13843
|
func.node.params.forEach((param) => {
|
|
13822
13844
|
setStateEvent(
|
|
13823
13845
|
head,
|
|
@@ -18063,6 +18085,8 @@ function visitReferences(state, ast, name, defn, callback, includeDefs = false,
|
|
|
18063
18085
|
);
|
|
18064
18086
|
}
|
|
18065
18087
|
}
|
|
18088
|
+
} else if (state.inType && node.operator === "as") {
|
|
18089
|
+
return ["right"];
|
|
18066
18090
|
}
|
|
18067
18091
|
break;
|
|
18068
18092
|
case "CallExpression":
|
|
@@ -18560,6 +18584,20 @@ function lookup(state, decls, node, name, maybeStack, nonlocal, ignoreImports) {
|
|
|
18560
18584
|
}
|
|
18561
18585
|
return [null, null];
|
|
18562
18586
|
}
|
|
18587
|
+
case "Literal": {
|
|
18588
|
+
const [, type] = (0, import_chunk_MBTLUWXR.getNodeValue)(node);
|
|
18589
|
+
if (type === "Null")
|
|
18590
|
+
break;
|
|
18591
|
+
return [
|
|
18592
|
+
name ?? `${node.value}`,
|
|
18593
|
+
[
|
|
18594
|
+
{
|
|
18595
|
+
parent: null,
|
|
18596
|
+
results: lookupByFullName(state, `Toybox.Lang.${type}`)
|
|
18597
|
+
}
|
|
18598
|
+
]
|
|
18599
|
+
];
|
|
18600
|
+
}
|
|
18563
18601
|
}
|
|
18564
18602
|
return [false, false];
|
|
18565
18603
|
}
|
|
@@ -19414,6 +19452,7 @@ function getSuperClasses(klass) {
|
|
|
19414
19452
|
var init_api = (0, import_chunk_ABYVSU2C.__esm)({
|
|
19415
19453
|
"src/api.ts"() {
|
|
19416
19454
|
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
19455
|
+
init_data_flow();
|
|
19417
19456
|
init_mc_rewrite();
|
|
19418
19457
|
init_negative_fixups();
|
|
19419
19458
|
init_optimizer_types();
|
|
@@ -19422,8 +19461,6 @@ var init_api = (0, import_chunk_ABYVSU2C.__esm)({
|
|
|
19422
19461
|
init_type_flow_util();
|
|
19423
19462
|
init_types();
|
|
19424
19463
|
(0, import_chunk_SG7ODKRM.init_util)();
|
|
19425
|
-
(0, import_chunk_MBTLUWXR.init_ast)();
|
|
19426
|
-
init_data_flow();
|
|
19427
19464
|
init_visitor();
|
|
19428
19465
|
}
|
|
19429
19466
|
});
|
|
@@ -29181,7 +29218,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29181
29218
|
const opt_time = await (0, import_chunk_SG7ODKRM.first_modified)(
|
|
29182
29219
|
Object.values(fnMap).map((v) => v.output)
|
|
29183
29220
|
);
|
|
29184
|
-
if (source_time < opt_time &&
|
|
29221
|
+
if (source_time < opt_time && 1716827034287 < opt_time) {
|
|
29185
29222
|
return {
|
|
29186
29223
|
hasTests,
|
|
29187
29224
|
diagnostics: prevDiagnostics,
|
|
@@ -29220,7 +29257,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
|
|
|
29220
29257
|
hasTests: hasTests2,
|
|
29221
29258
|
diagnostics,
|
|
29222
29259
|
sdkVersion,
|
|
29223
|
-
optimizerVersion: "1.1.
|
|
29260
|
+
optimizerVersion: "1.1.63",
|
|
29224
29261
|
...Object.fromEntries(
|
|
29225
29262
|
configOptionsToCheck.map((option) => [option, config[option]])
|
|
29226
29263
|
)
|
package/build/optimizer.cjs
CHANGED
|
@@ -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: () =>
|
|
22
|
-
buildOptimizedProject: () =>
|
|
21
|
+
StateNodeAttributes: () => import_chunk_Y2ZRISYL.StateNodeAttributes,
|
|
22
|
+
buildOptimizedProject: () => import_chunk_Y2ZRISYL.buildOptimizedProject,
|
|
23
23
|
copyRecursiveAsNeeded: () => import_chunk_SG7ODKRM.copyRecursiveAsNeeded,
|
|
24
|
-
defaultConfig: () =>
|
|
25
|
-
display: () =>
|
|
26
|
-
generateOneConfig: () =>
|
|
27
|
-
generateOptimizedProject: () =>
|
|
28
|
-
getConfig: () =>
|
|
29
|
-
getProjectAnalysis: () =>
|
|
30
|
-
get_jungle: () =>
|
|
31
|
-
isErrorWithLocation: () =>
|
|
32
|
-
launchSimulator: () =>
|
|
33
|
-
manifestProducts: () =>
|
|
34
|
-
mctree: () =>
|
|
35
|
-
simulateProgram: () =>
|
|
24
|
+
defaultConfig: () => import_chunk_Y2ZRISYL.defaultConfig,
|
|
25
|
+
display: () => import_chunk_Y2ZRISYL.display,
|
|
26
|
+
generateOneConfig: () => import_chunk_Y2ZRISYL.generateOneConfig,
|
|
27
|
+
generateOptimizedProject: () => import_chunk_Y2ZRISYL.generateOptimizedProject,
|
|
28
|
+
getConfig: () => import_chunk_Y2ZRISYL.getConfig,
|
|
29
|
+
getProjectAnalysis: () => import_chunk_Y2ZRISYL.getProjectAnalysis,
|
|
30
|
+
get_jungle: () => import_chunk_Y2ZRISYL.get_jungle,
|
|
31
|
+
isErrorWithLocation: () => import_chunk_Y2ZRISYL.isErrorWithLocation,
|
|
32
|
+
launchSimulator: () => import_chunk_Y2ZRISYL.launchSimulator,
|
|
33
|
+
manifestProducts: () => import_chunk_Y2ZRISYL.manifestProducts,
|
|
34
|
+
mctree: () => import_chunk_Y2ZRISYL.mctree,
|
|
35
|
+
simulateProgram: () => import_chunk_Y2ZRISYL.simulateProgram
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(optimizer_exports);
|
|
38
|
-
var
|
|
38
|
+
var import_chunk_Y2ZRISYL = require("./chunk-Y2ZRISYL.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,
|
|
42
|
+
(0, import_chunk_Y2ZRISYL.init_optimizer)();
|
|
43
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
44
|
0 && (module.exports = {
|
|
45
45
|
StateNodeAttributes,
|
package/build/sdk-util.cjs
CHANGED
|
@@ -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: () =>
|
|
22
|
-
appSupport: () =>
|
|
23
|
-
connectiq: () =>
|
|
24
|
-
getDeviceInfo: () =>
|
|
25
|
-
getFunctionDocumentation: () =>
|
|
26
|
-
getLanguages: () =>
|
|
27
|
-
getSdkPath: () =>
|
|
28
|
-
isWin: () =>
|
|
29
|
-
optimizeProgram: () =>
|
|
30
|
-
readPrg: () =>
|
|
31
|
-
readPrgWithOffsets: () =>
|
|
32
|
-
xmlUtil: () =>
|
|
21
|
+
SectionKinds: () => import_chunk_Y2ZRISYL.SectionKinds,
|
|
22
|
+
appSupport: () => import_chunk_Y2ZRISYL.appSupport,
|
|
23
|
+
connectiq: () => import_chunk_Y2ZRISYL.connectiq,
|
|
24
|
+
getDeviceInfo: () => import_chunk_Y2ZRISYL.getDeviceInfo,
|
|
25
|
+
getFunctionDocumentation: () => import_chunk_Y2ZRISYL.getFunctionDocumentation,
|
|
26
|
+
getLanguages: () => import_chunk_Y2ZRISYL.getLanguages,
|
|
27
|
+
getSdkPath: () => import_chunk_Y2ZRISYL.getSdkPath,
|
|
28
|
+
isWin: () => import_chunk_Y2ZRISYL.isWin,
|
|
29
|
+
optimizeProgram: () => import_chunk_Y2ZRISYL.optimizeProgram,
|
|
30
|
+
readPrg: () => import_chunk_Y2ZRISYL.readPrg,
|
|
31
|
+
readPrgWithOffsets: () => import_chunk_Y2ZRISYL.readPrgWithOffsets,
|
|
32
|
+
xmlUtil: () => import_chunk_Y2ZRISYL.xml_util_exports
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(sdk_util_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_chunk_Y2ZRISYL = require("./chunk-Y2ZRISYL.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,
|
|
39
|
+
(0, import_chunk_Y2ZRISYL.init_sdk_util)();
|
|
40
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
41
|
0 && (module.exports = {
|
|
42
42
|
SectionKinds,
|
package/build/worker-thread.cjs
CHANGED
|
@@ -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
|
|
24
|
+
var import_chunk_Y2ZRISYL = require("./chunk-Y2ZRISYL.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,
|
|
31
|
+
(0, import_chunk_Y2ZRISYL.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,
|
|
34
|
+
return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_Y2ZRISYL.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.
|
|
4
|
+
"version": "1.1.63",
|
|
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",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"author": "markw65",
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@markw65/prettier-plugin-monkeyc": "^1.0.
|
|
59
|
+
"@markw65/prettier-plugin-monkeyc": "^1.0.58"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@markw65/peggy-optimizer": "^1.0.1",
|