What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
This pr addresses #88 and potentially #42. Overall this adds better support for global that are from from a parent script.
for example this should resolve correctly now
// main.ks
runPath("lib.ks").
global x is 10.
printX().
// lib.ks
function printX {
print(x).
} // ^--- can now find this x
This pr does appear to reduce the overall performance of the server somewhat as global resolution is now more complicated. A potentially next steps is do some initial graph search of all dependencies / dependents for symbols and have a pre computed lookup from there.
Other points that will need to be address
Determine behaviors when two global symbols have the same name
Warning using of a global symbol being available when certain script runs it. Say /boot/setup.ks has some global such as global debug is true. Currently if we can find it in any connected script we say we've resolved it
Global usages. Currently we only find usages in the current script. We may need to report something to the user
for example this should resolve correctly now
This pr does appear to reduce the overall performance of the server somewhat as global resolution is now more complicated. A potentially next steps is do some initial graph search of all dependencies / dependents for symbols and have a pre computed lookup from there.
Other points that will need to be address
/boot/setup.ks
has some global such asglobal debug is true
. Currently if we can find it in any connected script we say we've resolved it