summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-12-18 21:39:09 +0000
committerGravatar Joey Hess <joey@kitenet.net>2013-12-18 21:39:09 +0000
commit696c355a7008fb6f8912dba4327ff152cbf05d02 (patch)
tree4e484e205b3220ec84a99e6487fe5b93d573cf3a /Build
parent76a26745c2b022b4eee06a982958e71b27568959 (diff)
improve EvilSplicer robustness
Diffstat (limited to 'Build')
-rw-r--r--Build/EvilSplicer.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Build/EvilSplicer.hs b/Build/EvilSplicer.hs
index 35dba4968..63edc86b9 100644
--- a/Build/EvilSplicer.hs
+++ b/Build/EvilSplicer.hs
@@ -362,13 +362,16 @@ mangleCode = flip_colon
- StaticR
- yesod_dispatch_env_a4iDV
- (\ p_a4iE2 r_a4iE3
- - -> r_a4iE3 {Network.Wai.pathInfo = p_a4iE2}
+ - -> r_a4iE3
+ - {Network.Wai.pathInfo = p_a4iE2}
- xrest_a4iDT req_a4iDW)) }
-
- Need to add another paren around the lambda, and close it
- before its parameters. lambdaparens misses this one because
- there is already one paren present.
-
+ - Note that the { } may be on the same line, or wrapped to next.
+ -
- FIXME: This is a hack. lambdaparens could just always add a
- layer of parens even when a lambda seems to be in parent.
-}
@@ -384,11 +387,16 @@ mangleCode = flip_colon
string indent
lambdaarrow <- string " ->"
l2 <- restofline
+ l3 <- if '{' `elem` l2 && '}' `elem` l2
+ then return ""
+ else do
+ string indent
+ restofline
return $ unlines
[ indent ++ staticr
, indent ++ yesod_dispatch_env
, indent ++ "(" ++ lambdaprefix ++ l1
- , indent ++ lambdaarrow ++ l2 ++ ")"
+ , indent ++ lambdaarrow ++ l2 ++ l3 ++ ")"
]
restofline = manyTill (noneOf "\n") newline