From 3246845f905360312692ffb4f90a6fc4adc01eb9 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 6 Dec 2023 11:38:21 +0800 Subject: [PATCH] Undo --- shared/src/main/scala/mlscript/JSBackend.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 34bc41c76..10f9b81a2 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -201,7 +201,12 @@ abstract class JSBackend(allowUnresolvedSymbols: Bool) { case NoCases => if (isQuoted) L(createASTCall("NoCases", Nil)) else R(NoCases) } - private def toJSOperator(op: Str) = op.takeWhile(_ =/= '.') + private def toJSOperator(op: Str) = op match { + case "+." => "+" + case "-." => "-" + case "*." => "*" + case _ => op + } // * Desugar `Quoted` into AST constructor invokations. // * e.g., `42 will be translated into Quoted(IntLit(42)),