@markw65/monkeyc-optimizer 1.1.92 → 1.1.94

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,23 @@
2
2
 
3
3
  All notable changes to the "monkeyc-optimizer" package will be documented in this file.
4
4
 
5
+ ### 1.1.94
6
+
7
+ - Update to [@markw65/prettier-plugin-monkeyc@1.0.65](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1065)
8
+ - Fix an issue that prevented a blank line after a catch block being preserved
9
+ - Replace a horribly inefficient regex with a loop to avoid stack overflows when `@markw65/monkeyc-optimizer` tries to write large files.
10
+
11
+ - Compute and use FunctionInfo during analysis pass
12
+ - Better interference analysis for computed MemberDeclarations
13
+
14
+ ### 1.1.93
15
+
16
+ - Update to [@markw65/prettier-plugin-monkeyc@1.0.64](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1064)
17
+ - Fixes incompatibilities with `prettier@3.7.0` and later
18
+ - Update to prettier3.x for testing/development purposes, since that's what's in use almost everywhere now
19
+ - Add support for Extended Code Spaces in the post build optimizer.
20
+ - 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.
21
+
5
22
  ### 1.1.92
6
23
 
7
24
  - Get rid of yazl, yauzl and extract-zip, and uze 7z-wasm instead.
@@ -26,7 +43,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
26
43
  - Fix output of cft-font-info
27
44
  - 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.
28
45
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.61](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1061)
29
-
30
46
  - Allow semi-colons after expression-statements, and uncontrolled block-statements to match Garmin's parser.
31
47
 
32
48
  - 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))
@@ -118,7 +134,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
118
134
  ### 1.1.72
119
135
 
120
136
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.59](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1059)
121
-
122
137
  - Ignore `resolveType` field in serializeMonkeyC to avoid errors due to cycles.
123
138
 
124
139
  - Make `evaluate` skip everything except the `body` when processing class, module or function declarations.
@@ -308,7 +323,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
308
323
  ### 1.1.39
309
324
 
310
325
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.54](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1054)
311
-
312
326
  - Fixes the parser to understand tuples
313
327
 
314
328
  - Add basic type analysis for tuples
@@ -323,23 +337,19 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
323
337
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.53](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1053)
324
338
 
325
339
  - Features
326
-
327
340
  - Generate diagnostics for unary and binary operators with incorrect arguments
328
341
  - Properly handle object-literal types (eg `{ :foo as String, :bar as Number }`).
329
342
  - When converting Graphics.ColorValue to a number, format the number as hex.
330
343
 
331
344
  - Tests
332
-
333
345
  - Update tests for sdk 6.3.0
334
346
  - Add more test coverage for binary operators and their expected types.
335
347
 
336
348
  - Build
337
-
338
349
  - Use [@markw65/peggy-optimizer](https://github.com/markw65/peggy/tree/peggy-optimizer/optimizer-plugin) to optimize the jungle and resource parsers
339
350
  - Make things work properly with prettier-3.x, but don't actually upgrade yet
340
351
 
341
352
  - Bug fixes
342
-
343
353
  - Fix a bug with the result type of A & B when A could be Boolean
344
354
  - Always include null for the types of values extracted from `Dictionary`s
345
355
  - When inferring the type of a `Dictionary`, don't include values.
@@ -352,7 +362,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
352
362
  ### 1.1.35
353
363
 
354
364
  - Infrastructure
355
-
356
365
  - Optimize the xml parser to speed up compilation/analysis
357
366
 
358
367
  - Type Checker
@@ -361,7 +370,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
361
370
  ### 1.1.34
362
371
 
363
372
  - Optimizations
364
-
365
373
  - Add a few more peephole optimizations to the post build optimizer
366
374
  - `incsp 0;` => `nop`
367
375
  - `ipush 0; shlv` => `nop`
@@ -375,26 +383,21 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
375
383
  ### 1.1.33
376
384
 
377
385
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.51](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1051)
378
-
379
386
  - Makes it compatible with prettier@3.0.0
380
387
 
381
388
  - Bug fixes
382
-
383
389
  - Fix a problem that could incorrectly optimize an array-init
384
390
 
385
391
  - Optimizations
386
-
387
392
  - Enable the array-init optimization in a few more cases
388
393
 
389
394
  ### 1.1.32
390
395
 
391
396
  - Bug fixes
392
-
393
397
  - Don't optimize `do { BODY } while (false);` to `{ BODY }` if `BODY` contains `break` or `continue`
394
398
  - 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.
395
399
 
396
400
  - Fixes for sdk-6.2.x
397
-
398
401
  - 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.
399
402
 
400
403
  - 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.
@@ -415,7 +418,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
415
418
  ### 1.1.29
416
419
 
417
420
  - Bug fixes
418
-
419
421
  - 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.
420
422
 
421
423
  - Enhancements
@@ -424,7 +426,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
424
426
  ### 1.1.28
425
427
 
426
428
  - Bug fixes
427
-
428
429
  - 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
429
430
  - Don't add personality paths to the generated jungle file if the sdk is prior to 4.2.1
430
431
  - 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`
@@ -435,7 +436,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
435
436
  ### 1.1.27
436
437
 
437
438
  - Bug fixes
438
-
439
439
  - 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.
440
440
 
441
441
  - New features
@@ -444,13 +444,11 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
444
444
  ### 1.1.26
445
445
 
446
446
  - Bug fixes
447
-
448
447
  - 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).
449
448
  - 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`)
450
449
  - fixes some issues converting the system function documentation to markdown (for the Hover, Completion and Signature providers in the extension).
451
450
 
452
451
  - New features
453
-
454
452
  - 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))
455
453
  - adds support for parsing (but not formatting) .mss files
456
454
  - Adds full support for personalities in `.jungle` and `.mss` files, including reading the per-device `personality.mss` files
@@ -468,7 +466,6 @@ All notable changes to the "monkeyc-optimizer" package will be documented in thi
468
466
  ### 1.1.24
469
467
 
470
468
  - Bug fixes
471
-
472
469
  - Conversion of unary `-x` to `0 - x` was too restrictive, causing some missed optimization opportunities
473
470
 
474
471
  - Post Build Optimizations
@@ -487,7 +484,6 @@ No functional change, just fixes a typo that broke the typescript exports.
487
484
  ### 1.1.22
488
485
 
489
486
  - Bug fixes
490
-
491
487
  - [Fixes a bug in Single Use Copy Prop](https://github.com/markw65/prettier-extension-monkeyc/issues/8)
492
488
 
493
489
  - Post Build Optimizations
@@ -500,11 +496,9 @@ No functional change, just fixes a typo that broke the typescript exports.
500
496
  ### 1.1.21
501
497
 
502
498
  - Bug fixes
503
-
504
499
  - 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.
505
500
 
506
501
  - Source to Source Optimizations
507
-
508
502
  - 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.
509
503
  - convert `-x` to `0 - x`. Again, Garmin's compiler generates exactly the same code, but being explicit makes the `0` available to `sizeBasedPRE`.
510
504
  - rewrite some optimizations so that `-x` and `0-x` are treated identically. eg `(0-x) + y` => `y - x` (for suitably typed `x` and `y`).
@@ -518,7 +512,6 @@ No functional change, just fixes a typo that broke the typescript exports.
518
512
  ### 1.1.20
519
513
 
520
514
  - Bug fixes
521
-
522
515
  - Fix a bug that could cause the optimizer to incorrectly substitute one local for another.
523
516
 
524
517
  - Optimizations
@@ -527,7 +520,6 @@ No functional change, just fixes a typo that broke the typescript exports.
527
520
  ### 1.1.19
528
521
 
529
522
  - Bug fixes
530
-
531
523
  - Fix "Minimize Modules" in background/glance scopes
532
524
  - 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)
533
525
  - 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.
@@ -544,7 +536,6 @@ No functional change, just fixes a typo that broke the typescript exports.
544
536
  ### 1.1.17 (this package is missing two files)
545
537
 
546
538
  - Project infrastructure
547
-
548
539
  - 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.
549
540
 
550
541
  - Bug fixes
@@ -553,7 +544,6 @@ No functional change, just fixes a typo that broke the typescript exports.
553
544
  ### 1.1.16
554
545
 
555
546
  - Project infrastructure
556
-
557
547
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.46](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1046)
558
548
  - no functional change.
559
549
  - switch from webpack to esbuild, for faster builds, and better packaging.
@@ -574,7 +564,6 @@ No functional change, just fixes a typo that broke the typescript exports.
574
564
  ### 1.1.15
575
565
 
576
566
  - Post build optimizer improvements
577
-
578
567
  - Simplify LogicalExpressions. This generally saves 3 bytes per `&&` or `||`, and also makes them faster
579
568
  - 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.
580
569
  - 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.
@@ -608,7 +597,6 @@ No functional change, just fixes a typo that broke the typescript exports.
608
597
  ### 1.1.11
609
598
 
610
599
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.44](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1044)
611
-
612
600
  - Fixes a parser bug relating to Methods returning Void, and a printer bug relating to nested Method declarations.
613
601
 
614
602
  - Bug fixes
@@ -636,7 +624,6 @@ No functional change, just fixes a typo that broke the typescript exports.
636
624
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.43](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1043)
637
625
 
638
626
  - Bug fixes
639
-
640
627
  - fix an interaction between inlining and removing unused local vars that could cause unlimited recursion leading to stack overflow
641
628
 
642
629
  - New optimizations
@@ -645,7 +632,6 @@ No functional change, just fixes a typo that broke the typescript exports.
645
632
  ### 1.1.8
646
633
 
647
634
  - Bug fixes
648
-
649
635
  - 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.
650
636
  - 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.
651
637
 
@@ -675,17 +661,14 @@ No functional change, just fixes a typo that broke the typescript exports.
675
661
  ### 1.1.4
676
662
 
677
663
  - Optimizations
678
-
679
664
  - Minor tweaks to dead store elimination
680
665
  - Better type resolution for untyped code
681
666
 
682
667
  - Enhancements
683
-
684
668
  - Retain the type map in the analysis pass, so that it can be used to improve
685
669
  the results in visitReferences
686
670
 
687
671
  - Bug fixes
688
-
689
672
  - When multiple diagnostics were reported for a single location, all but the last was lost
690
673
  - Sometimes when evaluating MemberExpressions type-flow would give up too easily, resulting
691
674
  in unknown types for the object, which then resulted in unexpected error messages from
@@ -699,14 +682,12 @@ No functional change, just fixes a typo that broke the typescript exports.
699
682
  ### 1.1.3
700
683
 
701
684
  - Tweaks and fixes
702
-
703
685
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.42](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1042)
704
686
  - Fixed an issue that cause inlining in return context to be too conservative
705
687
  - 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.
706
688
  - Update diagnostic api to optionally include a uri to more detailing information.
707
689
 
708
690
  - Type Analysis
709
-
710
691
  - 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.
711
692
  - Added checkers for return types, call arguments, assignments and variable declarations.
712
693
  - Automatically infer Array and Dictionary types
@@ -737,11 +718,9 @@ No functional change, just fixes a typo that broke the typescript exports.
737
718
  ### 1.1.0
738
719
 
739
720
  - Implements a type analyzer, to enable better optimizations
740
-
741
721
  - adds options `trustDeclaredTypes` and `propagateTypes`. See https://github.com/markw65/monkeyc-optimizer/wiki/Type-and-Dataflow-analysis
742
722
 
743
723
  - Improved optimizations
744
-
745
724
  - SizeBasedPRE now has finer granularity, making it generally find more opportunities
746
725
  - Lots of improvements to binary operators, and folding. Subject to suitable type checks,
747
726
  - `(x + K1) + K2` => `x + (K1 + K2)`
@@ -765,11 +744,9 @@ No functional change, just fixes a typo that broke the typescript exports.
765
744
  ### 1.0.45
766
745
 
767
746
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.41](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1041)
768
-
769
747
  - Fixes a few parser edge cases
770
748
 
771
749
  - Bug fixes
772
-
773
750
  - Fix a bug constant folding == and !=
774
751
  - 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.
775
752
  - Look at all build dependencies when deciding whether to regenerate the optimized files.
@@ -783,7 +760,6 @@ No functional change, just fixes a typo that broke the typescript exports.
783
760
  ### 1.0.44
784
761
 
785
762
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.40](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1040)
786
-
787
763
  - Fixes location ranges associated with parenthesized expressions
788
764
  - Fixes parsing of Lang.Char literals
789
765
 
@@ -793,7 +769,6 @@ No functional change, just fixes a typo that broke the typescript exports.
793
769
  ### 1.0.43
794
770
 
795
771
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.39](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1039)
796
-
797
772
  - Fixes issues parsing/printing/optimizing NaN
798
773
 
799
774
  - Fix issues with windows paths introduced in 1.0.42
@@ -804,12 +779,10 @@ No functional change, just fixes a typo that broke the typescript exports.
804
779
  ### 1.0.42
805
780
 
806
781
  - Update to [@markw65/prettier-plugin-monkeyc@1.0.38](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1038)
807
-
808
782
  - faster parsing
809
783
  - supports parsing the attributes in api.mir, including sdk version etc.
810
784
 
811
785
  - Performance
812
-
813
786
  - Using the updated prettier-plugin-monkeyc halves the time spent in the parser
814
787
  - 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.
815
788
  - 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.
@@ -826,7 +799,6 @@ No functional change, just fixes a typo that broke the typescript exports.
826
799
  ### 1.0.40
827
800
 
828
801
  - Improvements
829
-
830
802
  - Upgrade to [@markw65/prettier-plugin-monkeyc@1.0.37](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1037).
831
803
  - Report locations of errors in manifest.xml (rather than just reporting an error somewhere in the file)
832
804
  - Minor improvements to Goto References etc
@@ -837,7 +809,6 @@ No functional change, just fixes a typo that broke the typescript exports.
837
809
  - Fix lookups in static methods, under a new option that defaults to true.
838
810
 
839
811
  - Testing
840
-
841
812
  - Fix pragma checker to sort the diagnostics properly
842
813
  - Allow specifying which test to run on the command line
843
814
  - Update all tests to work with 4.1.6 and 4.1.7
@@ -849,7 +820,6 @@ No functional change, just fixes a typo that broke the typescript exports.
849
820
  ### 1.0.39
850
821
 
851
822
  - Improvements
852
-
853
823
  - Upgrade to [@markw65/prettier-plugin-monkeyc@1.0.36](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1036).
854
824
  - Upgrade all other npm dependencies to the latest versions, and fix a few issues that showed up as a result.
855
825
  - 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.
@@ -858,11 +828,9 @@ No functional change, just fixes a typo that broke the typescript exports.
858
828
  - 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`.
859
829
 
860
830
  - Optimizations
861
-
862
831
  - Optimize has expressions that are guaranteed to be false.
863
832
 
864
833
  - Bugs
865
-
866
834
  - Fix an issue with launchSimulator, which caused it to sometimes not bring the simulator window into focus when it should have done.
867
835
  - Fix an issue that caused simulateProgram to fail on windows.
868
836
  - 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)
@@ -897,7 +865,6 @@ No functional change, just fixes a typo that broke the typescript exports.
897
865
  ### 1.0.35
898
866
 
899
867
  - Testing
900
-
901
868
  - Add a new open source project
902
869
  - Fixup tests to work with compiler2beta2
903
870
 
@@ -907,7 +874,6 @@ No functional change, just fixes a typo that broke the typescript exports.
907
874
  ### 1.0.34
908
875
 
909
876
  - Bug fixes
910
-
911
877
  - Fix parser to allow white space to separate attributes, in addition to comma
912
878
  - Fix optimizer to respect prettier options when formatting the optimized code
913
879
 
@@ -918,7 +884,6 @@ No functional change, just fixes a typo that broke the typescript exports.
918
884
  ### 1.0.33
919
885
 
920
886
  - New features
921
-
922
887
  - Tagging a function with (:keep) will prevent the optimizer from removing it, even if it appears to be unused.
923
888
 
924
889
  - Bug fixes
@@ -933,7 +898,6 @@ No functional change, just fixes a typo that broke the typescript exports.
933
898
  ### 1.0.31
934
899
 
935
900
  - Bug fixes
936
-
937
901
  - Use withLocDeep on inline results
938
902
  - Better tracking of state.inType
939
903
  - Fix typo setting up the ProgramState
@@ -943,7 +907,6 @@ No functional change, just fixes a typo that broke the typescript exports.
943
907
  - I had forgotten to remove some code that I added to debug a problem
944
908
 
945
909
  - Code cleanup
946
-
947
910
  - Move all the global types to optimizer-types.ts, and explicitly import them
948
911
  - Be more consistent about when assignment/update lhs is traversed
949
912
  - Rework exposed flag
@@ -954,7 +917,6 @@ No functional change, just fixes a typo that broke the typescript exports.
954
917
  - Update for BigInt literals, and cleanup folding code
955
918
 
956
919
  - New features
957
-
958
920
  - Support `obj[:key]` as alternate for obj.key in lookup
959
921
  - `Find References`, and `Rename` will recognize these references now.
960
922
  - Add an unused variable cleanup pass
@@ -981,19 +943,15 @@ Bug Fixes
981
943
  ### 1.0.29
982
944
 
983
945
  - Update to `@markw65/prettier-plugin-monkeyc@1.0.32`
984
-
985
946
  - 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.
986
947
 
987
948
  - Bug fixes
988
-
989
949
  - Fix a bug causing literal nodes to be shared. This was harmless prior to the implementation of the PRE pass
990
950
 
991
951
  - Code cleanup
992
-
993
952
  - Add `isStatement` and `isExpression` helpers
994
953
 
995
954
  - New features
996
-
997
955
  - Add constant folding for relational and logical operators
998
956
  - Allow assignment-scope inlining in variable initializers
999
957
  - Better cleanup of unused expressions
@@ -1036,7 +994,6 @@ Bug Fixes
1036
994
  ### 1.0.23
1037
995
 
1038
996
  - Bug Fixes
1039
-
1040
997
  - Don't treat parameters to Method types as undeclared variables
1041
998
  - eg `var x as (Method(a as Number, b as Number) as Void)` should not report that `a` and `b` are undeclared
1042
999
 
@@ -1047,9 +1004,7 @@ Bug Fixes
1047
1004
  ### 1.0.22
1048
1005
 
1049
1006
  - Improvements
1050
-
1051
1007
  - Major rewrite of the symbol lookup mechanism, to match monkeyc as closely as possible
1052
-
1053
1008
  - Fix callee lookup to skip local variables
1054
1009
  - Fix class lookup to first check all the super classes, then to check the context of each super class
1055
1010
  - Fix module lookup to check both the module, and the context of the module
@@ -1058,7 +1013,6 @@ Bug Fixes
1058
1013
  - Add live diagnostics for missing symbols
1059
1014
 
1060
1015
  - Bug fixes
1061
-
1062
1016
  - Recognize the the variable in a catch clause is a declaration
1063
1017
 
1064
1018
  - Breaking change
@@ -1067,7 +1021,6 @@ Bug Fixes
1067
1021
  ### 1.0.21
1068
1022
 
1069
1023
  - Bug fixes
1070
-
1071
1024
  - Parameters from the calling function should be treated just line locals when inlining
1072
1025
  - Upgrade to `@markw65/prettier-plugin-monkeyc@1.0.24`
1073
1026
  - fixes crash with comments following an attribute: `(:foo) /* comment */ function foo() {}`
@@ -1076,12 +1029,10 @@ Bug Fixes
1076
1029
  ### 1.0.20
1077
1030
 
1078
1031
  - Bug fixes
1079
-
1080
1032
  - Fix a bug marking unknown callees
1081
1033
  - Fix a bug in test.js that didn't notice when tests failed, and fix a failing test
1082
1034
 
1083
1035
  - Optimizer enhancements
1084
-
1085
1036
  - Re-run the main optimization step, to properly account for functions that are unused after optimization
1086
1037
  - Call the optimizer on 'unused' nodes before returning them
1087
1038
 
@@ -1091,18 +1042,15 @@ Bug Fixes
1091
1042
  ### 1.0.19
1092
1043
 
1093
1044
  - Upgrade to `@markw65/prettier-plugin-monkeyc@1.0.22`
1094
-
1095
1045
  - fixes some minor typing issues for mctree
1096
1046
  - special handling for certain parenthesized expressions.
1097
1047
 
1098
1048
  - Optimizer
1099
-
1100
1049
  - Handle more unused expressions, add tests, and prettify the OptimizerTests project
1101
1050
  - Allow statement-style inlining in assignment and return contexts
1102
1051
  - Add diagnostics for failure to inline
1103
1052
 
1104
1053
  - Tests
1105
-
1106
1054
  - More tweaks to pragma-checker
1107
1055
  - Add launch and task configs for building/running tests
1108
1056
 
@@ -1118,12 +1066,10 @@ Bug Fixes
1118
1066
  ### 1.0.17
1119
1067
 
1120
1068
  - New Features
1121
-
1122
1069
  - Extend the inliner to support more complex functions when called in a void context
1123
1070
  - Cleanup unused expressions. `0;x;foo.bar;a+b` will all now be optimized away.
1124
1071
 
1125
1072
  - Testing
1126
-
1127
1073
  - 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.
1128
1074
  - Add tests for the statement inliner, and the unused expression cleanup code.
1129
1075
 
@@ -1133,13 +1079,11 @@ Bug Fixes
1133
1079
  ### 1.0.16
1134
1080
 
1135
1081
  - Bug fixes
1136
-
1137
1082
  - Fix off-by-one in removeNodeComments
1138
1083
  - Fix lookup to consistently lookup types or values.
1139
1084
  - Fix lookup of superclass names
1140
1085
 
1141
1086
  - New Features
1142
-
1143
1087
  - Add a simple inliner
1144
1088
  - Add support for conditional inlining based on excludeAnnotations
1145
1089
 
@@ -1156,7 +1100,6 @@ Bug Fixes
1156
1100
  ### 1.0.14
1157
1101
 
1158
1102
  - Bug fixes
1159
-
1160
1103
  - When reading a barrel project with no products, add all products by default
1161
1104
  - Only set language specific paths for languages that are supported by the device
1162
1105
  - Remove comments that are completely contained within removed nodes
@@ -1170,13 +1113,11 @@ Bug Fixes
1170
1113
  ### 1.0.13
1171
1114
 
1172
1115
  - Improvements
1173
-
1174
1116
  - Add displayName to deviceInfo (for getTargetDevices in prettier-extension-monkeyc)
1175
1117
  - Throw a better error when we fail to read a jungle file
1176
1118
  - Don't try to optimize barrel projects
1177
1119
 
1178
1120
  - Code cleanup
1179
-
1180
1121
  - Update to `@markw65/prettier-plugin-monkeyc@1.0.20` for mctree fixes
1181
1122
  - Enable typescript strict checks
1182
1123
  - Turn off synthetic default imports, and fix issues
@@ -1192,12 +1133,10 @@ Bug Fixes
1192
1133
  ### 1.0.11
1193
1134
 
1194
1135
  - Improvements
1195
-
1196
1136
  - Add option to run tests (for projects that have them)
1197
1137
  - Add getProjectAnalysis api, to support various language features in `@markw65/prettier-extension-monkeyc`
1198
1138
 
1199
1139
  - Bug fixes
1200
-
1201
1140
  - Fix lookup of self/me
1202
1141
 
1203
1142
  - Code cleanup
@@ -1229,7 +1168,6 @@ Bug Fixes
1229
1168
  ### 1.0.8
1230
1169
 
1231
1170
  - Improvements
1232
-
1233
1171
  - Update to `@markw65/prettier-plugin-monkeyc:1.0.14`
1234
1172
  - Parse and respect \<build\> instructions in resource files
1235
1173
  - Add minimal barrel support
@@ -1237,7 +1175,6 @@ Bug Fixes
1237
1175
  - Rename locals which would be marked re-declaring
1238
1176
 
1239
1177
  - Bug Fixes
1240
-
1241
1178
  - 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.
1242
1179
  - Fix a bug generating language settings in optimized jungle
1243
1180
  - 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.