Make record extension more concise.
This commit is contained in:
parent
d0dad209a4
commit
ea8ff3835e
1 changed files with 1 additions and 3 deletions
|
@ -182,9 +182,7 @@ recordToJS e cmds =
|
|||
, ret "r" ]) ++ "()"
|
||||
|
||||
addField (x,e) = ((++add) . assign "v") `liftM` toJS' e
|
||||
where add = concat [ "\nif ('", x, "' in r) {"
|
||||
, "\n r.", x, " = [v].concat(r.", x, ");"
|
||||
, "\n} else { r.", x, " = [v]; }" ]
|
||||
where add = concat [ "\n r.", x, " = '", x, "' in r ? [v].concat(r.", x, ") : [v];" ]
|
||||
setField (x,e) = do
|
||||
let rx = "r." ++ x
|
||||
set <- globalAssign (rx ++ "[0]") `liftM` toJS' e
|
||||
|
|
Loading…
Reference in a new issue