Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template strings are not a single expression #787

Closed
ZeeD opened this issue Mar 30, 2023 · 1 comment · Fixed by #788
Closed

template strings are not a single expression #787

ZeeD opened this issue Mar 30, 2023 · 1 comment · Fixed by #788

Comments

@ZeeD
Copy link
Contributor

ZeeD commented Mar 30, 2023

When the template strings are converted to pure brightscript they became a complex expression.
this means that you cannot directly call "methods" attached to strings (like encodeUri()) because it will be applied only to the last segment.

minimal example:

sub s()
    example = `${1}${2}`.encodeUri()
    example = `${1}-`.encodeUri()
end sub

translate to:

sub s()
    example = bslib_toString(1) + bslib_toString(2).encodeUri()
    example = bslib_toString(1) + "-".encodeUri()
end sub

As a workaround, for now, I can just "wrap" the template string with brackets (as in

example = (`...`).encodeUri()

) , but it should be bsc job, IMHO

@TwitchBronBron
Copy link
Member

I completely agree. This should be a very quick fix, I'm working on it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants