-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
A pattern we have been using is to retrieve a value from a remote configuration, but fallback to a local constant if the remote value isn't defined.
For example:
url = m.config?.serviceUrls?.imageService ?? CommonConfigConst.imageServiceUrl
where CommonConfigConst.imageServiceUrl is defined as
namespace CommonConfigConst
const imageServiceUrl = "https://<some server>/"
end namespace
The transpiler converts that to
url = (function(CommonConfigConst, m)
__bsConsequent = m.config?.serviceUrls?.imageService
if __bsConsequent <> invalid then
return __bsConsequent
else
return "https://i<some server>/"
end if
end function)(CommonConfigConst, m)
When the channel is side loaded, we see a warning in the console:
BRIGHTSCRIPT: WARNING: unused variable 'commonconfigconst' in anonymous function in /<path to code>/ImageService.bs:62
It seems that the transpiler is inlining the constant, but treating the namespace as a variable.
Metadata
Metadata
Assignees
Labels
No labels