Closed mylovesaber closed 1 month ago
Thanks for the report!
You're right that this is not supported.
The reason is that local
variables set by the calling function is runtime behavior and can't be tracked reliably in the editor (using static analysis).
If f4
needs input from f1
, then I suggest to use arguments. Just like in your first example.
For example, if you call f4
directly and not f1
, then the variable is undefined.
I think it's better to show a warning because local
is not meant to be used like a global variable, as fas as I understand Bash.
#!/bin/bash
f1() {
local bb
bb=3
f4
}
f4() {
echo "bb=${bb}"
}
f4 # <-- this would print "bb=" because bb is undefined at runtime
I'm closing this now as I don't think that it could be supported reliably with BashSupport Pro, but I'm still open for your feedback.
bash support pro(I call it as BSP)
BSP seems only support this type:
None of these type are supported: Directly called subfunction
Indirectly called subfunction