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

Slashes after assignments at the end of files are allowed #3330

Open
dapper-gh opened this issue Sep 30, 2023 · 0 comments · May be fixed by #4047
Open

Slashes after assignments at the end of files are allowed #3330

dapper-gh opened this issue Sep 30, 2023 · 0 comments · May be fixed by #4047
Labels
bug Something isn't working

Comments

@dapper-gh
Copy link

Describe the bug
If code in the form <identifier> <assignment operator> <identifier> "/" <eof> is passed to Boa, the code executes as if the "/" were not present; it should raise a SyntaxError.

This bug does not work if there are characters after the "/", including newlines or spaces. The "/" must be the last character in the input.

To Reproduce
In your shell, assuming GNU coreutils: echo -n 'let a, b; a = b /' > test.js; boa test.js
Note that echo -n is required to avoid a trailing newline.

Expected behavior
This code should throw a SyntaxError. The / character is unexpected and is not valid syntax.

Build environment (please complete the following information):

  • OS: Artix Linux
  • Version: rolling
  • Target triple: x86_64-unknown-linux-gnu
  • Rustc version: rustc 1.72.1 (d5c2e9c34 2023-09-13)

Additional context
This bug works with most if not all of the assignment operators. For example, neither a /= b / nor a += b / raise a SyntaxError despite being invalid JavaScript.

@dapper-gh dapper-gh added the bug Something isn't working label Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant