sjbarag / brs

An interpreter for the BrightScript language that runs on non-Roku platforms.
MIT License
113 stars 43 forks source link

Missing files in <script/> tags lead to broken scope #579

Open sjbarag opened 3 years ago

sjbarag commented 3 years ago

An XML component definition with a missing file (including an incorrectly-cased filename on case-sensitive filesystems) results in a component scope that's basically empty — even if the missing file appears after ones that do exist.

<component name="Foo">
    <interface>
        <field id="bar" onChange="onBarChanged"/>
    </interface>
    <script type="text/brightscript uri="pkg:/source/Utils.brs"/>
    <script type="text/brightscript" uri="./Foo.brs"/>
</component>

Even if source/Utils.brs exists, the absense of Foo.brs will lead to the following error message:

WARNING: "onBarChanged" was not found in scope

That error message isn't very helpful, so let's fix that while we're in the neighborhood 😃