-
If a closure captures a variable but also defines a variable of the same name in its root scope the shadowed flag would, sometimes, not be appropriately applied to the captured variable. This change: 1. sorts the variable list by depth *and* declaration line, so that closure captured variables always appear before other root-scope variables, regardless of the order used by the compiler 2. marks variable with the same name as shadowed even if there is only one scope at play. This fixes the problem but as a side effect: 1. programs compiled with Go prior to version 1.9 will have the shadowed flag applied arbitrarily (previously the shadowed flag was not applied at all) 2. programs compiled with Go prior to versoin 1.11 will still exhibit the bug, as they do not have DeclLine information. Fixes #1672
e9940473