sjbarag / brs

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

fix(rsg): Ensure hostNode set in <function> implementation #618

Closed sjbarag closed 3 years ago

sjbarag commented 3 years ago

When a function is executed via callFunc(name, ...args), we were accidentally losing the hostNode because we use interpreter.inSubEnv with the optional second parameter to pass in a custom environment. That environment is based on the prototype-like environment created for each component's definition, which can't include an accurate hostnode based on runtime control flow. Manually set a hostNode when calling functions via callFunc.

fixes #585