Add 12 more grammar errors (#47075)

These are the last ones that I know of. They come from calls to
`grammarErrorOnFirstToken`.

Fixes part of #45349
Follow-up to #47067
This commit is contained in:
Nathan Shively-Sanders
2021-12-08 16:54:58 -08:00
committed by GitHub
parent c8f1a874a3
commit a2c7fa2d05
6 changed files with 477 additions and 207 deletions

View File

@@ -19,6 +19,7 @@ class C {
for await (const x of [1,2,3]) {
console.log(x)
}
return null
}
// modifier mistakes
static constructor() { }
@@ -44,6 +45,11 @@ class C {
// other
"constructor" = 16
}
class {
missingName = true
}
class Doubler extends C extends C { }
class Trebler extends C,C,C { }
// #private mistakes
#unrelated
junk.#m
@@ -63,6 +69,20 @@ async class CantAsyncClass {
async const cantAsyncConst = 2
async import 'assert'
async export { CantAsyncClass }
export import 'fs'
export export { C }
function nestedExports() {
export { staticParam }
import 'fs'
export default 12
}
function outerStaticFunction() {
static function staticFunction() { }
}
const noStaticLiteralMethods = {
static m() {
}
}
// rest parameters
function restMustBeLast(...x, y) {
@@ -146,6 +166,11 @@ catch (e) {
const e = 1
console.log(e)
}
try {
throw 20
}
catch (e = 0) {
}
label: for (const x in [1,2,3]) {
label: for (const y in [1,2,3]) {
break label;
@@ -183,3 +208,5 @@ function foo() { new.targe }
const nullaryDynamicImport = import()
const trinaryDynamicImport = import('1', '2', '3')
const spreadDynamicImport = import(...[])
return