@@ -128,8 +128,7 @@ generate mode expression =
128128
129129 Opt.Destruct (Opt.Destructor name path) body ->
130130 let
131− pathExpr = generatePath mode path
132− pathDef = JS.Var [ (JsName.fromLocal name, Just pathExpr) ]
131+ pathDef = JS.Var (JsName.fromLocal name) (generatePath mode path)
133132 in
134133 JsBlock $ pathDef : codeToStmtList (generate mode body)
135134
@@ -482,17 +481,17 @@ generateBitwiseCall home name args =
482481 case args of
483482 [arg] ->
484483 case name of
485− "complement" -> JS.Prefix JS.PrefixBNot arg
484+ "complement" -> JS.Prefix JS.PrefixComplement arg
486485 _ -> generateGlobalCall home name args
487486
488487 [left,right] ->
489488 case name of
490− "and" -> JS.Infix JS.OpBAnd left right
491− "or" -> JS.Infix JS.OpBOr left right
492− "xor" -> JS.Infix JS.OpBXor left right
493− "shiftLeftBy" -> JS.Infix JS.OpLShift right left
494− "shiftRightBy" -> JS.Infix JS.OpSpRShift right left
495− "shiftRightZfBy" -> JS.Infix JS.OpZfRShift right left
489+ "and" -> JS.Infix JS.OpBitwiseAnd left right
490+ "or" -> JS.Infix JS.OpBitwiseOr left right
491+ "xor" -> JS.Infix JS.OpBitwiseXor left right
492+ "shiftLeftBy" -> JS.Infix JS.OpLShift right left
493+ "shiftRightBy" -> JS.Infix JS.OpSpRShift right left
494+ "shiftRightZfBy" -> JS.Infix JS.OpZfRShift right left
496495 _ -> generateGlobalCall home name args
497496
498497 _ ->
@@ -505,10 +504,10 @@ generateBasicsCall mode home name args =
505504 [elmArg] ->
506505 let arg = generateJsExpr mode elmArg in
507506 case name of
508− "not" -> JS.Prefix JS.PrefixLNot arg
509− "negate" -> JS.Prefix JS.PrefixMinus arg
507+ "not" -> JS.Prefix JS.PrefixNot arg
508+ "negate" -> JS.Prefix JS.PrefixNegate arg
510509 "toFloat" -> arg
511− "truncate" -> JS.Infix JS.OpBOr arg (JS.Int 0)
510+ "truncate" -> JS.Infix JS.OpBitwiseOr arg (JS.Int 0)
512511 _ -> generateGlobalCall home name [arg]
513512
514513 [elmLeft, elmRight] ->
@@ -528,16 +527,16 @@ generateBasicsCall mode home name args =
528527 "sub" -> JS.Infix JS.OpSub left right
529528 "mul" -> JS.Infix JS.OpMul left right
530529 "fdiv" -> JS.Infix JS.OpDiv left right
531− "idiv" -> JS.Infix JS.OpBOr (JS.Infix JS.OpDiv left right) (JS.Int 0)
530+ "idiv" -> JS.Infix JS.OpBitwiseOr (JS.Infix JS.OpDiv left right) (JS.Int 0)
532531 "eq" -> equal left right
533532 "neq" -> notEqual left right
534− "lt" -> cmp JS.OpLT JS.OpLT 0 left right
535− "gt" -> cmp JS.OpGT JS.OpGT 0 left right
536− "le" -> cmp JS.OpLEq JS.OpLT 1 left right
537− "ge" -> cmp JS.OpGEq JS.OpGT (-1) left right
538− "or" -> JS.Infix JS.OpLOr left right
539− "and" -> JS.Infix JS.OpLAnd left right
540− "xor" -> JS.Infix JS.OpStrictNEq left right
533+ "lt" -> cmp JS.OpLt JS.OpLt 0 left right
534+ "gt" -> cmp JS.OpGt JS.OpGt 0 left right
535+ "le" -> cmp JS.OpLe JS.OpLt 1 left right
536+ "ge" -> cmp JS.OpGe JS.OpGt (-1) left right
537+ "or" -> JS.Infix JS.OpOr left right
538+ "and" -> JS.Infix JS.OpAnd left right
539+ "xor" -> JS.Infix JS.OpNe left right
541540 "remainderBy" -> JS.Infix JS.OpMod right left
542541 _ -> generateGlobalCall home name [left, right]
543542
@@ -558,7 +557,7 @@ notEqual left right =
558557 if isLiteral left || isLiteral right then
559558 strictNEq left right
560559 else
561− JS.Prefix JS.PrefixLNot $
560+ JS.Prefix JS.PrefixNot $
562561 JS.Call (JS.Ref (JsName.fromKernel Name.utils "eq")) [left, right]
563562
564563
@@ -647,42 +646,42 @@ strictEq :: JS.Expr -> JS.Expr -> JS.Expr
647646strictEq left right =
648647 case left of
649648 JS.Int 0 ->
650− JS.Prefix JS.PrefixLNot right
649+ JS.Prefix JS.PrefixNot right
651650
652651 JS.Bool bool ->
653− if bool then right else JS.Prefix JS.PrefixLNot right
652+ if bool then right else JS.Prefix JS.PrefixNot right
654653
655654 _ ->
656655 case right of
657656 JS.Int 0 ->
658− JS.Prefix JS.PrefixLNot left
657+ JS.Prefix JS.PrefixNot left
659658
660659 JS.Bool bool ->
661− if bool then left else JS.Prefix JS.PrefixLNot left
660+ if bool then left else JS.Prefix JS.PrefixNot left
662661
663662 _ ->
664− JS.Infix JS.OpStrictEq left right
663+ JS.Infix JS.OpEq left right
665664
666665
667666strictNEq :: JS.Expr -> JS.Expr -> JS.Expr
668667strictNEq left right =
669668 case left of
670669 JS.Int 0 ->
671− JS.Prefix JS.PrefixLNot (JS.Prefix JS.PrefixLNot right)
670+ JS.Prefix JS.PrefixNot (JS.Prefix JS.PrefixNot right)
672671
673672 JS.Bool bool ->
674− if bool then JS.Prefix JS.PrefixLNot right else right
673+ if bool then JS.Prefix JS.PrefixNot right else right
675674
676675 _ ->
677676 case right of
678677 JS.Int 0 ->
679− JS.Prefix JS.PrefixLNot (JS.Prefix JS.PrefixLNot left)
678+ JS.Prefix JS.PrefixNot (JS.Prefix JS.PrefixNot left)
680679
681680 JS.Bool bool ->
682− if bool then JS.Prefix JS.PrefixLNot left else left
681+ if bool then JS.Prefix JS.PrefixNot left else left
683682
684683 _ ->
685− JS.Infix JS.OpStrictNEq left right
684+ JS.Infix JS.OpNe left right
686685
687686
688687
@@ -695,13 +694,13 @@ generateTailCall :: Mode.Mode -> Name.Name -> [(Name.Name, Opt.Expr)] -> [JS.Stm
695694generateTailCall mode name args =
696695 let
697696 toTempVars (argName, arg) =
698− ( JsName.makeTemp argName, Just (generateJsExpr mode arg) )
697+ ( JsName.makeTemp argName, generateJsExpr mode arg )
699698
700699 toRealVars (argName, _) =
701700 JS.ExprStmt $
702701 JS.Assign (JS.LRef (JsName.fromLocal argName)) (JS.Ref (JsName.makeTemp argName))
703702 in
704− JS.Var (map toTempVars args)
703+ JS.Vars (map toTempVars args)
705704 : map toRealVars args
706705 ++ [ JS.Continue (Just (JsName.fromLocal name)) ]
707706
@@ -714,10 +713,10 @@ generateDef :: Mode.Mode -> Opt.Def -> JS.Stmt
714713generateDef mode def =
715714 case def of
716715 Opt.Def name body ->
717− JS.Var [ (JsName.fromLocal name, Just (generateJsExpr mode body)) ]
716+ JS.Var (JsName.fromLocal name) (generateJsExpr mode body)
718717
719718 Opt.TailDef name argNames body ->
720− JS.Var [ (JsName.fromLocal name, Just (codeToExpr (generateTailDef mode name argNames body))) ]
719+ JS.Var (JsName.fromLocal name) (codeToExpr (generateTailDef mode name argNames body))
721720
722721
723722generateTailDef :: Mode.Mode -> Name.Name -> [Name.Name] -> Opt.Expr -> Code
@@ -850,7 +849,7 @@ generateDecider mode label root decisionTree =
850849
851850 Opt.Chain testChain success failure ->
852851 [ JS.IfStmt
853− (List.foldl1' (JS.Infix JS.OpLAnd) (map (generateIfTest mode root) testChain))
852+ (List.foldl1' (JS.Infix JS.OpAnd) (map (generateIfTest mode root) testChain))
854853 (JS.Block $ generateDecider mode label root success)
855854 (JS.Block $ generateDecider mode label root failure)
856855 ]
@@ -892,7 +891,7 @@ generateIfTest mode root (path, test) =
892891 value
893892
894893 DT.IsBool False ->
895− JS.Prefix JS.PrefixLNot value
894+ JS.Prefix JS.PrefixNot value
896895
897896 DT.IsInt int ->
898897 strictEq value (JS.Int int)
@@ -910,7 +909,7 @@ generateIfTest mode root (path, test) =
910909 JS.Access value (JsName.fromLocal "b")
911910
912911 DT.IsNil ->
913− JS.Prefix JS.PrefixLNot $
912+ JS.Prefix JS.PrefixNot $
914913 JS.Access value (JsName.fromLocal "b")
915914
916915 DT.IsTuple ->