Reparse indices after attaching here docs (fixes #2846)
This commit is contained in:
parent
f2729f73cb
commit
a9e7bf1950
|
@ -516,6 +516,9 @@ prop_hereDocsAreParsedWithoutTrailingLinefeed = 1044 `elem` result
|
|||
where
|
||||
result = check "cat << eof"
|
||||
|
||||
prop_hereDocsWillHaveParsedIndices = null result
|
||||
where
|
||||
result = check "#!/bin/bash\nmy_array=(a b)\ncat <<EOF >> ./test\n $(( 1 + my_array[1] ))\nEOF"
|
||||
|
||||
return []
|
||||
runTests = $quickCheckAll
|
||||
|
|
|
@ -3339,7 +3339,8 @@ readScriptFile sourced = do
|
|||
verifyEof
|
||||
let script = T_Annotation annotationId annotations $
|
||||
T_Script id shebang commands
|
||||
reparseIndices script
|
||||
userstate <- getState
|
||||
reparseIndices $ reattachHereDocs script (hereDocMap userstate)
|
||||
else do
|
||||
many anyChar
|
||||
id <- endSpan start
|
||||
|
@ -3487,8 +3488,7 @@ parseShell env name contents = do
|
|||
return newParseResult {
|
||||
prComments = map toPositionedComment $ nub $ parseNotes userstate ++ parseProblems state,
|
||||
prTokenPositions = Map.map startEndPosToPos (positionMap userstate),
|
||||
prRoot = Just $
|
||||
reattachHereDocs script (hereDocMap userstate)
|
||||
prRoot = Just script
|
||||
}
|
||||
Left err -> do
|
||||
let context = contextStack state
|
||||
|
|
Loading…
Reference in New Issue