Commit c8bb92f8 authored by Ben Gamari's avatar Ben Gamari

Parser: Only parse code as module if it is named

parent db637506
...@@ -84,8 +84,8 @@ parseString codeString = do ...@@ -84,8 +84,8 @@ parseString codeString = do
flags <- getSessionDynFlags flags <- getSessionDynFlags
let output = runParser flags parserModule codeString let output = runParser flags parserModule codeString
case output of case output of
Parsed {} -> return [Located 1 $ Module codeString] Parsed mod | Just _ <- hsmodName (unLoc mod) -> return [Located 1 $ Module codeString]
Failure {} -> do _ -> do
-- Split input into chunks based on indentation. -- Split input into chunks based on indentation.
let chunks = layoutChunks $ removeComments codeString let chunks = layoutChunks $ removeComments codeString
result <- joinFunctions <$> processChunks [] chunks result <- joinFunctions <$> processChunks [] chunks
......
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