Hey all. I am running into a weird issue where a const is not transpiled properly
lets say I have 2 files:
helper.bs and map.bs
map.bs looks as follows
namespace name.space
enum someEnum
one = "val1"
two = "val2"
three = "val3"
end enum
const map = {
"key1": someEnum.one,
"key2": someEnum.two,
"key3": someEnum.three
}
end namespace
helper.bs and looks as follows
import "map.bs"
namespace name.space
class someClass
public function someFunc(key as dynamic) as object
return name.space.map[key]
end function
end class
end namespace
when the code is transpiled to .brs, someFunc() in helper.brs looks as follows
function __name_space_someClass_method_someFunc(key as dynamic) as object
return ({
"key1": someEnum.one,
"key2": someEnum.two,
"key3": someEnum.three
})[key]
end function
where the someEnum values are not being properly replaced. This results in a crash when the code is running as we are attempting to use a dot operator on an invalid/uninitialized object.
If i move the contents of the map.bs file to helper.bs, it transpiles properly.
Hey all. I am running into a weird issue where a const is not transpiled properly
lets say I have 2 files:
helper.bs and map.bs
map.bs looks as follows
helper.bs and looks as follows
when the code is transpiled to .brs, someFunc() in helper.brs looks as follows
where the someEnum values are not being properly replaced. This results in a crash when the code is running as we are attempting to use a dot operator on an invalid/uninitialized object.
If i move the contents of the map.bs file to helper.bs, it transpiles properly.