mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-07 21:41:34 -07:00
Expose token positions in params, use that to construct fixes
This commit is contained in:
parent
41613babd9
commit
4a87d2a3de
5 changed files with 59 additions and 49 deletions
|
@ -81,7 +81,8 @@ data Parameters = Parameters {
|
|||
parentMap :: Map.Map Id Token, -- A map from Id to parent Token
|
||||
shellType :: Shell, -- The shell type, such as Bash or Ksh
|
||||
shellTypeSpecified :: Bool, -- True if shell type was forced via flags
|
||||
rootNode :: Token -- The root node of the AST
|
||||
rootNode :: Token, -- The root node of the AST
|
||||
tokenPositions :: Map.Map Id (Position, Position) -- map from token id to start and end position
|
||||
}
|
||||
|
||||
-- TODO: Cache results of common AST ops here
|
||||
|
@ -177,7 +178,8 @@ makeParameters spec =
|
|||
|
||||
shellTypeSpecified = isJust $ asShellType spec,
|
||||
parentMap = getParentTree root,
|
||||
variableFlow = getVariableFlow params root
|
||||
variableFlow = getVariableFlow params root,
|
||||
tokenPositions = asTokenPositions spec
|
||||
} in params
|
||||
where root = asScript spec
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue