Commit 1eb295c
interp: fix variables scope in functions
Variables declared as exported or readonly in functions
without assignment are not correctly propagated to the
global scope, this snippet should return a `bar: readonly variable`
error:
```
_foo() {
bar=foo
readonly bar
}
_foo
bar=bar
```
This snippet should also export `bar` variable correctly:
```
_foo() {
export bar
}
_foo
bar=foo
env | grep ^bar=
```1 parent 308418e commit 1eb295c
2 files changed
+27
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2303 | 2303 | | |
2304 | 2304 | | |
2305 | 2305 | | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
2306 | 2310 | | |
2307 | 2311 | | |
2308 | 2312 | | |
| |||
2430 | 2434 | | |
2431 | 2435 | | |
2432 | 2436 | | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
2433 | 2449 | | |
2434 | 2450 | | |
2435 | 2451 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
37 | 44 | | |
38 | 45 | | |
39 | 46 | | |
| |||
64 | 71 | | |
65 | 72 | | |
66 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
| |||
0 commit comments