ChakraCore icon indicating copy to clipboard operation
ChakraCore copied to clipboard

Throw `ERRBadAwait` instead of `ERRnoSemic` if applicable

Open ShortDevelopment opened this issue 2 years ago • 2 comments

Issue

It might happen that a developer forgets to declare a function as async but still uses await as a keyword. In this case the CC parser will just display a ERRnoSemic as seen in #5103.

Changes

According to the proposal of @rhuanjl in https://github.com/chakra-core/ChakraCore/issues/5103#issuecomment-612573281 the parser now checks if the previous token was a tkID equal to await. In that case the parser throws a ERRBadAwait.


Fixes #5103

ShortDevelopment avatar Oct 05 '23 10:10 ShortDevelopment

Thanks for the contribution, it would be nice to see this changed.

Unfortunately the test fails look legitimate to me, (as in this appears to have introduced a new bug) if you can work out what's gone wrong that would be great, if not I'll try and investigate on Monday or Tuesday.

rhuanjl avatar Oct 07 '23 15:10 rhuanjl

@rhuanjl Comparing the CI output of a PR with "no code" and mine it seems like the failing tests might be unrelated to the changes in this PR

  • https://cirrus-ci.com/task/6543904518963200
  • https://cirrus-ci.com/task/6730463671222272

Both failed with

Total: passed 1382, failed 630

ShortDevelopment avatar Nov 10 '23 14:11 ShortDevelopment

@rhuanjl Comparing the CI output of a PR with "no code" and mine it seems like the failing tests might be unrelated to the changes in this PR

  • https://cirrus-ci.com/task/6543904518963200
  • https://cirrus-ci.com/task/6730463671222272

Both failed with

Total: passed 1382, failed 630

Seems you were right, CI is sorted now, this PR looks good though I'd ideally not like to introduce the TS comments to our codebase.

rhuanjl avatar Apr 16 '24 17:04 rhuanjl

@rhuanjl Comments are removed

Seems you were right, CI is sorted now

It's still a bit scary to have CI failing randomly

ShortDevelopment avatar Apr 16 '24 17:04 ShortDevelopment

@rhuanjl Comments are removed

Seems you were right, CI is sorted now

It's still a bit scary to have CI failing randomly

I think it was an issue ages ago that's been fixed in the meantime...

I'll gain additional confidence of that if it passes again now having already passed once before you removed the comments.

rhuanjl avatar Apr 16 '24 17:04 rhuanjl