on master help sign in
Fix #527
caf6fe4Evan Czaplicki
compiler/Generate/JavaScript.hs+6−2
@@ -55,7 +55,7 @@ literal lit =
55expression :: Expr -> State Int (Expression ())
55expression :: Expr -> State Int (Expression ())
56expression (A region expr) =
56expression (A region expr) =
57 case expr of
57 case expr of
58− Var (V.Raw x) -> return $ ref x
58+ Var (V.Raw x) -> return $ obj x
59 Literal lit -> return $ literal lit
59 Literal lit -> return $ literal lit
60
60
61 Range lo hi ->
61 Range lo hi ->
@@ -243,7 +243,11 @@ match region mtch =
243 isLiteral p = case p of
243 isLiteral p = case p of
244 Case.Clause (Right _) _ _ -> True
244 Case.Clause (Right _) _ _ -> True
245 _ -> False
245 _ -> False
246+
247+ access name
246− access name = if any isLiteral clauses then ref name else dotSep [name,"ctor"]
248+ | any isLiteral clauses = obj name
249+ | otherwise = dotSep (split name ++ ["ctor"])
250+
247 format isChars e
251 format isChars e
248 | or isChars = InfixExpr () OpAdd e (string "")
252 | or isChars = InfixExpr () OpAdd e (string "")
249 | otherwise = e
253 | otherwise = e