IncludeException on using non-recompiled things in scripts recompiled with x_recompile_includes()
Anatoliy057 opened this issue ยท 2 comments
Using non-recompiled procedures and variables in recompiled scripts throws IncludeException
Examples:
# test.ms
console(_test())
# main.ms
proc _test() {
console('test')
}
x_recompile_includes('test.ms')
include('test.ms')
ms.lang.IncludeException: There was a compile error when trying to recompile the script at C:\Users\A-y57\Dev\minecraft\plugins\CommandHelper\test.ms
Procedure cannot be resolved: _test :: test.ms:1
at <<main code>>:C:\Users\A-y57\Dev\minecraft\plugins\CommandHelper\main.ms:4.2
# test.ms
console(@test)
# main.ms
@test = 'test'
x_recompile_includes('test.ms')
include('test.ms')
ms.lang.IncludeException: There was a compile error when trying to recompile the script at C:\Users\A-y57\Dev\minecraft\plugins\CommandHelper\test.ms
Variable cannot be resolved: @test :: test.ms:1
at <<main code>>:C:\Users\A-y57\Dev\minecraft\plugins\CommandHelper\main.ms:2.2
If remove include('test.ms')
nothing thrown
Also, using non-recompiled things in recompiled procedures does not throw an exception.
Yes, it appears x_recompile_includes() does not support static analysis yet. I recommend not using that function until it is, or disabling static analysis.
It should be noted that I stuck that function in Sandbox intentionally. It's conceptually a temporary workaround for a long term problem that we are trying to solve in other ways as well. I'm not surprised static analysis support wasn't added to it.