Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
de-jcup opened this issue Jul 19, 2021 · 0 comments
Open

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

de-jcup opened this issue Jul 19, 2021 · 0 comments

Comments

@de-jcup
Copy link
Owner

de-jcup commented Jul 19, 2021

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)
@de-jcup de-jcup added this to the 2.8.0 milestone Jul 19, 2021
@de-jcup de-jcup modified the milestones: 2.8.0, 2.9.0 Mar 22, 2022
@de-jcup de-jcup modified the milestones: 2.9.0, 2.10.0 Mar 27, 2023
@de-jcup de-jcup modified the milestones: 2.9.1, 2.10.0 Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant