From 1c6804f82b84687c83bfb84d10ebb60c777eaaa4 Mon Sep 17 00:00:00 2001 From: memoryruins Date: Tue, 14 Jul 2020 09:44:54 -0400 Subject: [PATCH] wrap js case clauses in brackets to prevent conflicting declarations --- src/Compiler/ES/ES.idr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler/ES/ES.idr b/src/Compiler/ES/ES.idr index 9d5b7f4f5..0bf308728 100644 --- a/src/Compiler/ES/ES.idr +++ b/src/Compiler/ES/ES.idr @@ -383,8 +383,8 @@ mutual pure $ nSpaces indent ++ "while(true){\n" ++ !(imperative2es (indent+1) x) ++ "\n" ++ nSpaces indent ++ "}" alt2es : {auto d : Ref Ctxt Defs} -> {auto c : Ref ESs ESSt} -> Nat -> (ImperativeExp, ImperativeStatement) -> Core String - alt2es indent (e, b) = pure $ nSpaces indent ++ "case " ++ !(impExp2es e) ++ ":\n" ++ - !(imperative2es (indent+1) b) ++ "\n" ++ nSpaces (indent+1) ++ "break;\n" + alt2es indent (e, b) = pure $ nSpaces indent ++ "case " ++ !(impExp2es e) ++ ": {\n" ++ + !(imperative2es (indent+1) b) ++ "\n" ++ nSpaces (indent+1) ++ "break; }\n" static_preamble : List String static_preamble =