on master help sign in
Fix #527

When language-ecmascript upgraded from 0.15 to 0.16 they added more validation of what values are valid variables. This adds in protections to make sure that qualified variables like List.map generate valid JavaScript.

commitcaf6fe480a38ab17c5d4abe14a6156f83a509c24 authorEvan Czaplicki <info@elm-lang.org> dateThu 20 Mar 2014, 12:46 (13 years ago) parent3b3ee15
1 file changed+6−2
compiler/Generate/JavaScript.hs+6−2
compiler/Generate/JavaScript.hs+6−2
@@ -55,7 +55,7 @@ literal lit =
5555expression :: Expr -> State Int (Expression ())
5656expression (A region expr) =
5757 case expr of
58− Var (V.Raw x) -> return $ ref x
58+ Var (V.Raw x) -> return $ obj x
5959 Literal lit -> return $ literal lit
6060
6161 Range lo hi ->
@@ -243,7 +243,11 @@ match region mtch =
243243 isLiteral p = case p of
244244 Case.Clause (Right _) _ _ -> True
245245 _ -> False
246− access name = if any isLiteral clauses then ref name else dotSep [name,"ctor"]
246+
247+ access name
248+ | any isLiteral clauses = obj name
249+ | otherwise = dotSep (split name ++ ["ctor"])
250+
247251 format isChars e
248252 | or isChars = InfixExpr () OpAdd e (string "")
249253 | otherwise = e