guida-lang / compiler

Guida is a functional programming language that builds upon the solid foundation of Elm, offering backward compatibility with all existing Elm 0.19.1 projects
https://guida-lang.org
Other
41 stars 2 forks source link

differences in generated code when using optimize flag #2

Closed decioferreira closed 2 months ago

decioferreira commented 2 months ago

There are currently some differences in generated code when running elm make --optimize --output=index.js src/Hello.elm vs guida make --optimize --output=index.js src/Hello.elm:

diff --git a/examples/index.js b/examples/index.js
index fce90cf9..216a123b 100644
--- a/examples/index.js
+++ b/examples/index.js
@@ -784,11 +784,11 @@ function _Debug_crash_UNUSED(identifier, fact1, fact2, fact3, fact4)

 function _Debug_regionToString(region)
 {
-   if (region.J.z === region.P.z)
+   if (region.ae.r === region.aj.r)
    {
-       return 'on line ' + region.J.z;
+       return 'on line ' + region.ae.r;
    }
-   return 'on lines ' + region.J.z + ' through ' + region.P.z;
+   return 'on lines ' + region.ae.r + ' through ' + region.aj.r;
 }

@@ -1857,9 +1857,9 @@ var _Platform_worker = F4(function(impl, flagDecoder, debugMetadata, args)
    return _Platform_initialize(
        flagDecoder,
        args,
-       impl.V,
-       impl.ao,
-       impl.aO,
+       impl.G,
+       impl.H,
+       impl.I,
        function() { return function() {} }
    );
 });
@@ -2719,9 +2719,9 @@ var _VirtualDom_mapEventTuple = F2(function(func, tuple)
 var _VirtualDom_mapEventRecord = F2(function(func, record)
 {
    return {
-       o: func(record.o),
-       K: record.K,
-       H: record.H
+       aw: func(record.aw),
+       ax: record.ax,
+       ay: record.ay
    }
 });

@@ -2989,11 +2989,11 @@ function _VirtualDom_makeCallback(eventNode, initialHandler)
        // 3 = Custom

        var value = result.a;
-       var message = !tag ? value : tag < 3 ? value.a : value.o;
-       var stopPropagation = tag == 1 ? value.b : tag == 3 && value.K;
+       var message = !tag ? value : tag < 3 ? value.a : value.aw;
+       var stopPropagation = tag == 1 ? value.b : tag == 3 && value.ax;
        var currentEventNode = (
            stopPropagation && event.stopPropagation(),
-           (tag == 2 ? value.b : tag == 3 && value.H) && event.preventDefault(),
+           (tag == 2 ? value.b : tag == 3 && value.ay) && event.preventDefault(),
            eventNode
        );
        var tagger;
@@ -4335,25 +4335,25 @@ var $elm$core$Array$treeFromBuilder = F2(
    });
 var $elm$core$Array$builderToArray = F2(
    function (reverseNodeList, builder) {
-       if (!builder.a) {
+       if (!builder.aF) {
            return A4(
                $elm$core$Array$Array_elm_builtin,
-               $elm$core$Elm$JsArray$length(builder.c),
+               $elm$core$Elm$JsArray$length(builder.aQ),
                $elm$core$Array$shiftStep,
                $elm$core$Elm$JsArray$empty,
-               builder.c);
+               builder.aQ);
        } else {
-           var treeLen = builder.a * $elm$core$Array$branchFactor;
+           var treeLen = builder.aF * $elm$core$Array$branchFactor;
            var depth = $elm$core$Basics$floor(
                A2($elm$core$Basics$logBase, $elm$core$Array$branchFactor, treeLen - 1));
-           var correctNodeList = reverseNodeList ? $elm$core$List$reverse(builder.d) : builder.d;
-           var tree = A2($elm$core$Array$treeFromBuilder, correctNodeList, builder.a);
+           var correctNodeList = reverseNodeList ? $elm$core$List$reverse(builder.aR) : builder.aR;
+           var tree = A2($elm$core$Array$treeFromBuilder, correctNodeList, builder.aF);
            return A4(
                $elm$core$Array$Array_elm_builtin,
-               $elm$core$Elm$JsArray$length(builder.c) + treeLen,
+               $elm$core$Elm$JsArray$length(builder.aQ) + treeLen,
                A2($elm$core$Basics$max, 5, depth * $elm$core$Array$shiftStep),
                tree,
-               builder.c);
+               builder.aQ);
        }
    });
 var $elm$core$Basics$idiv = _Basics_idiv;
@@ -4366,7 +4366,7 @@ var $elm$core$Array$initializeHelp = F5(
                return A2(
                    $elm$core$Array$builderToArray,
                    false,
-                   {d: nodeList, a: (len / $elm$core$Array$branchFactor) | 0, c: tail});
+                   {aF: (len / $elm$core$Array$branchFactor) | 0, aQ: tail, aR: nodeList});
            } else {
                var leaf = $elm$core$Array$Leaf(
                    A3($elm$core$Elm$JsArray$initialize, $elm$core$Array$branchFactor, fromIndex, fn));