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

Using as object in a function signature causes parse failure #102

Closed
sjbarag opened this issue Dec 4, 2018 · 1 comment · Fixed by #103
Closed

Using as object in a function signature causes parse failure #102

sjbarag opened this issue Dec 4, 2018 · 1 comment · Fixed by #103
Assignees
Labels
bug Any difference between this BrightScript implementation and RBI, or otherwise unexpected behavior parser Affects this project's token parser

Comments

@sjbarag
Copy link
Owner

sjbarag commented Dec 4, 2018

The Reference BrightScript Implementation allows as object to be used as a type suffix for function arguments and function returns, but it currently causes a parse failure here:

Failing file:

sub Main()
    test(invalid)
end sub

sub test(foo as object)
    print "if you can read this, the bug has been fixed"
end sub

Main()

Failed output:

$ brs ./object-mwe.brs
[Line 5] Function parameter [object Object] is of invalid type 'object'
[Line 7] Found unexpected token 'end sub'
Error occurred
@sjbarag
Copy link
Owner Author

sjbarag commented Dec 4, 2018

Looks like there's another bug in reporting that error – [object Object] is a bit of JavaScript object leakage.

@sjbarag sjbarag added bug Any difference between this BrightScript implementation and RBI, or otherwise unexpected behavior parser Affects this project's token parser e2e Affects this project's end-to-end test cases (the BrightScript sample files executed during testing) and removed e2e Affects this project's end-to-end test cases (the BrightScript sample files executed during testing) labels Dec 4, 2018
@sjbarag sjbarag self-assigned this Dec 4, 2018
sjbarag added a commit that referenced this issue Dec 5, 2018
`as object` is basically the same as `as dynamic`, except that `as
object` automatically boxes primitive numbers before passing them into
the function.  Since we don't have support for boxed numbers yet, we can
ignore that for now.

closes #102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Any difference between this BrightScript implementation and RBI, or otherwise unexpected behavior parser Affects this project's token parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant