rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
162 stars 46 forks source link

Missing ? in final optional chaining transpiled output #770

Closed TwitchBronBron closed 1 year ago

TwitchBronBron commented 1 year ago

image

Notice how the final ? is missing in visible.ither

tomek-r commented 1 year ago

hey @TwitchBronBron

m?.something?.something = false

is illegal syntax. It would mean you can assign false to Invalid value. This will trigger a crash on roku box.

Instead, this should show an error and highlight in red.

https://developer.roku.com/en-gb/docs/references/brightscript/language/expressions-variables-types.md#optional-chaining-operators

x = array?[12]          ' Supported
array?[12] = x          ' Not supported
x = f?()                      ' Supported
f?()                            ' Not supported
TwitchBronBron commented 1 year ago

@tomek-r #782 will resolve your request to flag the invalid syntax.