mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
feat(linter): check AwaitExpression and YieldExpression in javascript
This commit is contained in:
parent
fa6079a633
commit
040e41240b
4 changed files with 366 additions and 35 deletions
|
|
@ -49,6 +49,8 @@ impl Rule for EarlyErrorJavaScript {
|
|||
AstKind::LogicalExpression(expr) => check_logical_expression(expr, ctx),
|
||||
AstKind::MemberExpression(expr) => check_member_expression(expr, ctx),
|
||||
AstKind::UnaryExpression(expr) => check_unary_expression(expr, node, ctx),
|
||||
AstKind::AwaitExpression(expr) => check_await_expression(expr, node, ctx),
|
||||
AstKind::YieldExpression(expr) => check_yield_expression(expr, node, ctx),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
@ -794,3 +796,34 @@ fn check_unary_expression<'a>(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn is_in_formal_parameters<'a>(node: &AstNode<'a>, ctx: &LintContext<'a>) -> bool {
|
||||
for node_id in ctx.ancestors(node).skip(1) {
|
||||
match ctx.kind(node_id) {
|
||||
AstKind::FormalParameters(_) => return true,
|
||||
AstKind::Program(_) | AstKind::Function(_) | AstKind::ArrowExpression(_) => break,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
#[derive(Debug, Error, Diagnostic)]
|
||||
#[error("{0} expression not allowed in formal parameter")]
|
||||
#[diagnostic()]
|
||||
struct AwaitOrYieldInParameter(
|
||||
&'static str,
|
||||
#[label("{0} expression not allowed in formal parameter")] Span,
|
||||
);
|
||||
|
||||
fn check_await_expression<'a>(expr: &AwaitExpression, node: &AstNode<'a>, ctx: &LintContext<'a>) {
|
||||
if is_in_formal_parameters(node, ctx) {
|
||||
ctx.diagnostic(AwaitOrYieldInParameter("await", expr.span));
|
||||
}
|
||||
}
|
||||
|
||||
fn check_yield_expression<'a>(expr: &YieldExpression, node: &AstNode<'a>, ctx: &LintContext<'a>) {
|
||||
if is_in_formal_parameters(node, ctx) {
|
||||
ctx.diagnostic(AwaitOrYieldInParameter("yield", expr.span));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Babel Summary:
|
||||
AST Parsed : 2051/2069 (99.13%)
|
||||
Positive Passed: 2051/2069 (99.13%)
|
||||
Negative Passed: 1077/1502 (71.70%)
|
||||
Negative Passed: 1095/1502 (72.90%)
|
||||
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"
|
||||
|
|
@ -136,17 +136,9 @@ Expect Syntax Error: "es2015/yield/function-name-function-declaration-inside-gen
|
|||
Expect Syntax Error: "es2015/yield/function-name-generator-expression/input.js"
|
||||
Expect Syntax Error: "es2015/yield/function-name-strict-body/input.js"
|
||||
Expect Syntax Error: "es2015/yield/function-name-strict/input.js"
|
||||
Expect Syntax Error: "es2015/yield/parameter-default-inside-arrow-inside-generator-1/input.js"
|
||||
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-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-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"
|
||||
Expect Syntax Error: "es2016/simple-parameter-list/array-pattern-default/input.js"
|
||||
Expect Syntax Error: "es2016/simple-parameter-list/array-pattern/input.js"
|
||||
Expect Syntax Error: "es2016/simple-parameter-list/arrow-function/input.js"
|
||||
|
|
@ -162,11 +154,6 @@ Expect Syntax Error: "es2016/simple-parameter-list/rest/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"
|
||||
Expect Syntax Error: "es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/input.js"
|
||||
Expect Syntax Error: "es2017/async-functions/await-inside-parameters-of-async-arrow-function/input.js"
|
||||
Expect Syntax Error: "es2017/async-functions/await-inside-parameters-of-nested-arrow-function/input.js"
|
||||
Expect Syntax Error: "es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/input.js"
|
||||
Expect Syntax Error: "es2017/async-functions/await-inside-parameters/input.js"
|
||||
Expect Syntax Error: "es2017/trailing-function-commas/7/input.js"
|
||||
Expect Syntax Error: "es2018/object-rest-spread/24/input.js"
|
||||
Expect Syntax Error: "es2018/object-rest-spread/comma-after-rest/input.js"
|
||||
|
|
@ -188,15 +175,11 @@ Expect Syntax Error: "esprima/es2015-arrow-function/invalid-duplicated-params/in
|
|||
Expect Syntax Error: "esprima/es2015-arrow-function/invalid-param-strict-mode/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-export-declaration/invalid-export-named-default/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-generator/.generator-parameter-binding-property-reserved/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-generator/generator-parameter-invalid-binding-element/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-generator/generator-parameter-invalid-binding-property/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-generator/generator-parameter-invalid-computed-property-name/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-identifier/.invalid_function_wait/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-identifier/invalid_expression_await/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-identifier/invalid_var_await/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-meta-property/invalid-new-target/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-meta-property/unknown-property/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-generator-arrow-default/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-function-declaration/input.js"
|
||||
|
|
@ -214,7 +197,6 @@ Expect Syntax Error: "esprima/es2015-yield/invalid-yield-strict-identifier/input
|
|||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-strict-lexical-declaration/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-strict-rest-parameter/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/invalid-yield-strict-variable-declaration/input.js"
|
||||
Expect Syntax Error: "esprima/es2015-yield/yield-generator-arrow-default/input.js"
|
||||
Expect Syntax Error: "esprima/expression-primary-literal-regular-expression/.migrated_0005/input.js"
|
||||
Expect Syntax Error: "esprima/expression-primary-literal-regular-expression/.migrated_0006/input.js"
|
||||
Expect Syntax Error: "esprima/expression-primary-literal-regular-expression/.u-flag-invalid-range-4-hex/input.js"
|
||||
|
|
@ -3753,6 +3735,42 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es2015/yield/parameter-default-inside-arrow-inside-generator-1/input.js:1:1]
|
||||
1 │ function* fn() {
|
||||
2 │ (x = yield) => {};
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es2015/yield/parameter-default-inside-arrow-inside-generator-2/input.js:1:1]
|
||||
1 │ function* fn() {
|
||||
2 │ (x = 3 + a.b(yield) ** 2) => {};
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es2015/yield/parameter-default-inside-arrow-inside-generator-3/input.js:1:1]
|
||||
1 │ function* fn() {
|
||||
2 │ (x = yield fn) => {};
|
||||
· ────┬───
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es2015/yield/parameter-default-inside-arrow-inside-generator-4/input.js:1:1]
|
||||
1 │ function* fn() {
|
||||
2 │ (a, b = 3, x = yield) => {};
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
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() {
|
||||
|
|
@ -3761,6 +3779,29 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
3 │ }
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es2015/yield/parameter-default-inside-arrow-inside-generator-6/input.js:1:1]
|
||||
1 │ function* fn() {
|
||||
2 │ (x = (yield)) => {};
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es2015/yield/parameter-default-inside-generator-method/input.js:1:1]
|
||||
1 │ ({ *method(x = yield) {} })
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es2015/yield/parameter-default-inside-generator/input.js:1:1]
|
||||
1 │ function* fn(x = yield) {}
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× 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() {
|
||||
|
|
@ -3807,6 +3848,20 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es2015/yield/yield-star-parameter-default-inside-generator/input.js:1:1]
|
||||
1 │ function* fn(x = yield* yield) {}
|
||||
· ──────┬─────
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es2015/yield/yield-star-parameter-default-inside-generator/input.js:1:1]
|
||||
1 │ function* fn(x = yield* yield) {}
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× Unexpected exponentiation expression
|
||||
╭─[es2016/exponentiation-operator/10/input.js:1:1]
|
||||
1 │ -5 ** 6;
|
||||
|
|
@ -4050,12 +4105,55 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
╰────
|
||||
help: Try insert a semicolon here
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[es2017/async-functions/await-inside-arguments-of-async-call-inside-parameters-of-async-arrow-function/input.js:1:1]
|
||||
1 │ async function fn() {
|
||||
2 │ async (x = async(y = await 2)) => {};
|
||||
· ───┬───
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× `await` is only allowed within async functions and at the top levels of modules
|
||||
╭─[es2017/async-functions/await-inside-arrow-expression-disallowed/input.js:1:1]
|
||||
1 │ () => { await x }
|
||||
· ─────
|
||||
╰────
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[es2017/async-functions/await-inside-parameters-of-async-arrow-function/input.js:1:1]
|
||||
1 │ async (x = await 2) => {};
|
||||
· ───┬───
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[es2017/async-functions/await-inside-parameters-of-nested-arrow-function/input.js:1:1]
|
||||
1 │ async function fn() {
|
||||
2 │ (x = await 2) => {};
|
||||
· ───┬───
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[es2017/async-functions/await-inside-parameters-of-nested-async-arrow-function/input.js:1:1]
|
||||
1 │ async function fn() {
|
||||
2 │ async (x = await 2) => {};
|
||||
· ───┬───
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[es2017/async-functions/await-inside-parameters-of-nested-function/input.js:1:1]
|
||||
1 │ async function foo() {
|
||||
2 │ function bar(x = await 2) {}
|
||||
· ───┬───
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× `await` is only allowed within async functions and at the top levels of modules
|
||||
╭─[es2017/async-functions/await-inside-parameters-of-nested-function/input.js:1:1]
|
||||
1 │ async function foo() {
|
||||
|
|
@ -4064,6 +4162,13 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
3 │ }
|
||||
╰────
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[es2017/async-functions/await-inside-parameters/input.js:1:1]
|
||||
1 │ async function fn(x = await 2) {}
|
||||
· ───┬───
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[es2017/async-functions/export-async/input.js:1:1]
|
||||
1 │ export async;
|
||||
|
|
@ -6300,6 +6405,15 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[esprima/es2015-generator/generator-parameter-binding-element/input.js:1:1]
|
||||
1 │ (function*() {
|
||||
2 │ function(x = yield 3) {}
|
||||
· ───┬───
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ })
|
||||
╰────
|
||||
|
||||
× A 'yield' expression is only allowed in a generator body.
|
||||
╭─[esprima/es2015-generator/generator-parameter-binding-element/input.js:1:1]
|
||||
1 │ (function*() {
|
||||
|
|
@ -6308,6 +6422,15 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
3 │ })
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[esprima/es2015-generator/generator-parameter-binding-property/input.js:1:1]
|
||||
1 │ (function*() {
|
||||
2 │ function({x: y = yield 3}) {}
|
||||
· ───┬───
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ })
|
||||
╰────
|
||||
|
||||
× A 'yield' expression is only allowed in a generator body.
|
||||
╭─[esprima/es2015-generator/generator-parameter-binding-property/input.js:1:1]
|
||||
1 │ (function*() {
|
||||
|
|
@ -6316,6 +6439,15 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
3 │ })
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[esprima/es2015-generator/generator-parameter-computed-property-name/input.js:1:1]
|
||||
1 │ (function*() {
|
||||
2 │ function({[yield 3]: y}) {}
|
||||
· ───┬───
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ })
|
||||
╰────
|
||||
|
||||
× A 'yield' expression is only allowed in a generator body.
|
||||
╭─[esprima/es2015-generator/generator-parameter-computed-property-name/input.js:1:1]
|
||||
1 │ (function*() {
|
||||
|
|
@ -6324,6 +6456,33 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
3 │ })
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[esprima/es2015-generator/generator-parameter-invalid-binding-element/input.js:1:1]
|
||||
1 │ (function*() {
|
||||
2 │ function*(x = yield 3) {}
|
||||
· ───┬───
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ })
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[esprima/es2015-generator/generator-parameter-invalid-binding-property/input.js:1:1]
|
||||
1 │ (function*() {
|
||||
2 │ function*({x: y = yield 3}) {}
|
||||
· ───┬───
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ })
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[esprima/es2015-generator/generator-parameter-invalid-computed-property-name/input.js:1:1]
|
||||
1 │ (function*() {
|
||||
2 │ function*({[yield 3]: y}) {}
|
||||
· ───┬───
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ })
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[esprima/es2015-generator/incomplete-yield-delegate/input.js:1:1]
|
||||
1 │ (function*() { yield* })
|
||||
|
|
@ -6673,6 +6832,13 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[esprima/es2015-yield/invalid-yield-generator-arrow-default/input.js:1:1]
|
||||
1 │ function* g() { (x = yield 42) => {} }
|
||||
· ────┬───
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× 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 }
|
||||
|
|
@ -6739,6 +6905,13 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[esprima/es2015-yield/yield-generator-arrow-default/input.js:1:1]
|
||||
1 │ function *g() { (x = yield) => {} }
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× Invalid Character ` `
|
||||
╭─[esprima/expression-primary-array/migrated_0012/input.js:1:1]
|
||||
1 │ \u2163\u2161\u200A
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Test262 Summary:
|
||||
AST Parsed : 44015/44034 (99.96%)
|
||||
Positive Passed: 44015/44034 (99.96%)
|
||||
Negative Passed: 3320/3917 (84.76%)
|
||||
Negative Passed: 3331/3917 (85.04%)
|
||||
Expect Syntax Error: "language/block-scope/syntax/function-declarations/in-statement-position-do-statement-while-expression.js"
|
||||
Expect Syntax Error: "language/block-scope/syntax/function-declarations/in-statement-position-for-statement.js"
|
||||
Expect Syntax Error: "language/block-scope/syntax/function-declarations/in-statement-position-if-expression-statement-else-statement.js"
|
||||
|
|
@ -28,7 +28,6 @@ Expect Syntax Error: "language/expressions/arrow-function/dstr/dflt-ary-ptrn-res
|
|||
Expect Syntax Error: "language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-obj.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/object-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/param-dflt-yield-expr.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/params-duplicate.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/rest-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-1.js"
|
||||
|
|
@ -44,7 +43,6 @@ Expect Syntax Error: "language/expressions/arrow-function/syntax/early-errors/ar
|
|||
Expect Syntax Error: "language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/syntax/early-errors/use-strict-with-non-simple-param.js"
|
||||
Expect Syntax Error: "language/expressions/async-arrow-function/array-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js"
|
||||
Expect Syntax Error: "language/expressions/async-arrow-function/dflt-params-duplicates.js"
|
||||
Expect Syntax Error: "language/expressions/async-arrow-function/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js"
|
||||
|
|
@ -79,8 +77,6 @@ Expect Syntax Error: "language/expressions/async-generator/dstr/named-dflt-ary-p
|
|||
Expect Syntax Error: "language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-obj.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/early-errors-expression-NSPL-with-USD.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/early-errors-expression-await-as-function-binding-identifier.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/early-errors-expression-formals-contains-await-expr.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/early-errors-expression-formals-contains-yield-expr.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/named-array-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/named-dflt-params-duplicates.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/named-dflt-params-rest.js"
|
||||
|
|
@ -181,7 +177,6 @@ Expect Syntax Error: "language/expressions/class/dstr/private-meth-static-ary-pt
|
|||
Expect Syntax Error: "language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-obj.js"
|
||||
Expect Syntax Error: "language/expressions/class/gen-method-param-dflt-yield.js"
|
||||
Expect Syntax Error: "language/expressions/class/gen-method-static/array-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/class/gen-method-static/dflt-params-duplicates.js"
|
||||
Expect Syntax Error: "language/expressions/class/gen-method-static/dflt-params-rest.js"
|
||||
|
|
@ -202,7 +197,6 @@ Expect Syntax Error: "language/expressions/class/method/dflt-params-duplicates.j
|
|||
Expect Syntax Error: "language/expressions/class/method/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/class/method/object-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/class/method/rest-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/class/static-gen-method-param-dflt-yield.js"
|
||||
Expect Syntax Error: "language/expressions/function/array-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/function/dflt-params-duplicates.js"
|
||||
Expect Syntax Error: "language/expressions/function/dflt-params-rest.js"
|
||||
|
|
@ -234,7 +228,6 @@ Expect Syntax Error: "language/expressions/generators/dstr/dflt-ary-ptrn-rest-in
|
|||
Expect Syntax Error: "language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-obj.js"
|
||||
Expect Syntax Error: "language/expressions/generators/object-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/generators/param-dflt-yield.js"
|
||||
Expect Syntax Error: "language/expressions/generators/rest-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/generators/use-strict-with-non-simple-param.js"
|
||||
Expect Syntax Error: "language/expressions/generators/yield-as-generator-expression-binding-identifier.js"
|
||||
|
|
@ -285,7 +278,6 @@ Expect Syntax Error: "language/expressions/object/method-definition/gen-meth-dfl
|
|||
Expect Syntax Error: "language/expressions/object/method-definition/gen-meth-dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/object/method-definition/gen-meth-object-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/object/method-definition/gen-meth-rest-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/object/method-definition/generator-param-init-yield.js"
|
||||
Expect Syntax Error: "language/expressions/object/method-definition/generator-use-strict-with-non-simple-param.js"
|
||||
Expect Syntax Error: "language/expressions/object/method-definition/meth-array-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/object/method-definition/meth-dflt-params-duplicates.js"
|
||||
|
|
@ -434,7 +426,6 @@ Expect Syntax Error: "language/statements/class/dstr/private-meth-static-ary-ptr
|
|||
Expect Syntax Error: "language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/statements/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-obj.js"
|
||||
Expect Syntax Error: "language/statements/class/gen-method-param-dflt-yield.js"
|
||||
Expect Syntax Error: "language/statements/class/gen-method-static/array-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/statements/class/gen-method-static/dflt-params-duplicates.js"
|
||||
Expect Syntax Error: "language/statements/class/gen-method-static/dflt-params-rest.js"
|
||||
|
|
@ -455,7 +446,6 @@ Expect Syntax Error: "language/statements/class/method/dflt-params-duplicates.js
|
|||
Expect Syntax Error: "language/statements/class/method/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/class/method/object-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/statements/class/method/rest-param-strict-body.js"
|
||||
Expect Syntax Error: "language/statements/class/static-gen-method-param-dflt-yield.js"
|
||||
Expect Syntax Error: "language/statements/class/static-init-invalid-await.js"
|
||||
Expect Syntax Error: "language/statements/const/dstr/ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/statements/const/dstr/ary-ptrn-rest-init-id.js"
|
||||
|
|
@ -568,7 +558,6 @@ Expect Syntax Error: "language/statements/generators/dstr/dflt-ary-ptrn-rest-ini
|
|||
Expect Syntax Error: "language/statements/generators/dstr/dflt-ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/statements/generators/dstr/dflt-ary-ptrn-rest-init-obj.js"
|
||||
Expect Syntax Error: "language/statements/generators/object-destructuring-param-strict-body.js"
|
||||
Expect Syntax Error: "language/statements/generators/param-dflt-yield.js"
|
||||
Expect Syntax Error: "language/statements/generators/rest-param-strict-body.js"
|
||||
Expect Syntax Error: "language/statements/generators/use-strict-with-non-simple-param.js"
|
||||
Expect Syntax Error: "language/statements/if/if-decl-else-decl-strict.js"
|
||||
|
|
@ -2737,6 +2726,15 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
· ─
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[language/expressions/arrow-function/param-dflt-yield-expr.js:26:1]
|
||||
26 │ function *g() {
|
||||
27 │ (x = yield) => {};
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
28 │ }
|
||||
╰────
|
||||
|
||||
× The keyword 'yield' is reserved
|
||||
╭─[language/expressions/arrow-function/param-dflt-yield-id-strict.js:20:1]
|
||||
20 │
|
||||
|
|
@ -6030,6 +6028,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js:15:1]
|
||||
15 │
|
||||
16 │ async() => { (a = await/r/g) => {} };
|
||||
· ────┬────
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js:15:1]
|
||||
15 │
|
||||
|
|
@ -6608,6 +6614,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
· ╰── `a` has already been declared here
|
||||
╰────
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[language/expressions/async-generator/early-errors-expression-formals-contains-await-expr.js:16:1]
|
||||
16 │
|
||||
17 │ (async function*(x = await 1) { });
|
||||
· ───┬───
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[language/expressions/async-generator/early-errors-expression-formals-contains-await.js:17:1]
|
||||
17 │
|
||||
|
|
@ -6631,6 +6645,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[language/expressions/async-generator/early-errors-expression-formals-contains-yield-expr.js:16:1]
|
||||
16 │
|
||||
17 │ (async function*(x = yield) { });
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× The keyword 'yield' is reserved
|
||||
╭─[language/expressions/async-generator/early-errors-expression-formals-contains-yield.js:17:1]
|
||||
17 │
|
||||
|
|
@ -12149,6 +12171,15 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
27 │ }
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[language/expressions/class/gen-method-param-dflt-yield.js:25:1]
|
||||
25 │ 0, class {
|
||||
26 │ *g(x = yield) {}
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
27 │ };
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/expressions/class/gen-method-static/rest-params-trailing-comma-early-error.js:80:1]
|
||||
80 │ 0, class {
|
||||
|
|
@ -12419,6 +12450,15 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
77 │
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[language/expressions/class/static-gen-method-param-dflt-yield.js:25:1]
|
||||
25 │ 0, class {
|
||||
26 │ static *g(x = yield) {}
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
27 │ };
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[language/expressions/class/static-init-await-binding.js:20:1]
|
||||
20 │ static {
|
||||
|
|
@ -13957,6 +13997,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
27 │ throw new Test262Error();
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[language/expressions/generators/param-dflt-yield.js:24:1]
|
||||
24 │
|
||||
25 │ 0, function*(x = yield) {};
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/expressions/generators/rest-params-trailing-comma-early-error.js:56:1]
|
||||
56 │
|
||||
|
|
@ -15168,6 +15216,15 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
20 │ });
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[language/expressions/object/method-definition/generator-param-init-yield.js:19:1]
|
||||
19 │ ({
|
||||
20 │ *method(x = yield) {}
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
21 │ });
|
||||
╰────
|
||||
|
||||
× Identifier `a` has already been declared
|
||||
╭─[language/expressions/object/method-definition/generator-param-redecl-const.js:19:1]
|
||||
19 │ var obj = {
|
||||
|
|
@ -19667,6 +19724,15 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js:37:1]
|
||||
37 │
|
||||
38 │ function fn(x = await 1) {
|
||||
· ───┬───
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
39 │ return x;
|
||||
╰────
|
||||
|
||||
× `await` is only allowed within async functions and at the top levels of modules
|
||||
╭─[language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js:37:1]
|
||||
37 │
|
||||
|
|
@ -19683,6 +19749,15 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
30 │ };
|
||||
╰────
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js:27:1]
|
||||
27 │
|
||||
28 │ 0, function (x = await 1) {
|
||||
· ───┬───
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
29 │ return x;
|
||||
╰────
|
||||
|
||||
× `await` is only allowed within async functions and at the top levels of modules
|
||||
╭─[language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js:27:1]
|
||||
27 │
|
||||
|
|
@ -26013,6 +26088,15 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
27 │ }
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[language/statements/class/gen-method-param-dflt-yield.js:25:1]
|
||||
25 │ class C {
|
||||
26 │ *g(x = yield) {}
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
27 │ }
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/statements/class/gen-method-static/rest-params-trailing-comma-early-error.js:78:1]
|
||||
78 │ class C {
|
||||
|
|
@ -26331,6 +26415,15 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
18 │ }
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[language/statements/class/static-gen-method-param-dflt-yield.js:25:1]
|
||||
25 │ class C {
|
||||
26 │ static *g(x = yield) {}
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
27 │ }
|
||||
╰────
|
||||
|
||||
× Cannot use `await` as an identifier in an async context
|
||||
╭─[language/statements/class/static-init-await-binding-invalid.js:23:1]
|
||||
23 │ static {
|
||||
|
|
@ -29134,6 +29227,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
53 │
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[language/statements/generators/param-dflt-yield.js:23:1]
|
||||
23 │
|
||||
24 │ function* g(x = yield) {}
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/statements/generators/rest-params-trailing-comma-early-error.js:56:1]
|
||||
56 │
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
TypeScript Summary:
|
||||
AST Parsed : 2305/2338 (98.59%)
|
||||
Positive Passed: 2305/2338 (98.59%)
|
||||
Negative Passed: 652/2532 (25.75%)
|
||||
Negative Passed: 655/2532 (25.87%)
|
||||
Expect Syntax Error: "Symbols/ES5SymbolProperty2.ts"
|
||||
Expect Syntax Error: "Symbols/ES5SymbolProperty6.ts"
|
||||
Expect Syntax Error: "additionalChecks/noPropertyAccessFromIndexSignature1.ts"
|
||||
|
|
@ -278,7 +278,6 @@ Expect Syntax Error: "decorators/class/method/decoratorOnClassMethod12.ts"
|
|||
Expect Syntax Error: "decorators/class/method/decoratorOnClassMethod6.ts"
|
||||
Expect Syntax Error: "decorators/class/method/decoratorOnClassMethod8.ts"
|
||||
Expect Syntax Error: "decorators/class/method/decoratorOnClassMethodOverload1.ts"
|
||||
Expect Syntax Error: "decorators/class/method/parameter/decoratorOnClassMethodParameter3.ts"
|
||||
Expect Syntax Error: "decorators/class/method/parameter/decoratorOnClassMethodThisParameter.ts"
|
||||
Expect Syntax Error: "decorators/class/property/decoratorOnClassProperty11.ts"
|
||||
Expect Syntax Error: "decorators/class/property/decoratorOnClassProperty6.ts"
|
||||
|
|
@ -548,8 +547,6 @@ Expect Syntax Error: "es6/for-ofStatements/for-of7.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/FunctionDeclaration6_es6.ts"
|
||||
Expect Syntax Error: "es6/functionDeclarations/FunctionDeclaration7_es6.ts"
|
||||
Expect Syntax Error: "es6/functionDeclarations/FunctionDeclaration8_es6.ts"
|
||||
Expect Syntax Error: "es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts"
|
||||
Expect Syntax Error: "es6/memberFunctionDeclarations/MemberFunctionDeclaration3_es6.ts"
|
||||
|
|
@ -4362,6 +4359,15 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
╰────
|
||||
help: Try insert a semicolon here
|
||||
|
||||
× await expression not allowed in formal parameter
|
||||
╭─[decorators/class/method/parameter/decoratorOnClassMethodParameter3.ts:7:1]
|
||||
7 │ class Class {
|
||||
8 │ async method(@dec(await value) arg: number) {}
|
||||
· ─────┬─────
|
||||
· ╰── await expression not allowed in formal parameter
|
||||
9 │ }
|
||||
╰────
|
||||
|
||||
× Automatic Semicolon Insertion
|
||||
╭─[decorators/class/property/decoratorOnClassProperty3.ts:5:1]
|
||||
5 │ class C {
|
||||
|
|
@ -5160,6 +5166,24 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
3 │ }
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es6/functionDeclarations/FunctionDeclaration6_es6.ts:1:1]
|
||||
1 │ // @target: es6
|
||||
2 │ function*foo(a = yield) {
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× yield expression not allowed in formal parameter
|
||||
╭─[es6/functionDeclarations/FunctionDeclaration7_es6.ts:3:1]
|
||||
3 │ // 'yield' here is an identifier, and not a yield expression.
|
||||
4 │ function*foo(a = yield) {
|
||||
· ──┬──
|
||||
· ╰── yield expression not allowed in formal parameter
|
||||
5 │ }
|
||||
╰────
|
||||
|
||||
× Unexpected token
|
||||
╭─[es6/functionPropertyAssignments/FunctionPropertyAssignments2_es6.ts:1:1]
|
||||
1 │ // @target: es6
|
||||
|
|
|
|||
Loading…
Reference in a new issue