Skip to content

handle local variables in functions inside "mark occurrences" #242

@de-jcup

Description

@de-jcup

Situation

#!/bin/bash 

function startMe() {
    local data
    echo "hello world" >> $data
    
    echo "xx:$data"

}

startMe

data cannot be marked - local variables in functions are currently not recognized

Wanted

local xyz and also
local xyz=... shall be recognized as local variables

These local variables shall only be marked inside the function!

Solution

  • if not already done keep "isLocal" flag inside BashVariable. So we know if its a local variable or not
  • introduce a getFunction():BashFunction method. For global variables this will return null
  • getUsages() for a local variable may only return the usages inside the function - this can be done by not iterating over the complete tokens, but only those inside the function (this information should be already available)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions