on master help sign in
Make record extension more concise.
commitea8ff3835ea166ce76ec9944c9912892f9184066 authorevancz <info@elm-lang.org> dateWed 30 Jan 2013, 03:56 (14 years ago) parentd0dad20
1 file changed+1−3
elm/src/Gen/CompileToJS.hs+1−3
elm/src/Gen/CompileToJS.hs+1−3
@@ -182,9 +182,7 @@ recordToJS e cmds =
182182 , ret "r" ]) ++ "()"
183183
184184addField (x,e) = ((++add) . assign "v") `liftM` toJS' e
185− where add = concat [ "\nif ('", x, "' in r) {"
186− , "\n r.", x, " = [v].concat(r.", x, ");"
187− , "\n} else { r.", x, " = [v]; }" ]
185+ where add = concat [ "\n r.", x, " = '", x, "' in r ? [v].concat(r.", x, ") : [v];" ]
188186setField (x,e) = do
189187 let rx = "r." ++ x
190188 set <- globalAssign (rx ++ "[0]") `liftM` toJS' e