mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(ast_parser): check await and yield identifier error
This commit is contained in:
parent
577a86edce
commit
93b06e948a
6 changed files with 1834 additions and 121 deletions
|
|
@ -60,25 +60,11 @@ impl Rule for EarlyErrorJavaScript {
|
|||
struct ReservedKeyword(Atom, #[label] Span);
|
||||
|
||||
fn check_identifier<'a>(name: &Atom, span: Span, node: &AstNode<'a>, ctx: &LintContext<'a>) {
|
||||
// if span.ctx.has_ambient() {
|
||||
// return None;
|
||||
// }
|
||||
|
||||
// It is a Syntax Error if this production has an [Await] parameter.
|
||||
// if *name == "await" && span.ctx.has_await() {
|
||||
// return Some(Diagnostic::IdentifierAsync("await", span.range()));
|
||||
// }
|
||||
|
||||
// It is a Syntax Error if the goal symbol of the syntactic grammar is Module and the StringValue of IdentifierName is "await".
|
||||
if *name == "await" && ctx.source_type().is_module() {
|
||||
return ctx.diagnostic(ReservedKeyword(name.clone(), span));
|
||||
}
|
||||
|
||||
// It is a Syntax Error if this production has a [Yield] parameter.
|
||||
// if *name == "yield" && span.ctx.has_yield() {
|
||||
// return Some(Diagnostic::IdentifierGenerator("yield", span.range()));
|
||||
// }
|
||||
|
||||
// It is a Syntax Error if this phrase is contained in strict mode code and the StringValue of IdentifierName is: "implements", "interface", "let", "package", "private", "protected", "public", "static", or "yield".
|
||||
if ctx.strict_mode(node) && STRICT_MODE_NAMES.contains(name.as_str()) {
|
||||
ctx.diagnostic(ReservedKeyword(name.clone(), span));
|
||||
|
|
|
|||
|
|
@ -426,12 +426,12 @@ pub struct ConstructorAsync(#[label("Constructor can't be an async method")] pub
|
|||
#[derive(Debug, Error, Diagnostic)]
|
||||
#[error("Cannot use `{0}` as an identifier in an async context")]
|
||||
#[diagnostic()]
|
||||
pub struct IdentifierAsync(&'static str, #[label("{0} cannot be used here")] pub Span);
|
||||
pub struct IdentifierAsync(pub &'static str, #[label] pub Span);
|
||||
|
||||
#[derive(Debug, Error, Diagnostic)]
|
||||
#[error("Cannot use `{0}` as an identifier in a generator context")]
|
||||
#[diagnostic()]
|
||||
pub struct IdentifierGenerator(&'static str, #[label("{0} cannot be used here")] pub Span);
|
||||
pub struct IdentifierGenerator(pub &'static str, #[label] pub Span);
|
||||
|
||||
#[derive(Debug, Error, Diagnostic)]
|
||||
#[error("Constructor can't be a generator")]
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ impl<'a> Parser<'a> {
|
|||
return self.unexpected();
|
||||
}
|
||||
let (span, name) = self.parse_identifier_kind(Kind::Ident);
|
||||
self.check_identifier(span, &name);
|
||||
Ok(IdentifierReference { span, name })
|
||||
}
|
||||
|
||||
|
|
@ -69,6 +70,7 @@ impl<'a> Parser<'a> {
|
|||
return self.unexpected();
|
||||
}
|
||||
let (span, name) = self.parse_identifier_kind(Kind::Ident);
|
||||
self.check_identifier(span, &name);
|
||||
Ok(BindingIdentifier { span, name })
|
||||
}
|
||||
|
||||
|
|
@ -77,6 +79,7 @@ impl<'a> Parser<'a> {
|
|||
return self.unexpected();
|
||||
}
|
||||
let (span, name) = self.parse_identifier_kind(Kind::Ident);
|
||||
self.check_identifier(span, &name);
|
||||
Ok(LabelIdentifier { span, name })
|
||||
}
|
||||
|
||||
|
|
@ -104,6 +107,17 @@ impl<'a> Parser<'a> {
|
|||
(self.end_span(span), name)
|
||||
}
|
||||
|
||||
fn check_identifier(&mut self, span: Span, name: &Atom) {
|
||||
// It is a Syntax Error if this production has an [Await] parameter.
|
||||
if *name == "await" && self.ctx.has_await() {
|
||||
self.error(diagnostics::IdentifierAsync("await", span));
|
||||
}
|
||||
// It is a Syntax Error if this production has a [Yield] parameter.
|
||||
if *name == "yield" && self.ctx.has_yield() {
|
||||
self.error(diagnostics::IdentifierGenerator("yield", span));
|
||||
}
|
||||
}
|
||||
|
||||
/// Section `https://tc39.es/ecma262/#prod-PrivateIdentifier`
|
||||
/// `PrivateIdentifier` ::
|
||||
/// # `IdentifierName`
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Babel Summary:
|
||||
AST Parsed : 2053/2069 (99.23%)
|
||||
Positive Passed: 2053/2069 (99.23%)
|
||||
Negative Passed: 1043/1502 (69.44%)
|
||||
Negative Passed: 1059/1502 (70.51%)
|
||||
Expect Syntax Error: "annex-b/disabled/1.1-html-comments-close/input.js"
|
||||
Expect Syntax Error: "annex-b/disabled/3.1-sloppy-labeled-functions-if-body/input.js"
|
||||
Expect Syntax Error: "annex-b/disabled/3.1-sloppy-labeled-functions-multiple-labels/input.js"
|
||||
|
|
@ -145,16 +145,10 @@ Expect Syntax Error: "es2015/yield/parameter-default-inside-arrow-inside-generat
|
|||
Expect Syntax Error: "es2015/yield/parameter-default-inside-arrow-inside-generator-2/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-default-inside-arrow-inside-generator-3/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-default-inside-arrow-inside-generator-4/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-default-inside-arrow-inside-generator-5/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-default-inside-arrow-inside-generator-6/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-default-inside-generator-method/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-default-inside-generator/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-default-strict/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-name-arrow-inside-generator-1/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-name-arrow-inside-generator-3/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-name-arrow-no-parens-inside-generator/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-name-generator-method/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-name-generator/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-name-strict-body/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-name-strict/input.js"
|
||||
Expect Syntax Error: "es2015/yield/yield-star-parameter-default-inside-generator/input.js"
|
||||
|
|
@ -172,7 +166,6 @@ Expect Syntax Error: "es2016/simple-parameter-list/object-pattern/input.js"
|
|||
Expect Syntax Error: "es2016/simple-parameter-list/rest/input.js"
|
||||
Expect Syntax Error: "es2017/async-functions/9/input.js"
|
||||
Expect Syntax Error: "es2017/async-functions/allow-await-outside-function-throw/input.js"
|
||||
Expect Syntax Error: "es2017/async-functions/async-await-as-arrow-binding-identifier/input.js"
|
||||
Expect Syntax Error: "es2017/async-functions/await-async-function-expression-name/input.js"
|
||||
Expect Syntax Error: "es2017/async-functions/await-binding-inside-arrow-params-inside-async-arrow-params/input.js"
|
||||
Expect Syntax Error: "es2017/async-functions/await-function-declaration-name-inside-async-function/input.js"
|
||||
|
|
@ -220,20 +213,11 @@ Expect Syntax Error: "esprima/es2015-meta-property/unknown-property/input.js"
|
|||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-binding-property/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-expression/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-arrow-default/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-arrow-parameter/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-arrow-parameters/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-catch/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-declaration/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-expression-name/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-expression-parameter/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-expression-rest/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-function-declaration/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-lexical-declaration/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-parameter/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-rest/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-strict-function-expression/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-strict-function-parameter/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-variable-declaration/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-strict-array-pattern/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-strict-arrow-parameter-default/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-strict-arrow-parameter-name/input.js"
|
||||
|
|
@ -3525,6 +3509,12 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[es2015/uncategorised/359/input.js:1:1]
|
||||
1 │ const await = foo();
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× The keyword 'await' is reserved
|
||||
╭─[es2015/uncategorised/361/input.js:1:1]
|
||||
1 │ const { await } = foo();
|
||||
|
|
@ -3549,6 +3539,12 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[es2015/uncategorised/367/input.js:1:1]
|
||||
1 │ class await {}
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[es2015/uncategorised/368/input.js:1:1]
|
||||
1 │ enum = foo();
|
||||
|
|
@ -3727,6 +3723,22 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
3 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[es2015/yield/parameter-default-inside-arrow-inside-generator-5/input.js:1:1]
|
||||
1 │ function* fn() {
|
||||
2 │ (x = (yield) => {}) => {};
|
||||
· ─────
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[es2015/yield/parameter-name-arrow-inside-generator-1/input.js:1:1]
|
||||
1 │ function* fn() {
|
||||
2 │ (yield) => {};
|
||||
· ─────
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× Automatic Semicolon Insertion
|
||||
╭─[es2015/yield/parameter-name-arrow-inside-generator-2/input.js:1:1]
|
||||
1 │ function* fn() {
|
||||
|
|
@ -3737,6 +3749,34 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
╰────
|
||||
help: Try insert a semicolon here
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[es2015/yield/parameter-name-arrow-inside-generator-3/input.js:1:1]
|
||||
1 │ function* fn() {
|
||||
2 │ (a, b, yield) => {};
|
||||
· ─────
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[es2015/yield/parameter-name-arrow-no-parens-inside-generator/input.js:1:1]
|
||||
1 │ function* fn() {
|
||||
2 │ yield => {};
|
||||
· ─────
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[es2015/yield/parameter-name-generator-method/input.js:1:1]
|
||||
1 │ ({ *method(yield) {} });
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[es2015/yield/parameter-name-generator/input.js:1:1]
|
||||
1 │ function* fn(yield) {}
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Unexpected exponentiation expression
|
||||
╭─[es2016/exponentiation-operator/10/input.js:1:1]
|
||||
1 │ -5 ** 6;
|
||||
|
|
@ -3952,6 +3992,12 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
╰────
|
||||
help: Try insert a semicolon here
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[es2017/async-functions/async-await-as-arrow-binding-identifier/input.js:1:1]
|
||||
1 │ async await => {}
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Automatic Semicolon Insertion
|
||||
╭─[es2017/async-functions/async-function-and-non-bmp-character/input.js:1:1]
|
||||
1 │ async function𝐬 f() {}
|
||||
|
|
@ -6521,18 +6567,72 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
· ╰── Unterminated string
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-arrow-parameter/input.js:1:1]
|
||||
1 │ function *g(){ (yield) => 42 }
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-arrow-parameters/input.js:1:1]
|
||||
1 │ function *g(){ (a, b, c, yield) => 42 }
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-catch/input.js:1:1]
|
||||
1 │ function *g() { try {} catch (yield) {} }
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× The keyword 'yield' is reserved
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-export-default/input.js:1:1]
|
||||
1 │ export default function *yield() {}
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-expression-parameter/input.js:1:1]
|
||||
1 │ (function *(yield){})
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-expression-rest/input.js:1:1]
|
||||
1 │ (function *(x, ...yield){})
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-lexical-declaration/input.js:1:1]
|
||||
1 │ function *g() { let yield; }
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-member-expression/input.js:1:1]
|
||||
1 │ function *g() { return yield.x; }
|
||||
· ─
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-parameter/input.js:1:1]
|
||||
1 │ function *g(yield){}
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-rest/input.js:1:1]
|
||||
1 │ function *g(a, b, c, ...yield){}
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-variable-declaration/input.js:1:1]
|
||||
1 │ function *g() { var yield; }
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Invalid Character ` `
|
||||
╭─[esprima/expression-primary-array/migrated_0012/input.js:1:1]
|
||||
1 │ \u2163\u2161\u200A
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +1,7 @@
|
|||
TypeScript Summary:
|
||||
AST Parsed : 2305/2338 (98.59%)
|
||||
Positive Passed: 2305/2338 (98.59%)
|
||||
Negative Passed: 620/2532 (24.49%)
|
||||
Negative Passed: 635/2532 (25.08%)
|
||||
Expect Syntax Error: "Symbols/ES5SymbolProperty2.ts"
|
||||
Expect Syntax Error: "Symbols/ES5SymbolProperty6.ts"
|
||||
Expect Syntax Error: "additionalChecks/noPropertyAccessFromIndexSignature1.ts"
|
||||
|
|
@ -11,24 +11,18 @@ Expect Syntax Error: "ambient/ambientExternalModuleInsideNonAmbient.ts"
|
|||
Expect Syntax Error: "ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts"
|
||||
Expect Syntax Error: "async/es2017/asyncArrowFunction/asyncArrowFunction10_es2017.ts"
|
||||
Expect Syntax Error: "async/es2017/asyncArrowFunction/asyncArrowFunction3_es2017.ts"
|
||||
Expect Syntax Error: "async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts"
|
||||
Expect Syntax Error: "async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts"
|
||||
Expect Syntax Error: "async/es2017/asyncArrowFunction/asyncArrowFunction_allowJs.ts"
|
||||
Expect Syntax Error: "async/es2017/asyncAwaitIsolatedModules_es2017.ts"
|
||||
Expect Syntax Error: "async/es2017/await_incorrectThisType.ts"
|
||||
Expect Syntax Error: "async/es2017/await_unaryExpression_es2017_1.ts"
|
||||
Expect Syntax Error: "async/es2017/await_unaryExpression_es2017_2.ts"
|
||||
Expect Syntax Error: "async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts"
|
||||
Expect Syntax Error: "async/es2017/functionDeclarations/asyncFunctionDeclaration12_es2017.ts"
|
||||
Expect Syntax Error: "async/es2017/functionDeclarations/asyncFunctionDeclaration13_es2017.ts"
|
||||
Expect Syntax Error: "async/es2017/functionDeclarations/asyncFunctionDeclaration3_es2017.ts"
|
||||
Expect Syntax Error: "async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts"
|
||||
Expect Syntax Error: "async/es2017/functionDeclarations/asyncFunctionDeclaration8_es2017.ts"
|
||||
Expect Syntax Error: "async/es5/asyncAliasReturnType_es5.ts"
|
||||
Expect Syntax Error: "async/es5/asyncArrowFunction/asyncArrowFunction10_es5.ts"
|
||||
Expect Syntax Error: "async/es5/asyncArrowFunction/asyncArrowFunction3_es5.ts"
|
||||
Expect Syntax Error: "async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts"
|
||||
Expect Syntax Error: "async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts"
|
||||
Expect Syntax Error: "async/es5/asyncArrowFunction/asyncArrowFunctionCapturesArguments_es5.ts"
|
||||
Expect Syntax Error: "async/es5/asyncAwaitIsolatedModules_es5.ts"
|
||||
Expect Syntax Error: "async/es5/asyncClass_es5.ts"
|
||||
|
|
@ -36,18 +30,14 @@ Expect Syntax Error: "async/es5/asyncDeclare_es5.ts"
|
|||
Expect Syntax Error: "async/es5/asyncEnum_es5.ts"
|
||||
Expect Syntax Error: "async/es5/asyncInterface_es5.ts"
|
||||
Expect Syntax Error: "async/es5/asyncModule_es5.ts"
|
||||
Expect Syntax Error: "async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts"
|
||||
Expect Syntax Error: "async/es5/functionDeclarations/asyncFunctionDeclaration12_es5.ts"
|
||||
Expect Syntax Error: "async/es5/functionDeclarations/asyncFunctionDeclaration13_es5.ts"
|
||||
Expect Syntax Error: "async/es5/functionDeclarations/asyncFunctionDeclaration15_es5.ts"
|
||||
Expect Syntax Error: "async/es5/functionDeclarations/asyncFunctionDeclaration3_es5.ts"
|
||||
Expect Syntax Error: "async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts"
|
||||
Expect Syntax Error: "async/es5/functionDeclarations/asyncFunctionDeclaration8_es5.ts"
|
||||
Expect Syntax Error: "async/es5/functionDeclarations/asyncFunctionDeclarationCapturesArguments_es5.ts"
|
||||
Expect Syntax Error: "async/es6/asyncArrowFunction/asyncArrowFunction10_es6.ts"
|
||||
Expect Syntax Error: "async/es6/asyncArrowFunction/asyncArrowFunction3_es6.ts"
|
||||
Expect Syntax Error: "async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts"
|
||||
Expect Syntax Error: "async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts"
|
||||
Expect Syntax Error: "async/es6/asyncAwaitIsolatedModules_es6.ts"
|
||||
Expect Syntax Error: "async/es6/asyncClass_es6.ts"
|
||||
Expect Syntax Error: "async/es6/asyncDeclare_es6.ts"
|
||||
|
|
@ -57,14 +47,11 @@ Expect Syntax Error: "async/es6/asyncModule_es6.ts"
|
|||
Expect Syntax Error: "async/es6/asyncQualifiedReturnType_es6.ts"
|
||||
Expect Syntax Error: "async/es6/await_unaryExpression_es6_1.ts"
|
||||
Expect Syntax Error: "async/es6/await_unaryExpression_es6_2.ts"
|
||||
Expect Syntax Error: "async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts"
|
||||
Expect Syntax Error: "async/es6/functionDeclarations/asyncFunctionDeclaration12_es6.ts"
|
||||
Expect Syntax Error: "async/es6/functionDeclarations/asyncFunctionDeclaration13_es6.ts"
|
||||
Expect Syntax Error: "async/es6/functionDeclarations/asyncFunctionDeclaration15_es6.ts"
|
||||
Expect Syntax Error: "async/es6/functionDeclarations/asyncFunctionDeclaration3_es6.ts"
|
||||
Expect Syntax Error: "async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts"
|
||||
Expect Syntax Error: "async/es6/functionDeclarations/asyncFunctionDeclaration8_es6.ts"
|
||||
Expect Syntax Error: "async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts"
|
||||
Expect Syntax Error: "classes/awaitAndYieldInProperty.ts"
|
||||
Expect Syntax Error: "classes/classDeclarations/classAbstractKeyword/classAbstractAccessor.ts"
|
||||
Expect Syntax Error: "classes/classDeclarations/classAbstractKeyword/classAbstractAssignabilityConstructorFunction.ts"
|
||||
|
|
@ -562,11 +549,9 @@ Expect Syntax Error: "es6/for-ofStatements/for-of48.ts"
|
|||
Expect Syntax Error: "es6/for-ofStatements/for-of55.ts"
|
||||
Expect Syntax Error: "es6/for-ofStatements/for-of6.ts"
|
||||
Expect Syntax Error: "es6/for-ofStatements/for-of7.ts"
|
||||
Expect Syntax Error: "es6/functionDeclarations/FunctionDeclaration10_es6.ts"
|
||||
Expect Syntax Error: "es6/functionDeclarations/FunctionDeclaration12_es6.ts"
|
||||
Expect Syntax Error: "es6/functionDeclarations/FunctionDeclaration13_es6.ts"
|
||||
Expect Syntax Error: "es6/functionDeclarations/FunctionDeclaration3_es6.ts"
|
||||
Expect Syntax Error: "es6/functionDeclarations/FunctionDeclaration5_es6.ts"
|
||||
Expect Syntax Error: "es6/functionDeclarations/FunctionDeclaration6_es6.ts"
|
||||
Expect Syntax Error: "es6/functionDeclarations/FunctionDeclaration7_es6.ts"
|
||||
Expect Syntax Error: "es6/functionDeclarations/FunctionDeclaration8_es6.ts"
|
||||
|
|
@ -2178,6 +2163,13 @@ Expect to Parse: "externalModules/topLevelAwait.2.ts"
|
|||
× The keyword 'await' is reserved
|
||||
╭─[externalModules/topLevelAwait.2.ts:6:1]
|
||||
6 │ // await allowed in import=namespace when not a module
|
||||
7 │ import await = foo.await;
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[externalModules/topLevelAwait.2.ts:6:1]
|
||||
6 │ // await allowed in import=namespace when not a module
|
||||
7 │ import await = foo.await;
|
||||
· ─────
|
||||
╰────
|
||||
|
|
@ -2258,6 +2250,14 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
· ────
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts:3:1]
|
||||
3 │
|
||||
4 │ var foo = async (await): Promise<void> => {
|
||||
· ─────
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
× Automatic Semicolon Insertion
|
||||
╭─[async/es2017/asyncArrowFunction/asyncArrowFunction6_es2017.ts:3:1]
|
||||
3 │
|
||||
|
|
@ -2284,6 +2284,14 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
6 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts:2:1]
|
||||
2 │ // @noEmitHelpers: true
|
||||
3 │ var foo = async (a = await => await): Promise<void> => {
|
||||
· ─────
|
||||
4 │ }
|
||||
╰────
|
||||
|
||||
× Invalid assignment
|
||||
╭─[async/es2017/await_unaryExpression_es2017_3.ts:3:1]
|
||||
3 │ async function bar1() {
|
||||
|
|
@ -2293,6 +2301,22 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
5 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es2017/functionDeclarations/asyncFunctionDeclaration10_es2017.ts:2:1]
|
||||
2 │ // @noEmitHelpers: true
|
||||
3 │ async function foo(a = await => await): Promise<void> {
|
||||
· ─────
|
||||
4 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es2017/functionDeclarations/asyncFunctionDeclaration5_es2017.ts:2:1]
|
||||
2 │ // @noEmitHelpers: true
|
||||
3 │ async function foo(await): Promise<void> {
|
||||
· ─────
|
||||
4 │ }
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[async/es2017/functionDeclarations/asyncFunctionDeclaration6_es2017.ts:2:1]
|
||||
2 │ // @noEmitHelpers: true
|
||||
|
|
@ -2317,6 +2341,14 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
5 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts:4:1]
|
||||
4 │
|
||||
5 │ var foo = async (await): Promise<void> => {
|
||||
· ─────
|
||||
6 │ }
|
||||
╰────
|
||||
|
||||
× Automatic Semicolon Insertion
|
||||
╭─[async/es5/asyncArrowFunction/asyncArrowFunction6_es5.ts:4:1]
|
||||
4 │
|
||||
|
|
@ -2343,6 +2375,14 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
7 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts:3:1]
|
||||
3 │ // @noEmitHelpers: true
|
||||
4 │ var foo = async (a = await => await): Promise<void> => {
|
||||
· ─────
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
× Constructor can't be an async method
|
||||
╭─[async/es5/asyncConstructor_es5.ts:4:1]
|
||||
4 │ class C {
|
||||
|
|
@ -2370,6 +2410,22 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
6 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es5/functionDeclarations/asyncFunctionDeclaration10_es5.ts:3:1]
|
||||
3 │ // @noEmitHelpers: true
|
||||
4 │ async function foo(a = await => await): Promise<void> {
|
||||
· ─────
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es5/functionDeclarations/asyncFunctionDeclaration5_es5.ts:3:1]
|
||||
3 │ // @noEmitHelpers: true
|
||||
4 │ async function foo(await): Promise<void> {
|
||||
· ─────
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[async/es5/functionDeclarations/asyncFunctionDeclaration6_es5.ts:3:1]
|
||||
3 │ // @noEmitHelpers: true
|
||||
|
|
@ -2394,6 +2450,14 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
6 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts:3:1]
|
||||
3 │
|
||||
4 │ var foo = async (await): Promise<void> => {
|
||||
· ─────
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
× Automatic Semicolon Insertion
|
||||
╭─[async/es6/asyncArrowFunction/asyncArrowFunction6_es6.ts:3:1]
|
||||
3 │
|
||||
|
|
@ -2420,6 +2484,14 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
6 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts:2:1]
|
||||
2 │ // @noEmitHelpers: true
|
||||
3 │ var foo = async (a = await => await): Promise<void> => {
|
||||
· ─────
|
||||
4 │ }
|
||||
╰────
|
||||
|
||||
× Constructor can't be an async method
|
||||
╭─[async/es6/asyncConstructor_es6.ts:3:1]
|
||||
3 │ class C {
|
||||
|
|
@ -2456,6 +2528,22 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
5 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es6/functionDeclarations/asyncFunctionDeclaration10_es6.ts:2:1]
|
||||
2 │ // @noEmitHelpers: true
|
||||
3 │ async function foo(a = await => await): Promise<void> {
|
||||
· ─────
|
||||
4 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es6/functionDeclarations/asyncFunctionDeclaration5_es6.ts:2:1]
|
||||
2 │ // @noEmitHelpers: true
|
||||
3 │ async function foo(await): Promise<void> {
|
||||
· ─────
|
||||
4 │ }
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[async/es6/functionDeclarations/asyncFunctionDeclaration6_es6.ts:2:1]
|
||||
2 │ // @noEmitHelpers: true
|
||||
|
|
@ -2480,6 +2568,54 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
5 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts:15:1]
|
||||
15 │ async function f2_let () {
|
||||
16 │ let await = 1
|
||||
· ─────
|
||||
17 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts:19:1]
|
||||
19 │ async function f2_var () {
|
||||
20 │ var await = 1
|
||||
· ─────
|
||||
21 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts:23:1]
|
||||
23 │ async function f2_const () {
|
||||
24 │ const await = 1
|
||||
· ─────
|
||||
25 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts:39:1]
|
||||
39 │ function * f4_let () {
|
||||
40 │ let yield = 2;
|
||||
· ─────
|
||||
41 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts:43:1]
|
||||
43 │ function * f4_var () {
|
||||
44 │ var yield = 2;
|
||||
· ─────
|
||||
45 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[async/es6/functionDeclarations/asyncOrYieldAsBindingIdentifier1.ts:47:1]
|
||||
47 │ function * f4_const () {
|
||||
48 │ const yield = 2;
|
||||
· ─────
|
||||
49 │ }
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[classes/classDeclarations/classAbstractKeyword/classAbstractCrashedOnce.ts:7:1]
|
||||
7 │ this.
|
||||
|
|
@ -2639,6 +2775,30 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
3 │ // something
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[classes/classStaticBlock/classStaticBlock22.ts:5:1]
|
||||
5 │ static {
|
||||
6 │ let await: any; // illegal, cannot declare a new binding for await
|
||||
· ─────
|
||||
7 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[classes/classStaticBlock/classStaticBlock22.ts:14:1]
|
||||
14 │ static {
|
||||
15 │ let await; // illegal, cannot declare a new binding for await
|
||||
· ─────
|
||||
16 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[classes/classStaticBlock/classStaticBlock22.ts:20:1]
|
||||
20 │ static {
|
||||
21 │ class await { }; // illegal
|
||||
· ─────
|
||||
22 │ }
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[classes/classStaticBlock/classStaticBlock22.ts:26:1]
|
||||
26 │ await = 1; // legal
|
||||
|
|
@ -2655,6 +2815,14 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
6 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[classes/classStaticBlock/classStaticBlock6.ts:6:1]
|
||||
6 │ static {
|
||||
7 │ let await = 1;
|
||||
· ─────
|
||||
8 │ let arguments = 1;
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[classes/classStaticBlock/classStaticBlock6.ts:12:1]
|
||||
12 │ static {
|
||||
|
|
@ -4919,6 +5087,22 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
4 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[es6/functionDeclarations/FunctionDeclaration10_es6.ts:1:1]
|
||||
1 │ // @target: es6
|
||||
2 │ function * foo(a = yield => yield) {
|
||||
· ─────
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[es6/functionDeclarations/FunctionDeclaration5_es6.ts:1:1]
|
||||
1 │ // @target: es6
|
||||
2 │ function*foo(yield) {
|
||||
· ─────
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[es6/functionPropertyAssignments/FunctionPropertyAssignments2_es6.ts:1:1]
|
||||
1 │ // @target: es6
|
||||
|
|
@ -7810,6 +7994,13 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
× The keyword 'await' is reserved
|
||||
╭─[externalModules/topLevelAwaitErrors.12.ts:7:1]
|
||||
7 │ // await disallowed in import=namespace when in a module
|
||||
8 │ import await = foo.await;
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[externalModules/topLevelAwaitErrors.12.ts:7:1]
|
||||
7 │ // await disallowed in import=namespace when in a module
|
||||
8 │ import await = foo.await;
|
||||
· ─────
|
||||
╰────
|
||||
|
|
@ -7817,6 +8008,13 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
× The keyword 'await' is reserved
|
||||
╭─[externalModules/topLevelAwaitErrors.2.ts:6:1]
|
||||
6 │ // reparse variable name as await should fail
|
||||
7 │ var await = 1;
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[externalModules/topLevelAwaitErrors.2.ts:6:1]
|
||||
6 │ // reparse variable name as await should fail
|
||||
7 │ var await = 1;
|
||||
· ─────
|
||||
╰────
|
||||
|
|
@ -7831,6 +8029,13 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
× The keyword 'await' is reserved
|
||||
╭─[externalModules/topLevelAwaitErrors.4.ts:6:1]
|
||||
6 │ // reparse binding pattern as await should fail
|
||||
7 │ var [await] = [1];
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[externalModules/topLevelAwaitErrors.4.ts:6:1]
|
||||
6 │ // reparse binding pattern as await should fail
|
||||
7 │ var [await] = [1];
|
||||
· ─────
|
||||
╰────
|
||||
|
|
@ -7838,6 +8043,14 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
× The keyword 'await' is reserved
|
||||
╭─[externalModules/topLevelAwaitErrors.5.ts:4:1]
|
||||
4 │ // await in exported class name should fail
|
||||
5 │ export class await {
|
||||
· ─────
|
||||
6 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[externalModules/topLevelAwaitErrors.5.ts:4:1]
|
||||
4 │ // await in exported class name should fail
|
||||
5 │ export class await {
|
||||
· ─────
|
||||
6 │ }
|
||||
|
|
@ -10241,6 +10454,22 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
39 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[salsa/plainJSBinderErrors.ts:9:1]
|
||||
9 │ async function f() {
|
||||
10 │ const await = 3
|
||||
· ─────
|
||||
11 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `yield` as an identifier in a generator context
|
||||
╭─[salsa/plainJSBinderErrors.ts:12:1]
|
||||
12 │ function* g() {
|
||||
13 │ const yield = 4
|
||||
· ─────
|
||||
14 │ }
|
||||
╰────
|
||||
|
||||
× Classes can't have an element named '#constructor'
|
||||
╭─[salsa/plainJSBinderErrors.ts:15:1]
|
||||
15 │ class C {
|
||||
|
|
|
|||
Loading…
Reference in a new issue