boa icon indicating copy to clipboard operation
boa copied to clipboard

Slashes after assignments at the end of files are allowed

Open dapper-gh opened this issue 2 years ago • 0 comments

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 avatar Sep 30 '23 23:09 dapper-gh