boa icon indicating copy to clipboard operation
boa copied to clipboard

Move syntax errors from the compiler to the parser

Open raskad opened this issue 2 years ago • 2 comments

Currently we have some syntax errors that are being thrown in the compiler. They should be already be thrown in the parser.

The best case to search for them is to look for throw_syntax_error and construct_syntax_error in boa_engine/src/bytecompiler.rs. There may be state that must be added during the parsing for all of the errors to be moved to the parsing phase.

After this is fixed, Context::compile should not need to return a Result anymore.

raskad avatar Mar 07 '22 18:03 raskad

After #2027, what's missing here?

Razican avatar Jun 01 '22 13:06 Razican

There are still some syntax errors in the bytecompiler left:

  • Check for undeclared labels at parse time to avoid this
  • Check if continue statements occur within a loop to avoid this
  • Check if break statements occur within loop or switch to avoid this
  • Check for invalid left-had-side in assignments (all others)

raskad avatar Jun 02 '22 01:06 raskad