mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 21:41:34 -07:00
Fix issue #1724
(bash: missing support for 'builtin' keyword) Now shellcheck looks for the arguments to 'builtin' to determine read/written variables. A change in the parser makes sure that assignments are parsed correctly in commands that start with 'builtin'.
This commit is contained in:
parent
60f75e5b8a
commit
0e0de94045
4 changed files with 14 additions and 2 deletions
|
@ -246,6 +246,10 @@ addParseNote n = do
|
|||
parseNotes = n : parseNotes state
|
||||
}
|
||||
|
||||
ignoreProblemsOf p = do
|
||||
systemState <- lift . lift $ Ms.get
|
||||
p <* (lift . lift . Ms.put $ systemState)
|
||||
|
||||
shouldIgnoreCode code = do
|
||||
context <- getCurrentContexts
|
||||
checkSourced <- Mr.asks checkSourced
|
||||
|
@ -2041,7 +2045,11 @@ readSimpleCommand = called "simple command" $ do
|
|||
|
||||
Just cmd -> do
|
||||
validateCommand cmd
|
||||
suffix <- option [] $ getParser readCmdSuffix cmd [
|
||||
-- We have to ignore possible parsing problems from the lookAhead parser
|
||||
firstArgument <- ignoreProblemsOf . optionMaybe . try . lookAhead $ readCmdWord
|
||||
suffix <- option [] $ getParser readCmdSuffix
|
||||
-- If `export` or other modifier commands are called with `builtin` we have to look at the first argument
|
||||
(if isCommand ["builtin"] cmd && isJust firstArgument then fromJust firstArgument else cmd) [
|
||||
(["declare", "export", "local", "readonly", "typeset"], readModifierSuffix),
|
||||
(["time"], readTimeSuffix),
|
||||
(["let"], readLetSuffix),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue