@markw65/monkeyc-optimizer 1.1.91 → 1.1.93

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,19 @@
2
2
 
3
3
  All notable changes to the "monkeyc-optimizer" package will be documented in this file.
4
4
 
5
+ ### 1.1.93
6
+
7
+ - Update to [@markw65/prettier-plugin-monkeyc@1.0.64](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1064)
8
+ - Fixes incompatibilities with `prettier@3.7.0` and later
9
+ - Update to prettier3.x for testing/development purposes, since that's what's in use almost everywhere now
10
+ - Add support for Extended Code Spaces in the post build optimizer.
11
+ - This just fixes some assertions, and makes sure that various tables get updated correctly. It doesn't yet optimize the code in the Extended Code Space.
12
+
13
+ ### 1.1.92
14
+
15
+ - Get rid of yazl, yauzl and extract-zip, and uze 7z-wasm instead.
16
+ - Fix some issues causing 7z-wasm to fail on Windows.
17
+
5
18
  ### 1.1.91
6
19
 
7
20
  - Update the post build optimizer to use 7zip to unpack `.iq` files for compatibility with sdk-8.4.0
@@ -21,7 +34,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
21
34
  - Fix output of cft-font-info
22
35
  - When I refactored the code to avoid holding everything in memory at once, I inadvertently changed the format. This restores the original format, and adds a flag to enable the incorrect format, just in case someone's relying on it.
23
36
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.61](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1061)
24
-
25
37
  - Allow semi-colons after expression-statements, and uncontrolled block-statements to match Garmin's parser.
26
38
 
27
39
  - Fix a crash when no valid products are found in the manifest (Fixes [prettier-extension-monkeyc#19](https://github.com/markw65/prettier-extension-monkeyc/issues/19))
@@ -113,7 +125,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
113
125
  ### 1.1.72
114
126
 
115
127
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.59](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1059)
116
-
117
128
  - Ignore `resolveType` field in serializeMonkeyC to avoid errors due to cycles.
118
129
 
119
130
  - Make `evaluate` skip everything except the `body` when processing class, module or function declarations.
@@ -303,7 +314,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
303
314
  ### 1.1.39
304
315
 
305
316
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.54](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1054)
306
-
307
317
  - Fixes the parser to understand tuples
308
318
 
309
319
  - Add basic type analysis for tuples
@@ -318,23 +328,19 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
318
328
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.53](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1053)
319
329
 
320
330
  - Features
321
-
322
331
  - Generate diagnostics for unary and binary operators with incorrect arguments
323
332
  - Properly handle object-literal types (eg `{ :foo as String, :bar as Number }`).
324
333
  - When converting Graphics.ColorValue to a number, format the number as hex.
325
334
 
326
335
  - Tests
327
-
328
336
  - Update tests for sdk 6.3.0
329
337
  - Add more test coverage for binary operators and their expected types.
330
338
 
331
339
  - Build
332
-
333
340
  - Use [@markw65/peggy-optimizer](https://github.com/markw65/peggy/tree/peggy-optimizer/optimizer-plugin) to optimize the jungle and resource parsers
334
341
  - Make things work properly with prettier-3.x, but don't actually upgrade yet
335
342
 
336
343
  - Bug fixes
337
-
338
344
  - Fix a bug with the result type of A & B when A could be Boolean
339
345
  - Always include null for the types of values extracted from `Dictionary`s
340
346
  - When inferring the type of a `Dictionary`, don't include values.
@@ -347,7 +353,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
347
353
  ### 1.1.35
348
354
 
349
355
  - Infrastructure
350
-
351
356
  - Optimize the xml parser to speed up compilation/analysis
352
357
 
353
358
  - Type Checker
@@ -356,7 +361,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
356
361
  ### 1.1.34
357
362
 
358
363
  - Optimizations
359
-
360
364
  - Add a few more peephole optimizations to the post build optimizer
361
365
  - `incsp 0;` => `nop`
362
366
  - `ipush 0; shlv` => `nop`
@@ -370,26 +374,21 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
370
374
  ### 1.1.33
371
375
 
372
376
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.51](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1051)
373
-
374
377
  - Makes it compatible with prettier@3.0.0
375
378
 
376
379
  - Bug fixes
377
-
378
380
  - Fix a problem that could incorrectly optimize an array-init
379
381
 
380
382
  - Optimizations
381
-
382
383
  - Enable the array-init optimization in a few more cases
383
384
 
384
385
  ### 1.1.32
385
386
 
386
387
  - Bug fixes
387
-
388
388
  - Don't optimize `do { BODY } while (false);` to `{ BODY }` if `BODY` contains `break` or `continue`
389
389
  - In some circumstances, a comparison between a known `Long` and a known `Char` could be inferred to be false, regardless of the values (eg `42l == '*'` which should be `true`). It would eventually be folded to the correct value, but in some circumstances, an incorrect warning could be issued, or an incorrect optimization could have already been performed.
390
390
 
391
391
  - Fixes for sdk-6.2.x
392
-
393
392
  - sdk-6.2.x fixes [this finally bug](https://forums.garmin.com/developer/connect-iq/i/bug-reports/finally-doesn-t-work-as-expected), so that now all the examples work correctly (ie the `finally` block always executes, as expected, no matter how you exit the `try` or `catch` blocks). I've updated the way the control flow graph is built to match this behavior.
394
393
 
395
394
  - sdk-6.2.x fixes [this continue in switch issue](https://forums.garmin.com/developer/connect-iq/i/bug-reports/continue-in-a-switch-statement-behaves-surprisingly), by making `continue` in a `switch` continue the loop containing the switch (or its a compile time error if there's no loop). This matches the behavior of C and C++, for example. I've updated the optimizer to interpret `continue` appropriately, depending on the sdk version.
@@ -410,7 +409,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
410
409
  ### 1.1.29
411
410
 
412
411
  - Bug fixes
413
-
414
412
  - Fixes an issue where a value could incorrectly be inferred to be true-ish when its declared type was known to be an object of class type. This is not of itself incorrect, but some Toybox APIs are declared as returning an Object of a class, but may in fact return null - so we can't treat them as non-null.
415
413
 
416
414
  - Enhancements
@@ -419,7 +417,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
419
417
  ### 1.1.28
420
418
 
421
419
  - Bug fixes
422
-
423
420
  - Fixes an issue in the post build optimizer which could cause a pre-definition to be inserted just prior to an `frpush`, which could result in the wrong value of `self` being passed to a call
424
421
  - Don't add personality paths to the generated jungle file if the sdk is prior to 4.2.1
425
422
  - Fixes a bug in the source-to-source optimizer that could incorrectly infer that an `if` block was never entered when the if's comparison was between a primitive type, and a plain `Object`
@@ -430,7 +427,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
430
427
  ### 1.1.27
431
428
 
432
429
  - Bug fixes
433
-
434
430
  - Fixes an incorrect type check warning when an assignment to a local was incompatible with the type of a same-named non-local variable. This only affects the warning; it did not result in incorrect optimizations.
435
431
 
436
432
  - New features
@@ -439,13 +435,11 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
439
435
  ### 1.1.26
440
436
 
441
437
  - Bug fixes
442
-
443
438
  - fixes an issue in the post build optimizer which could cause pre variables to be inserted too late in a block that could throw (so that if the variable was used in, or after the catch block, it might not have been set).
444
439
  - fixes an issue with references in resource files, that could result in some references not being reported to the extension (only affects `Goto References` and `Goto Definition`)
445
440
  - fixes some issues converting the system function documentation to markdown (for the Hover, Completion and Signature providers in the extension).
446
441
 
447
442
  - New features
448
-
449
443
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.49](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1049) (including [#1.0.48](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1048) and [#1.0.47](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1047))
450
444
  - adds support for parsing (but not formatting) .mss files
451
445
  - Adds full support for personalities in `.jungle` and `.mss` files, including reading the per-device `personality.mss` files
@@ -463,7 +457,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
463
457
  ### 1.1.24
464
458
 
465
459
  - Bug fixes
466
-
467
460
  - Conversion of unary `-x` to `0 - x` was too restrictive, causing some missed optimization opportunities
468
461
 
469
462
  - Post Build Optimizations
@@ -482,7 +475,6 @@ No functional change, just fixes a typo that broke the typescript exports.
482
475
  ### 1.1.22
483
476
 
484
477
  - Bug fixes
485
-
486
478
  - [Fixes a bug in Single Use Copy Prop](https://github.com/markw65/prettier-extension-monkeyc/issues/8)
487
479
 
488
480
  - Post Build Optimizations
@@ -495,11 +487,9 @@ No functional change, just fixes a typo that broke the typescript exports.
495
487
  ### 1.1.21
496
488
 
497
489
  - Bug fixes
498
-
499
490
  - fixed a bug that could cause dead-store elimination to delete stores that might be used if an exception was thrown. eg `try { x=1; foo(); x=2; } catch (ex) { System.println(x); x=3; }` could delete the first store to `x`, breaking the println if `foo` actually throws.
500
491
 
501
492
  - Source to Source Optimizations
502
-
503
493
  - convert `++` and `--` to `+= 1` and `-= 1`. Garmin's compiler generates exactly the same code for both, but when the `1` is written explicitly, its available for `sizeBasedPRE` to optimize.
504
494
  - convert `-x` to `0 - x`. Again, Garmin's compiler generates exactly the same code, but being explicit makes the `0` available to `sizeBasedPRE`.
505
495
  - rewrite some optimizations so that `-x` and `0-x` are treated identically. eg `(0-x) + y` => `y - x` (for suitably typed `x` and `y`).
@@ -513,7 +503,6 @@ No functional change, just fixes a typo that broke the typescript exports.
513
503
  ### 1.1.20
514
504
 
515
505
  - Bug fixes
516
-
517
506
  - Fix a bug that could cause the optimizer to incorrectly substitute one local for another.
518
507
 
519
508
  - Optimizations
@@ -522,7 +511,6 @@ No functional change, just fixes a typo that broke the typescript exports.
522
511
  ### 1.1.19
523
512
 
524
513
  - Bug fixes
525
-
526
514
  - Fix "Minimize Modules" in background/glance scopes
527
515
  - due to a [bug in the monkeyc compiler](https://forums.garmin.com/developer/connect-iq/i/bug-reports/import-rez-or-using-rez-breaks-background-resources), adding "using Rez;" when a resource may be loaded by a background or glance app causes it to crash. This release won't import Rez into anything marked :background or :glance. This fixes [prettier-extension-monkeyc#7](https://github.com/markw65/prettier-extension-monkeyc/issues/7)
528
516
  - Update background and glance offsets in the program header. I had assumed these offsets were obtained from the symbols, which already get updated, but it turns out they're stored as offsets in the header. This didn't break anything, but it did mean that the background and glance code sizes were unchanged, even though the post build optimizer had in fact made them smaller.
@@ -539,7 +527,6 @@ No functional change, just fixes a typo that broke the typescript exports.
539
527
  ### 1.1.17 (this package is missing two files)
540
528
 
541
529
  - Project infrastructure
542
-
543
530
  - Use worker threads to speed up exporting a .iq file. With an 8 core (16 with hyperthreading) system, my project goes from taking 28 seconds to generate the optimized source to less than 10. It still takes garmin's compiler nearly 3 minutes to compile though.
544
531
 
545
532
  - Bug fixes
@@ -548,7 +535,6 @@ No functional change, just fixes a typo that broke the typescript exports.
548
535
  ### 1.1.16
549
536
 
550
537
  - Project infrastructure
551
-
552
538
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.46](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1046)
553
539
  - no functional change.
554
540
  - switch from webpack to esbuild, for faster builds, and better packaging.
@@ -569,7 +555,6 @@ No functional change, just fixes a typo that broke the typescript exports.
569
555
  ### 1.1.15
570
556
 
571
557
  - Post build optimizer improvements
572
-
573
558
  - Simplify LogicalExpressions. This generally saves 3 bytes per `&&` or `||`, and also makes them faster
574
559
  - Adds a simple code sharing pass. If multiple code paths converge to the same point (or leave the function via return) and they end with the same sequence of bytecode, they're merged into one.
575
560
  - Flips branch-true to branch-false or vice versa if the fall through block has multiple predecessors, and the target block has just one. This often leads to better control flow, reducing the number of "goto" bytecodes required.
@@ -603,7 +588,6 @@ No functional change, just fixes a typo that broke the typescript exports.
603
588
  ### 1.1.11
604
589
 
605
590
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.44](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1044)
606
-
607
591
  - Fixes a parser bug relating to Methods returning Void, and a printer bug relating to nested Method declarations.
608
592
 
609
593
  - Bug fixes
@@ -631,7 +615,6 @@ No functional change, just fixes a typo that broke the typescript exports.
631
615
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.43](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1043)
632
616
 
633
617
  - Bug fixes
634
-
635
618
  - fix an interaction between inlining and removing unused local vars that could cause unlimited recursion leading to stack overflow
636
619
 
637
620
  - New optimizations
@@ -640,7 +623,6 @@ No functional change, just fixes a typo that broke the typescript exports.
640
623
  ### 1.1.8
641
624
 
642
625
  - Bug fixes
643
-
644
626
  - After making a non-modifying change to a variable, update the types of all equivalent variables. eg in `var x = y; if (y != null) { whatever }` we know that x is not null in `whatever`, even though we didn't explicitly test it.
645
627
  - Fix an issue with `import` and `using`. If an import happened after the definition of an inline function, inlined copies of the function might incorrectly use those imports resulting in finding the wrong symbols. This was rare - most imports happen at the top of the file, and generally an import will simply make something work that would have failed, rather than changing the behavior of something that already works. But I added a test case that exhibits the problem.
646
628
 
@@ -670,17 +652,14 @@ No functional change, just fixes a typo that broke the typescript exports.
670
652
  ### 1.1.4
671
653
 
672
654
  - Optimizations
673
-
674
655
  - Minor tweaks to dead store elimination
675
656
  - Better type resolution for untyped code
676
657
 
677
658
  - Enhancements
678
-
679
659
  - Retain the type map in the analysis pass, so that it can be used to improve
680
660
  the results in visitReferences
681
661
 
682
662
  - Bug fixes
683
-
684
663
  - When multiple diagnostics were reported for a single location, all but the last was lost
685
664
  - Sometimes when evaluating MemberExpressions type-flow would give up too easily, resulting
686
665
  in unknown types for the object, which then resulted in unexpected error messages from
@@ -694,14 +673,12 @@ No functional change, just fixes a typo that broke the typescript exports.
694
673
  ### 1.1.3
695
674
 
696
675
  - Tweaks and fixes
697
-
698
676
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.42](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1042)
699
677
  - Fixed an issue that cause inlining in return context to be too conservative
700
678
  - Update inliner to keep a stack of locations, so that error messages can show exactly where an error occurred, even in the presence of inlining.
701
679
  - Update diagnostic api to optionally include a uri to more detailing information.
702
680
 
703
681
  - Type Analysis
704
-
705
682
  - Track type info through branch conditions, so that in `if (x != null) { A } else { B }`, the type checker knows that x is not null in A, and it is null in B.
706
683
  - Added checkers for return types, call arguments, assignments and variable declarations.
707
684
  - Automatically infer Array and Dictionary types
@@ -732,11 +709,9 @@ No functional change, just fixes a typo that broke the typescript exports.
732
709
  ### 1.1.0
733
710
 
734
711
  - Implements a type analyzer, to enable better optimizations
735
-
736
712
  - adds options `trustDeclaredTypes` and `propagateTypes`. See https://github.com/markw65/monkeyc-optimizer/wiki/Type-and-Dataflow-analysis
737
713
 
738
714
  - Improved optimizations
739
-
740
715
  - SizeBasedPRE now has finer granularity, making it generally find more opportunities
741
716
  - Lots of improvements to binary operators, and folding. Subject to suitable type checks,
742
717
  - `(x + K1) + K2` => `x + (K1 + K2)`
@@ -760,11 +735,9 @@ No functional change, just fixes a typo that broke the typescript exports.
760
735
  ### 1.0.45
761
736
 
762
737
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.41](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1041)
763
-
764
738
  - Fixes a few parser edge cases
765
739
 
766
740
  - Bug fixes
767
-
768
741
  - Fix a bug constant folding == and !=
769
742
  - Make sure to include all languages, even for devices that don't support them, because they're still supported in settings. Do this in a way that avoids creating warnings.
770
743
  - Look at all build dependencies when deciding whether to regenerate the optimized files.
@@ -778,7 +751,6 @@ No functional change, just fixes a typo that broke the typescript exports.
778
751
  ### 1.0.44
779
752
 
780
753
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.40](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1040)
781
-
782
754
  - Fixes location ranges associated with parenthesized expressions
783
755
  - Fixes parsing of Lang.Char literals
784
756
 
@@ -788,7 +760,6 @@ No functional change, just fixes a typo that broke the typescript exports.
788
760
  ### 1.0.43
789
761
 
790
762
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.39](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1039)
791
-
792
763
  - Fixes issues parsing/printing/optimizing NaN
793
764
 
794
765
  - Fix issues with windows paths introduced in 1.0.42
@@ -799,12 +770,10 @@ No functional change, just fixes a typo that broke the typescript exports.
799
770
  ### 1.0.42
800
771
 
801
772
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.38](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1038)
802
-
803
773
  - faster parsing
804
774
  - supports parsing the attributes in api.mir, including sdk version etc.
805
775
 
806
776
  - Performance
807
-
808
777
  - Using the updated prettier-plugin-monkeyc halves the time spent in the parser
809
778
  - There was some pathological behavior in the jungle processing. For most projects, it was quite fast (under 1s), but the worst project I found took nearly 5 minutes. I fixed a lot of redundant processing, which dropped most projects to under 500ms, with a worst case of 20s.
810
779
  - I had some caching code to prevent reading the same resource file multiple times, but the cache didn't work properly because an async function ran in between the test of the cache, and the fill of the cache; which meant that lots of threads could test the cache and decide it needed to be filled. Fixed by caching Promises, rather than the promise results. Dropped the worst case 20s down to under 500ms, and the average down below 100ms.
@@ -821,7 +790,6 @@ No functional change, just fixes a typo that broke the typescript exports.
821
790
  ### 1.0.40
822
791
 
823
792
  - Improvements
824
-
825
793
  - Upgrade to [@markw65/prettier-plugin-monkeyc@1.0.37](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1037).
826
794
  - Report locations of errors in manifest.xml (rather than just reporting an error somewhere in the file)
827
795
  - Minor improvements to Goto References etc
@@ -832,7 +800,6 @@ No functional change, just fixes a typo that broke the typescript exports.
832
800
  - Fix lookups in static methods, under a new option that defaults to true.
833
801
 
834
802
  - Testing
835
-
836
803
  - Fix pragma checker to sort the diagnostics properly
837
804
  - Allow specifying which test to run on the command line
838
805
  - Update all tests to work with 4.1.6 and 4.1.7
@@ -844,7 +811,6 @@ No functional change, just fixes a typo that broke the typescript exports.
844
811
  ### 1.0.39
845
812
 
846
813
  - Improvements
847
-
848
814
  - Upgrade to [@markw65/prettier-plugin-monkeyc@1.0.36](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1036).
849
815
  - Upgrade all other npm dependencies to the latest versions, and fix a few issues that showed up as a result.
850
816
  - Report missing symbols after optimization, rather than before. Results in fewer false negatives. eg Given `if (foo has :bar) { return foo.bar; }`, where the compiler knows that foo.bar doesn't exist, the whole thing will be optimized away, rather than generate a diagnostic that foo.bar doesn't exist.
@@ -853,11 +819,9 @@ No functional change, just fixes a typo that broke the typescript exports.
853
819
  - Since we were already parsing all the resource files to look for `<build>` instructions, additionally identify all the symbols that will get generated. This allows us to detect references to undefined resources, and also makes `Goto Definition` just work for things like `Rez.Strings.foo`.
854
820
 
855
821
  - Optimizations
856
-
857
822
  - Optimize has expressions that are guaranteed to be false.
858
823
 
859
824
  - Bugs
860
-
861
825
  - Fix an issue with launchSimulator, which caused it to sometimes not bring the simulator window into focus when it should have done.
862
826
  - Fix an issue that caused simulateProgram to fail on windows.
863
827
  - Fix a bug looking up self when not part of a member-expression (this didn't happen until I added optimizations for "has" expressions, in this release)
@@ -892,7 +856,6 @@ No functional change, just fixes a typo that broke the typescript exports.
892
856
  ### 1.0.35
893
857
 
894
858
  - Testing
895
-
896
859
  - Add a new open source project
897
860
  - Fixup tests to work with compiler2beta2
898
861
 
@@ -902,7 +865,6 @@ No functional change, just fixes a typo that broke the typescript exports.
902
865
  ### 1.0.34
903
866
 
904
867
  - Bug fixes
905
-
906
868
  - Fix parser to allow white space to separate attributes, in addition to comma
907
869
  - Fix optimizer to respect prettier options when formatting the optimized code
908
870
 
@@ -913,7 +875,6 @@ No functional change, just fixes a typo that broke the typescript exports.
913
875
  ### 1.0.33
914
876
 
915
877
  - New features
916
-
917
878
  - Tagging a function with (:keep) will prevent the optimizer from removing it, even if it appears to be unused.
918
879
 
919
880
  - Bug fixes
@@ -928,7 +889,6 @@ No functional change, just fixes a typo that broke the typescript exports.
928
889
  ### 1.0.31
929
890
 
930
891
  - Bug fixes
931
-
932
892
  - Use withLocDeep on inline results
933
893
  - Better tracking of state.inType
934
894
  - Fix typo setting up the ProgramState
@@ -938,7 +898,6 @@ No functional change, just fixes a typo that broke the typescript exports.
938
898
  - I had forgotten to remove some code that I added to debug a problem
939
899
 
940
900
  - Code cleanup
941
-
942
901
  - Move all the global types to optimizer-types.ts, and explicitly import them
943
902
  - Be more consistent about when assignment/update lhs is traversed
944
903
  - Rework exposed flag
@@ -949,7 +908,6 @@ No functional change, just fixes a typo that broke the typescript exports.
949
908
  - Update for BigInt literals, and cleanup folding code
950
909
 
951
910
  - New features
952
-
953
911
  - Support `obj[:key]` as alternate for obj.key in lookup
954
912
  - `Find References`, and `Rename` will recognize these references now.
955
913
  - Add an unused variable cleanup pass
@@ -976,19 +934,15 @@ Bug Fixes
976
934
  ### 1.0.29
977
935
 
978
936
  - Update to `@markw65/prettier-plugin-monkeyc@1.0.32`
979
-
980
937
  - Fixes a parser issue where `x as Type ? a : b` would be parsed as `(x as Type?) a : b` which would then be reported as a syntax error.
981
938
 
982
939
  - Bug fixes
983
-
984
940
  - Fix a bug causing literal nodes to be shared. This was harmless prior to the implementation of the PRE pass
985
941
 
986
942
  - Code cleanup
987
-
988
943
  - Add `isStatement` and `isExpression` helpers
989
944
 
990
945
  - New features
991
-
992
946
  - Add constant folding for relational and logical operators
993
947
  - Allow assignment-scope inlining in variable initializers
994
948
  - Better cleanup of unused expressions
@@ -1031,7 +985,6 @@ Bug Fixes
1031
985
  ### 1.0.23
1032
986
 
1033
987
  - Bug Fixes
1034
-
1035
988
  - Don't treat parameters to Method types as undeclared variables
1036
989
  - eg `var x as (Method(a as Number, b as Number) as Void)` should not report that `a` and `b` are undeclared
1037
990
 
@@ -1042,9 +995,7 @@ Bug Fixes
1042
995
  ### 1.0.22
1043
996
 
1044
997
  - Improvements
1045
-
1046
998
  - Major rewrite of the symbol lookup mechanism, to match monkeyc as closely as possible
1047
-
1048
999
  - Fix callee lookup to skip local variables
1049
1000
  - Fix class lookup to first check all the super classes, then to check the context of each super class
1050
1001
  - Fix module lookup to check both the module, and the context of the module
@@ -1053,7 +1004,6 @@ Bug Fixes
1053
1004
  - Add live diagnostics for missing symbols
1054
1005
 
1055
1006
  - Bug fixes
1056
-
1057
1007
  - Recognize the the variable in a catch clause is a declaration
1058
1008
 
1059
1009
  - Breaking change
@@ -1062,7 +1012,6 @@ Bug Fixes
1062
1012
  ### 1.0.21
1063
1013
 
1064
1014
  - Bug fixes
1065
-
1066
1015
  - Parameters from the calling function should be treated just line locals when inlining
1067
1016
  - Upgrade to `@markw65/prettier-plugin-monkeyc@1.0.24`
1068
1017
  - fixes crash with comments following an attribute: `(:foo) /* comment */ function foo() {}`
@@ -1071,12 +1020,10 @@ Bug Fixes
1071
1020
  ### 1.0.20
1072
1021
 
1073
1022
  - Bug fixes
1074
-
1075
1023
  - Fix a bug marking unknown callees
1076
1024
  - Fix a bug in test.js that didn't notice when tests failed, and fix a failing test
1077
1025
 
1078
1026
  - Optimizer enhancements
1079
-
1080
1027
  - Re-run the main optimization step, to properly account for functions that are unused after optimization
1081
1028
  - Call the optimizer on 'unused' nodes before returning them
1082
1029
 
@@ -1086,18 +1033,15 @@ Bug Fixes
1086
1033
  ### 1.0.19
1087
1034
 
1088
1035
  - Upgrade to `@markw65/prettier-plugin-monkeyc@1.0.22`
1089
-
1090
1036
  - fixes some minor typing issues for mctree
1091
1037
  - special handling for certain parenthesized expressions.
1092
1038
 
1093
1039
  - Optimizer
1094
-
1095
1040
  - Handle more unused expressions, add tests, and prettify the OptimizerTests project
1096
1041
  - Allow statement-style inlining in assignment and return contexts
1097
1042
  - Add diagnostics for failure to inline
1098
1043
 
1099
1044
  - Tests
1100
-
1101
1045
  - More tweaks to pragma-checker
1102
1046
  - Add launch and task configs for building/running tests
1103
1047
 
@@ -1113,12 +1057,10 @@ Bug Fixes
1113
1057
  ### 1.0.17
1114
1058
 
1115
1059
  - New Features
1116
-
1117
1060
  - Extend the inliner to support more complex functions when called in a void context
1118
1061
  - Cleanup unused expressions. `0;x;foo.bar;a+b` will all now be optimized away.
1119
1062
 
1120
1063
  - Testing
1121
-
1122
1064
  - Rewrite the @match pragma implementation to have access to the next Node in the ast, rather than just the text of the remainder of the line.
1123
1065
  - Add tests for the statement inliner, and the unused expression cleanup code.
1124
1066
 
@@ -1128,13 +1070,11 @@ Bug Fixes
1128
1070
  ### 1.0.16
1129
1071
 
1130
1072
  - Bug fixes
1131
-
1132
1073
  - Fix off-by-one in removeNodeComments
1133
1074
  - Fix lookup to consistently lookup types or values.
1134
1075
  - Fix lookup of superclass names
1135
1076
 
1136
1077
  - New Features
1137
-
1138
1078
  - Add a simple inliner
1139
1079
  - Add support for conditional inlining based on excludeAnnotations
1140
1080
 
@@ -1151,7 +1091,6 @@ Bug Fixes
1151
1091
  ### 1.0.14
1152
1092
 
1153
1093
  - Bug fixes
1154
-
1155
1094
  - When reading a barrel project with no products, add all products by default
1156
1095
  - Only set language specific paths for languages that are supported by the device
1157
1096
  - Remove comments that are completely contained within removed nodes
@@ -1165,13 +1104,11 @@ Bug Fixes
1165
1104
  ### 1.0.13
1166
1105
 
1167
1106
  - Improvements
1168
-
1169
1107
  - Add displayName to deviceInfo (for getTargetDevices in prettier-extension-monkeyc)
1170
1108
  - Throw a better error when we fail to read a jungle file
1171
1109
  - Don't try to optimize barrel projects
1172
1110
 
1173
1111
  - Code cleanup
1174
-
1175
1112
  - Update to `@markw65/prettier-plugin-monkeyc@1.0.20` for mctree fixes
1176
1113
  - Enable typescript strict checks
1177
1114
  - Turn off synthetic default imports, and fix issues
@@ -1187,12 +1124,10 @@ Bug Fixes
1187
1124
  ### 1.0.11
1188
1125
 
1189
1126
  - Improvements
1190
-
1191
1127
  - Add option to run tests (for projects that have them)
1192
1128
  - Add getProjectAnalysis api, to support various language features in `@markw65/prettier-extension-monkeyc`
1193
1129
 
1194
1130
  - Bug fixes
1195
-
1196
1131
  - Fix lookup of self/me
1197
1132
 
1198
1133
  - Code cleanup
@@ -1224,7 +1159,6 @@ Bug Fixes
1224
1159
  ### 1.0.8
1225
1160
 
1226
1161
  - Improvements
1227
-
1228
1162
  - Update to `@markw65/prettier-plugin-monkeyc:1.0.14`
1229
1163
  - Parse and respect \<build\> instructions in resource files
1230
1164
  - Add minimal barrel support
@@ -1232,7 +1166,6 @@ Bug Fixes
1232
1166
  - Rename locals which would be marked re-declaring
1233
1167
 
1234
1168
  - Bug Fixes
1235
-
1236
1169
  - Generate the default jungle dynamically, since sdk/bin/default.jungle is generated lazily, and may not exist in newly installed sdks, or may be out of date after device installations.
1237
1170
  - Fix a bug generating language settings in optimized jungle
1238
1171
  - Fix a bug introduced by pick-one: don't modify a shared array
package/LICENSE.txt ADDED
@@ -0,0 +1,18 @@
1
+ Copyright 2025 Mark Williams
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the “Software”), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/build/api.cjs CHANGED
@@ -18,52 +18,52 @@ 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_OCIRSLOJ.checkCompilerVersion,
22
- clearDiagnostics: () => import_chunk_OCIRSLOJ.clearDiagnostics,
23
- collectNamespaces: () => import_chunk_OCIRSLOJ.collectNamespaces,
24
- createDocumentationMap: () => import_chunk_OCIRSLOJ.createDocumentationMap,
25
- declKey: () => import_chunk_OCIRSLOJ.declKey,
26
- diagnostic: () => import_chunk_OCIRSLOJ.diagnostic,
27
- diagnosticHelper: () => import_chunk_OCIRSLOJ.diagnosticHelper,
28
- findNamesInScope: () => import_chunk_OCIRSLOJ.findNamesInScope,
29
- findUsingForNode: () => import_chunk_OCIRSLOJ.findUsingForNode,
30
- formatAst: () => import_chunk_OCIRSLOJ.formatAst,
31
- formatAstLongLines: () => import_chunk_OCIRSLOJ.formatAstLongLines,
32
- formatScopedName: () => import_chunk_OCIRSLOJ.formatScopedName,
33
- getApiFunctionInfo: () => import_chunk_OCIRSLOJ.getApiFunctionInfo,
34
- getApiMapping: () => import_chunk_OCIRSLOJ.getApiMapping,
35
- getSuperClasses: () => import_chunk_OCIRSLOJ.getSuperClasses,
36
- handleImportUsing: () => import_chunk_OCIRSLOJ.handleImportUsing,
21
+ checkCompilerVersion: () => import_chunk_BPXB3WQQ.checkCompilerVersion,
22
+ clearDiagnostics: () => import_chunk_BPXB3WQQ.clearDiagnostics,
23
+ collectNamespaces: () => import_chunk_BPXB3WQQ.collectNamespaces,
24
+ createDocumentationMap: () => import_chunk_BPXB3WQQ.createDocumentationMap,
25
+ declKey: () => import_chunk_BPXB3WQQ.declKey,
26
+ diagnostic: () => import_chunk_BPXB3WQQ.diagnostic,
27
+ diagnosticHelper: () => import_chunk_BPXB3WQQ.diagnosticHelper,
28
+ findNamesInScope: () => import_chunk_BPXB3WQQ.findNamesInScope,
29
+ findUsingForNode: () => import_chunk_BPXB3WQQ.findUsingForNode,
30
+ formatAst: () => import_chunk_BPXB3WQQ.formatAst,
31
+ formatAstLongLines: () => import_chunk_BPXB3WQQ.formatAstLongLines,
32
+ formatScopedName: () => import_chunk_BPXB3WQQ.formatScopedName,
33
+ getApiFunctionInfo: () => import_chunk_BPXB3WQQ.getApiFunctionInfo,
34
+ getApiMapping: () => import_chunk_BPXB3WQQ.getApiMapping,
35
+ getSuperClasses: () => import_chunk_BPXB3WQQ.getSuperClasses,
36
+ handleImportUsing: () => import_chunk_BPXB3WQQ.handleImportUsing,
37
37
  hasProperty: () => import_chunk_UBAYZSM3.hasProperty,
38
- isClassVariable: () => import_chunk_OCIRSLOJ.isClassVariable,
39
- isLocal: () => import_chunk_OCIRSLOJ.isLocal,
40
- isLookupCandidate: () => import_chunk_OCIRSLOJ.isLookupCandidate,
41
- isStateNode: () => import_chunk_OCIRSLOJ.isStateNode,
42
- lookupByFullName: () => import_chunk_OCIRSLOJ.lookupByFullName,
43
- lookupNext: () => import_chunk_OCIRSLOJ.lookupNext,
44
- lookupResultContains: () => import_chunk_OCIRSLOJ.lookupResultContains,
45
- lookupWithType: () => import_chunk_OCIRSLOJ.lookupWithType,
46
- makeToyboxLink: () => import_chunk_OCIRSLOJ.makeToyboxLink,
47
- mapVarDeclsByType: () => import_chunk_OCIRSLOJ.mapVarDeclsByType,
48
- markInvokeClassMethod: () => import_chunk_OCIRSLOJ.markInvokeClassMethod,
49
- parseSdkVersion: () => import_chunk_OCIRSLOJ.parseSdkVersion,
50
- popRootNode: () => import_chunk_OCIRSLOJ.popRootNode,
51
- pushRootNode: () => import_chunk_OCIRSLOJ.pushRootNode,
52
- resolveDiagnostics: () => import_chunk_OCIRSLOJ.resolveDiagnostics,
53
- resolveDiagnosticsMap: () => import_chunk_OCIRSLOJ.resolveDiagnosticsMap,
54
- sameLookupResult: () => import_chunk_OCIRSLOJ.sameLookupResult,
38
+ isClassVariable: () => import_chunk_BPXB3WQQ.isClassVariable,
39
+ isLocal: () => import_chunk_BPXB3WQQ.isLocal,
40
+ isLookupCandidate: () => import_chunk_BPXB3WQQ.isLookupCandidate,
41
+ isStateNode: () => import_chunk_BPXB3WQQ.isStateNode,
42
+ lookupByFullName: () => import_chunk_BPXB3WQQ.lookupByFullName,
43
+ lookupNext: () => import_chunk_BPXB3WQQ.lookupNext,
44
+ lookupResultContains: () => import_chunk_BPXB3WQQ.lookupResultContains,
45
+ lookupWithType: () => import_chunk_BPXB3WQQ.lookupWithType,
46
+ makeToyboxLink: () => import_chunk_BPXB3WQQ.makeToyboxLink,
47
+ mapVarDeclsByType: () => import_chunk_BPXB3WQQ.mapVarDeclsByType,
48
+ markInvokeClassMethod: () => import_chunk_BPXB3WQQ.markInvokeClassMethod,
49
+ parseSdkVersion: () => import_chunk_BPXB3WQQ.parseSdkVersion,
50
+ popRootNode: () => import_chunk_BPXB3WQQ.popRootNode,
51
+ pushRootNode: () => import_chunk_BPXB3WQQ.pushRootNode,
52
+ resolveDiagnostics: () => import_chunk_BPXB3WQQ.resolveDiagnostics,
53
+ resolveDiagnosticsMap: () => import_chunk_BPXB3WQQ.resolveDiagnosticsMap,
54
+ sameLookupResult: () => import_chunk_BPXB3WQQ.sameLookupResult,
55
55
  traverseAst: () => import_chunk_UBAYZSM3.traverseAst,
56
- variableDeclarationName: () => import_chunk_OCIRSLOJ.variableDeclarationName,
57
- visitReferences: () => import_chunk_OCIRSLOJ.visitReferences,
58
- visit_resources: () => import_chunk_OCIRSLOJ.visit_resources,
59
- visitorNode: () => import_chunk_OCIRSLOJ.visitorNode
56
+ variableDeclarationName: () => import_chunk_BPXB3WQQ.variableDeclarationName,
57
+ visitReferences: () => import_chunk_BPXB3WQQ.visitReferences,
58
+ visit_resources: () => import_chunk_BPXB3WQQ.visit_resources,
59
+ visitorNode: () => import_chunk_BPXB3WQQ.visitorNode
60
60
  });
61
61
  module.exports = __toCommonJS(api_exports);
62
- var import_chunk_OCIRSLOJ = require("./chunk-OCIRSLOJ.cjs");
63
- var import_chunk_KHQPCXSJ = require("./chunk-KHQPCXSJ.cjs");
62
+ var import_chunk_BPXB3WQQ = require("./chunk-BPXB3WQQ.cjs");
63
+ var import_chunk_IJS7AYMN = require("./chunk-IJS7AYMN.cjs");
64
64
  var import_chunk_UBAYZSM3 = require("./chunk-UBAYZSM3.cjs");
65
65
  var import_chunk_VS2QQHAK = require("./chunk-VS2QQHAK.cjs");
66
- (0, import_chunk_OCIRSLOJ.init_api)();
66
+ (0, import_chunk_BPXB3WQQ.init_api)();
67
67
  // Annotate the CommonJS export names for ESM import in node:
68
68
  0 && (module.exports = {
69
69
  checkCompilerVersion,