git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Do not show file name in pattern match errors.

Show the module name instead.

commit43623fe356f2455a4aa01139153c0b2df73a632e authornicodelpiano <ndel314@gmail.com> dateThu 23 Jul 2015, 15:06 (11 years ago) parentc813b84
2 files changed+7−3
src/Language/PureScript/AST/SourcePos.hs+6−2 src/Language/PureScript/CodeGen/JS.hs+1−1
src/Language/PureScript/AST/SourcePos.hs+6−2
@@ -57,11 +57,15 @@ data SourceSpan = SourceSpan
5757 , spanEnd :: SourcePos
5858 } deriving (Eq, Ord, Show, D.Data, D.Typeable)
5959
60+displayStartEndPos :: SourceSpan -> String
61+displayStartEndPos sp =
62+ displaySourcePos (spanStart sp) ++ " - " ++
63+ displaySourcePos (spanEnd sp)
64+
6065displaySourceSpan :: SourceSpan -> String
6166displaySourceSpan sp =
6267 spanName sp ++ " " ++
63− displaySourcePos (spanStart sp) ++ " - " ++
64− displaySourcePos (spanEnd sp)
68+ displayStartEndPos sp
6569
6670instance A.ToJSON SourceSpan where
6771 toJSON SourceSpan{..} =
src/Language/PureScript/CodeGen/JS.hs+1−1
@@ -274,7 +274,7 @@ moduleToJs (Module coms mn imps exps foreigns decls) foreign = do
274274 failedPatternError names = JSUnary JSNew $ JSApp (JSVar "Error") [JSBinary Add (JSStringLiteral errorMessage) (JSArrayLiteral $ zipWith valueError names vals)]
275275
276276 errorMessage :: String
277− errorMessage = "Failed pattern match" ++ maybe "" ((" at " ++) . displaySourceSpan) maybeSpan ++ ": "
277+ errorMessage = "Failed pattern match" ++ maybe "" (((" at " ++ runModuleName mn ++ " ") ++) . displayStartEndPos) maybeSpan ++ ": "
278278
279279 valueError :: String -> JS -> JS
280280 valueError _ l@(JSNumericLiteral _) = l