Commit 252abd9e authored by simonmar's avatar simonmar

[project @ 2004-09-07 12:30:27 by simonmar]

Fix up the SrcSpan on the rhs of a function binding.
parent 6a56f3ba
......@@ -941,7 +941,7 @@ deriving :: { Located (Maybe [LHsType RdrName]) }
decl :: { Located (OrdList (LHsDecl RdrName)) }
: sigdecl { $1 }
| infixexp opt_sig rhs {% do { r <- checkValDef $1 $2 (unLoc $3);
| infixexp opt_sig rhs {% do { r <- checkValDef $1 $2 $3;
return (LL $ unitOL (LL $ ValD r)) } }
rhs :: { Located (GRHSs RdrName) }
......
......@@ -762,17 +762,16 @@ patFail loc = parseError loc "Parse error in pattern"
checkValDef
:: LHsExpr RdrName
-> Maybe (LHsType RdrName)
-> GRHSs RdrName
-> Located (GRHSs RdrName)
-> P (HsBind RdrName)
checkValDef lhs opt_sig grhss
checkValDef lhs opt_sig (L rhs_span grhss)
| Just (f,inf,es) <- isFunLhs lhs []
= if isQual (unLoc f)
then parseError (getLoc f) ("Qualified name in function definition: " ++
showRdrName (unLoc f))
else do ps <- checkPatterns es
return (FunBind f inf [L (getLoc f) (Match ps opt_sig grhss)])
-- TODO: span is wrong
return (FunBind f inf [L rhs_span (Match ps opt_sig grhss)])
| otherwise = do
lhs <- checkPattern lhs
return (PatBind lhs grhss)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment