mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-28 00:07:03 +08:00
Allow parsing arbitrary coproc names (fixes #3048)
This commit is contained in:
@@ -668,10 +668,18 @@ build t = do
|
||||
status <- newNodeRange $ CFSetExitCode id
|
||||
linkRange cond status
|
||||
|
||||
T_CoProc id maybeName t -> do
|
||||
let name = fromMaybe "COPROC" maybeName
|
||||
T_CoProc id maybeNameToken t -> do
|
||||
-- If unspecified, "COPROC". If not a constant string, Nothing.
|
||||
let maybeName = case maybeNameToken of
|
||||
Just x -> getLiteralString x
|
||||
Nothing -> Just "COPROC"
|
||||
|
||||
let parentNode = case maybeName of
|
||||
Just str -> applySingle $ IdTagged id $ CFWriteVariable str CFValueArray
|
||||
Nothing -> CFStructuralNode
|
||||
|
||||
start <- newStructuralNode
|
||||
parent <- newNodeRange $ applySingle $ IdTagged id $ CFWriteVariable name CFValueArray
|
||||
parent <- newNodeRange parentNode
|
||||
child <- subshell id "coproc" $ build t
|
||||
end <- newNodeRange $ CFSetExitCode id
|
||||
|
||||
|
Reference in New Issue
Block a user