mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 04:42:10 +00:00
feat(linter): check FormalParameter in javascript
This commit is contained in:
parent
f4c8cb2cde
commit
76f7e58036
4 changed files with 298 additions and 38 deletions
|
|
@ -53,6 +53,7 @@ impl Rule for EarlyErrorJavaScript {
|
|||
AstKind::Property(prop) => check_property(prop, ctx),
|
||||
|
||||
AstKind::FormalParameters(params) => check_formal_parameters(params, node, ctx),
|
||||
AstKind::FormalParameter(param) => check_formal_parameter(param, ctx),
|
||||
|
||||
AstKind::ObjectExpression(expr) => check_object_expression(expr, ctx),
|
||||
AstKind::BinaryExpression(expr) => check_binary_expression(expr, ctx),
|
||||
|
|
@ -802,6 +803,22 @@ fn check_formal_parameters<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
fn check_formal_parameter(param: &FormalParameter, ctx: &LintContext) {
|
||||
#[derive(Debug, Error, Diagnostic)]
|
||||
#[error("A rest parameter cannot have an initializer")]
|
||||
#[diagnostic()]
|
||||
struct ARestParameterCannotHaveAnInitializer(#[label] Span);
|
||||
|
||||
match ¶m.pattern.kind {
|
||||
BindingPatternKind::RestElement(pat)
|
||||
if matches!(pat.argument.kind, BindingPatternKind::AssignmentPattern(_)) =>
|
||||
{
|
||||
ctx.diagnostic(ARestParameterCannotHaveAnInitializer(param.span));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn check_object_expression(obj_expr: &ObjectExpression, ctx: &LintContext) {
|
||||
// ObjectLiteral : { PropertyDefinitionList }
|
||||
// It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains any duplicate entries for "__proto__"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Babel Summary:
|
||||
AST Parsed : 2051/2069 (99.13%)
|
||||
Positive Passed: 2051/2069 (99.13%)
|
||||
Negative Passed: 1122/1502 (74.70%)
|
||||
Negative Passed: 1123/1502 (74.77%)
|
||||
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"
|
||||
|
|
@ -250,7 +250,6 @@ Expect Syntax Error: "esprima/invalid-syntax/migrated_0245/input.js"
|
|||
Expect Syntax Error: "esprima/invalid-syntax/migrated_0246/input.js"
|
||||
Expect Syntax Error: "esprima/invalid-syntax/migrated_0247/input.js"
|
||||
Expect Syntax Error: "esprima/invalid-syntax/migrated_0249/input.js"
|
||||
Expect Syntax Error: "esprima/invalid-syntax/migrated_0260/input.js"
|
||||
Expect Syntax Error: "esprima/statement-if/.migrated_0003/input.js"
|
||||
Expect Syntax Error: "esprima/statement-iteration/.migrated_0021/input.js"
|
||||
Expect Syntax Error: "esprima/statement-iteration/.pattern-in-for-in/input.js"
|
||||
|
|
@ -8484,6 +8483,12 @@ Expect to Parse: "typescript/types/const-type-parameters/input.ts"
|
|||
· ╰── Rest element must be last element
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[esprima/invalid-syntax/migrated_0260/input.js:1:1]
|
||||
1 │ function x(...a = 1){}
|
||||
· ────────
|
||||
╰────
|
||||
|
||||
× Expect token
|
||||
╭─[esprima/invalid-syntax/migrated_0261/input.js:1:1]
|
||||
1 │ class
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Test262 Summary:
|
||||
AST Parsed : 44015/44034 (99.96%)
|
||||
Positive Passed: 44015/44034 (99.96%)
|
||||
Negative Passed: 3536/3917 (90.27%)
|
||||
Negative Passed: 3568/3917 (91.09%)
|
||||
Expect Syntax Error: "language/directive-prologue/10.1.1-2gs.js"
|
||||
Expect Syntax Error: "language/directive-prologue/10.1.1-5gs.js"
|
||||
Expect Syntax Error: "language/directive-prologue/10.1.1-8gs.js"
|
||||
|
|
@ -13,17 +13,12 @@ Expect Syntax Error: "language/directive-prologue/func-decl-parse.js"
|
|||
Expect Syntax Error: "language/directive-prologue/func-expr-inside-func-decl-parse.js"
|
||||
Expect Syntax Error: "language/directive-prologue/func-expr-no-semi-parse.js"
|
||||
Expect Syntax Error: "language/directive-prologue/func-expr-parse.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/dstr/ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/dstr/ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/dstr/ary-ptrn-rest-init-obj.js"
|
||||
Expect Syntax Error: "language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-ary.js"
|
||||
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/async-arrow-function/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/async-function/named-dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/async-function/nameless-dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/dstr/ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/dstr/ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/dstr/ary-ptrn-rest-init-obj.js"
|
||||
|
|
@ -37,12 +32,7 @@ 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-id.js"
|
||||
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-await-as-function-binding-identifier.js"
|
||||
Expect Syntax Error: "language/expressions/async-generator/named-dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/await/await-BindingIdentifier-nested.js"
|
||||
Expect Syntax Error: "language/expressions/class/async-gen-method-static/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/class/async-gen-method/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/class/async-method-static/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/class/async-method/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js"
|
||||
|
|
@ -115,11 +105,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-static/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/class/gen-method/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/class/method-static/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/class/method/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/function/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/function/dstr/ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/expressions/function/dstr/ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/expressions/function/dstr/ary-ptrn-rest-init-obj.js"
|
||||
|
|
@ -132,7 +117,6 @@ Expect Syntax Error: "language/expressions/function/param-duplicated-strict-body
|
|||
Expect Syntax Error: "language/expressions/function/param-duplicated-strict-body-2.js"
|
||||
Expect Syntax Error: "language/expressions/function/param-duplicated-strict-body-3.js"
|
||||
Expect Syntax Error: "language/expressions/function/param-eval-strict-body.js"
|
||||
Expect Syntax Error: "language/expressions/generators/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/generators/dstr/ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/expressions/generators/dstr/ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/expressions/generators/dstr/ary-ptrn-rest-init-obj.js"
|
||||
|
|
@ -169,10 +153,6 @@ Expect Syntax Error: "language/expressions/object/identifier-shorthand-protected
|
|||
Expect Syntax Error: "language/expressions/object/identifier-shorthand-public-invalid-strict-mode.js"
|
||||
Expect Syntax Error: "language/expressions/object/identifier-shorthand-static-invalid-strict-mode.js"
|
||||
Expect Syntax Error: "language/expressions/object/identifier-shorthand-yield-invalid-strict-mode.js"
|
||||
Expect Syntax Error: "language/expressions/object/method-definition/async-gen-meth-dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/object/method-definition/async-meth-dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/object/method-definition/gen-meth-dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/object/method-definition/meth-dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/expressions/object/setter-body-strict-inside.js"
|
||||
Expect Syntax Error: "language/expressions/object/setter-param-arguments-strict-inside.js"
|
||||
Expect Syntax Error: "language/expressions/object/setter-param-eval-strict-inside.js"
|
||||
|
|
@ -200,18 +180,12 @@ Expect Syntax Error: "language/module-code/early-dup-export-star-as-dflt.js"
|
|||
Expect Syntax Error: "language/module-code/early-export-global.js"
|
||||
Expect Syntax Error: "language/module-code/early-export-unresolvable.js"
|
||||
Expect Syntax Error: "language/module-code/early-new-target.js"
|
||||
Expect Syntax Error: "language/statements/async-function/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/async-generator/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/async-generator/dstr/ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/statements/async-generator/dstr/ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/statements/async-generator/dstr/ary-ptrn-rest-init-obj.js"
|
||||
Expect Syntax Error: "language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/statements/async-generator/dstr/dflt-ary-ptrn-rest-init-obj.js"
|
||||
Expect Syntax Error: "language/statements/class/async-gen-method-static/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/class/async-gen-method/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/class/async-method-static/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/class/async-method/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/statements/class/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js"
|
||||
|
|
@ -284,10 +258,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-static/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/class/gen-method/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/class/method-static/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/class/method/dflt-params-rest.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"
|
||||
|
|
@ -346,7 +316,6 @@ Expect Syntax Error: "language/statements/for/dstr/let-ary-ptrn-rest-init-obj.js
|
|||
Expect Syntax Error: "language/statements/for/dstr/var-ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/statements/for/dstr/var-ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/statements/for/dstr/var-ary-ptrn-rest-init-obj.js"
|
||||
Expect Syntax Error: "language/statements/function/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/function/dstr/ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/statements/function/dstr/ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/statements/function/dstr/ary-ptrn-rest-init-obj.js"
|
||||
|
|
@ -363,7 +332,6 @@ Expect Syntax Error: "language/statements/function/param-duplicated-strict-body-
|
|||
Expect Syntax Error: "language/statements/function/param-duplicated-strict-body-3.js"
|
||||
Expect Syntax Error: "language/statements/function/param-eval-strict-body.js"
|
||||
Expect Syntax Error: "language/statements/function/static-init-await-binding-invalid.js"
|
||||
Expect Syntax Error: "language/statements/generators/dflt-params-rest.js"
|
||||
Expect Syntax Error: "language/statements/generators/dstr/ary-ptrn-rest-init-ary.js"
|
||||
Expect Syntax Error: "language/statements/generators/dstr/ary-ptrn-rest-init-id.js"
|
||||
Expect Syntax Error: "language/statements/generators/dstr/ary-ptrn-rest-init-obj.js"
|
||||
|
|
@ -2215,6 +2183,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
59 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/arrow-function/dflt-params-rest.js:61:1]
|
||||
61 │
|
||||
62 │ 0, (...x = []) => {
|
||||
· ─────────
|
||||
63 │
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-ary.js:51:1]
|
||||
51 │ var f;
|
||||
|
|
@ -6058,6 +6034,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
51 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/async-arrow-function/dflt-params-rest.js:53:1]
|
||||
53 │
|
||||
54 │ (async (...x = []) => {
|
||||
· ─────────
|
||||
55 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js:15:1]
|
||||
15 │
|
||||
|
|
@ -6425,6 +6409,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
37 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/async-function/named-dflt-params-rest.js:39:1]
|
||||
39 │
|
||||
40 │ (async function f(...x = []) {
|
||||
· ─────────
|
||||
41 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/async-function/named-object-destructuring-param-strict-body.js:107:1]
|
||||
107 │ (async function f({property}) {
|
||||
|
|
@ -6468,6 +6460,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
37 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/async-function/nameless-dflt-params-rest.js:39:1]
|
||||
39 │
|
||||
40 │ (async function(...x = []) {
|
||||
· ─────────
|
||||
41 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/async-function/nameless-object-destructuring-param-strict-body.js:107:1]
|
||||
107 │ (async function({property}) {
|
||||
|
|
@ -6577,6 +6577,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
40 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/async-generator/dflt-params-rest.js:42:1]
|
||||
42 │
|
||||
43 │ 0, async function*(...x = []) {
|
||||
· ─────────
|
||||
44 │
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-ary.js:32:1]
|
||||
32 │ var f;
|
||||
|
|
@ -6940,6 +6948,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
40 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/async-generator/named-dflt-params-rest.js:42:1]
|
||||
42 │
|
||||
43 │ 0, async function* g(...x = []) {
|
||||
· ─────────
|
||||
44 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/async-generator/named-object-destructuring-param-strict-body.js:110:1]
|
||||
110 │ 0, async function* g({property}) {
|
||||
|
|
@ -7316,6 +7332,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
64 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/class/async-gen-method-static/dflt-params-rest.js:66:1]
|
||||
66 │ 0, class {
|
||||
67 │ static async *method(...x = []) {
|
||||
· ─────────
|
||||
68 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/class/async-gen-method-static/object-destructuring-param-strict-body.js:134:1]
|
||||
134 │ static async *method({property}) {
|
||||
|
|
@ -7534,6 +7558,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
64 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/class/async-gen-method/dflt-params-rest.js:66:1]
|
||||
66 │ 0, class {
|
||||
67 │ async *method(...x = []) {
|
||||
· ─────────
|
||||
68 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/class/async-gen-method/object-destructuring-param-strict-body.js:134:1]
|
||||
134 │ async *method({property}) {
|
||||
|
|
@ -7752,6 +7784,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
62 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/class/async-method-static/dflt-params-rest.js:64:1]
|
||||
64 │ var C = class {
|
||||
65 │ static async method(...x = []) {
|
||||
· ─────────
|
||||
66 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/class/async-method-static/object-destructuring-param-strict-body.js:132:1]
|
||||
132 │ static async method({property}) {
|
||||
|
|
@ -7861,6 +7901,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
62 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/class/async-method/dflt-params-rest.js:64:1]
|
||||
64 │ var C = class {
|
||||
65 │ static async method(...x = []) {
|
||||
· ─────────
|
||||
66 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/class/async-method/object-destructuring-param-strict-body.js:132:1]
|
||||
132 │ static async method({property}) {
|
||||
|
|
@ -12524,6 +12572,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
85 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/class/gen-method-static/dflt-params-rest.js:87:1]
|
||||
87 │ 0, class {
|
||||
88 │ static *method(...x = []) {
|
||||
· ─────────
|
||||
89 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/class/gen-method-static/object-destructuring-param-strict-body.js:155:1]
|
||||
155 │ static *method({property}) {
|
||||
|
|
@ -12676,6 +12732,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
85 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/class/gen-method/dflt-params-rest.js:87:1]
|
||||
87 │ 0, class {
|
||||
88 │ *method(...x = []) {
|
||||
· ─────────
|
||||
89 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/class/gen-method/object-destructuring-param-strict-body.js:155:1]
|
||||
155 │ *method({property}) {
|
||||
|
|
@ -12844,6 +12908,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
81 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/class/method-static/dflt-params-rest.js:83:1]
|
||||
83 │ 0, class {
|
||||
84 │ static method(...x = []) {
|
||||
· ─────────
|
||||
85 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/class/method-static/object-destructuring-param-strict-body.js:151:1]
|
||||
151 │ static method({property}) {
|
||||
|
|
@ -12887,6 +12959,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
81 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/class/method/dflt-params-rest.js:83:1]
|
||||
83 │ 0, class {
|
||||
84 │ method(...x = []) {
|
||||
· ─────────
|
||||
85 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/class/method/object-destructuring-param-strict-body.js:151:1]
|
||||
151 │ method({property}) {
|
||||
|
|
@ -14167,6 +14247,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
60 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/function/dflt-params-rest.js:62:1]
|
||||
62 │
|
||||
63 │ 0, function(...x = []) {
|
||||
· ─────────
|
||||
64 │
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/expressions/function/dstr/ary-ptrn-rest-not-final-ary.js:52:1]
|
||||
52 │ var f;
|
||||
|
|
@ -14392,6 +14480,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
61 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/generators/dflt-params-rest.js:63:1]
|
||||
63 │
|
||||
64 │ 0, function*(...x = []) {
|
||||
· ─────────
|
||||
65 │
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/expressions/generators/dstr/ary-ptrn-rest-not-final-ary.js:52:1]
|
||||
52 │ var f;
|
||||
|
|
@ -15405,6 +15501,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
45 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/object/method-definition/async-gen-meth-dflt-params-rest.js:47:1]
|
||||
47 │ 0, {
|
||||
48 │ async *method(...x = []) {
|
||||
· ─────────
|
||||
49 │
|
||||
╰────
|
||||
|
||||
× Keywords cannot contain escape characters
|
||||
╭─[language/expressions/object/method-definition/async-gen-meth-escaped-async.js:24:1]
|
||||
24 │ ({
|
||||
|
|
@ -15566,6 +15670,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
38 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/object/method-definition/async-meth-dflt-params-rest.js:40:1]
|
||||
40 │ ({
|
||||
41 │ async *method(...x = []) {
|
||||
· ─────────
|
||||
42 │
|
||||
╰────
|
||||
|
||||
× Keywords cannot contain escape characters
|
||||
╭─[language/expressions/object/method-definition/async-meth-escaped-async.js:24:1]
|
||||
24 │ ({
|
||||
|
|
@ -15786,6 +15898,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
67 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/object/method-definition/gen-meth-dflt-params-rest.js:69:1]
|
||||
69 │ 0, {
|
||||
70 │ *method(...x = []) {
|
||||
· ─────────
|
||||
71 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/object/method-definition/gen-meth-object-destructuring-param-strict-body.js:137:1]
|
||||
137 │ *method({property}) {
|
||||
|
|
@ -16005,6 +16125,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
63 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/expressions/object/method-definition/meth-dflt-params-rest.js:65:1]
|
||||
65 │ 0, {
|
||||
66 │ method(...x = []) {
|
||||
· ─────────
|
||||
67 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/expressions/object/method-definition/meth-object-destructuring-param-strict-body.js:133:1]
|
||||
133 │ method({property}) {
|
||||
|
|
@ -20946,6 +21074,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
37 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/async-function/dflt-params-rest.js:39:1]
|
||||
39 │
|
||||
40 │ async function f(...x = []) {
|
||||
· ─────────
|
||||
41 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/statements/async-function/early-errors-declaration-NSPL-with-USD.js:15:1]
|
||||
15 │
|
||||
|
|
@ -21182,6 +21318,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
40 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/async-generator/dflt-params-rest.js:42:1]
|
||||
42 │
|
||||
43 │ async function* f(...x = []) {
|
||||
· ─────────
|
||||
44 │
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/statements/async-generator/dstr/ary-ptrn-rest-not-final-ary.js:31:1]
|
||||
31 │ var callCount = 0;
|
||||
|
|
@ -21702,6 +21846,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
64 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/class/async-gen-method-static/dflt-params-rest.js:66:1]
|
||||
66 │ class C {
|
||||
67 │ static async *method(...x = []) {
|
||||
· ─────────
|
||||
68 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/statements/class/async-gen-method-static/object-destructuring-param-strict-body.js:134:1]
|
||||
134 │ static async *method({property}) {
|
||||
|
|
@ -21920,6 +22072,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
63 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/class/async-gen-method/dflt-params-rest.js:65:1]
|
||||
65 │ class C {
|
||||
66 │ async *method(...x = []) {
|
||||
· ─────────
|
||||
67 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/statements/class/async-gen-method/object-destructuring-param-strict-body.js:133:1]
|
||||
133 │ async *method({property}) {
|
||||
|
|
@ -22147,6 +22307,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
61 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/class/async-method-static/dflt-params-rest.js:63:1]
|
||||
63 │ class C {
|
||||
64 │ static async method(...x = []) {
|
||||
· ─────────
|
||||
65 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/statements/class/async-method-static/object-destructuring-param-strict-body.js:131:1]
|
||||
131 │ static async method({property}) {
|
||||
|
|
@ -22256,6 +22424,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
62 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/class/async-method/dflt-params-rest.js:64:1]
|
||||
64 │ class C {
|
||||
65 │ async method(...x = []) {
|
||||
· ─────────
|
||||
66 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/statements/class/async-method/object-destructuring-param-strict-body.js:132:1]
|
||||
132 │ async method({property}) {
|
||||
|
|
@ -27133,6 +27309,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
83 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/class/gen-method-static/dflt-params-rest.js:85:1]
|
||||
85 │ class C {
|
||||
86 │ static *method(...x = []) {
|
||||
· ─────────
|
||||
87 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/statements/class/gen-method-static/object-destructuring-param-strict-body.js:153:1]
|
||||
153 │ static *method({property}) {
|
||||
|
|
@ -27285,6 +27469,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
83 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/class/gen-method/dflt-params-rest.js:85:1]
|
||||
85 │ class C {
|
||||
86 │ *method(...x = []) {
|
||||
· ─────────
|
||||
87 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/statements/class/gen-method/object-destructuring-param-strict-body.js:153:1]
|
||||
153 │ *method({property}) {
|
||||
|
|
@ -27453,6 +27645,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
80 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/class/method-static/dflt-params-rest.js:82:1]
|
||||
82 │ class C {
|
||||
83 │ static method(...x = []) {
|
||||
· ─────────
|
||||
84 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/statements/class/method-static/object-destructuring-param-strict-body.js:150:1]
|
||||
150 │ static method({property}) {
|
||||
|
|
@ -27496,6 +27696,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
80 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/class/method/dflt-params-rest.js:82:1]
|
||||
82 │ class C {
|
||||
83 │ method(...x = []) {
|
||||
· ─────────
|
||||
84 │
|
||||
╰────
|
||||
|
||||
× Illegal 'use strict' directive in function with non-simple parameter list
|
||||
╭─[language/statements/class/method/object-destructuring-param-strict-body.js:150:1]
|
||||
150 │ method({property}) {
|
||||
|
|
@ -30371,6 +30579,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
61 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/function/dflt-params-rest.js:63:1]
|
||||
63 │
|
||||
64 │ function f(...x = []) {
|
||||
· ─────────
|
||||
65 │
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/statements/function/dstr/ary-ptrn-rest-not-final-ary.js:52:1]
|
||||
52 │ var callCount = 0;
|
||||
|
|
@ -30673,6 +30889,14 @@ Expect to Parse: "language/statements/function/S14_A5_T2.js"
|
|||
61 │
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[language/statements/generators/dflt-params-rest.js:63:1]
|
||||
63 │
|
||||
64 │ function* f(...x = []) {
|
||||
· ─────────
|
||||
65 │
|
||||
╰────
|
||||
|
||||
× Rest element must be last element
|
||||
╭─[language/statements/generators/dstr/ary-ptrn-rest-not-final-ary.js:51:1]
|
||||
51 │ var callCount = 0;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
TypeScript Summary:
|
||||
AST Parsed : 2305/2338 (98.59%)
|
||||
Positive Passed: 2305/2338 (98.59%)
|
||||
Negative Passed: 658/2532 (25.99%)
|
||||
Negative Passed: 660/2532 (26.07%)
|
||||
Expect Syntax Error: "Symbols/ES5SymbolProperty2.ts"
|
||||
Expect Syntax Error: "Symbols/ES5SymbolProperty6.ts"
|
||||
Expect Syntax Error: "additionalChecks/noPropertyAccessFromIndexSignature1.ts"
|
||||
|
|
@ -475,7 +475,6 @@ Expect Syntax Error: "es6/destructuring/destructuringParameterDeclaration1ES5ite
|
|||
Expect Syntax Error: "es6/destructuring/destructuringParameterDeclaration3ES5.ts"
|
||||
Expect Syntax Error: "es6/destructuring/destructuringParameterDeclaration3ES5iterable.ts"
|
||||
Expect Syntax Error: "es6/destructuring/destructuringParameterDeclaration3ES6.ts"
|
||||
Expect Syntax Error: "es6/destructuring/destructuringParameterDeclaration4.ts"
|
||||
Expect Syntax Error: "es6/destructuring/destructuringParameterDeclaration5.ts"
|
||||
Expect Syntax Error: "es6/destructuring/destructuringParameterDeclaration8.ts"
|
||||
Expect Syntax Error: "es6/destructuring/destructuringParameterProperties1.ts"
|
||||
|
|
@ -1227,7 +1226,6 @@ Expect Syntax Error: "parser/ecmascript5/ModuleDeclarations/parserModuleDeclarat
|
|||
Expect Syntax Error: "parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration3.ts"
|
||||
Expect Syntax Error: "parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration4.d.ts"
|
||||
Expect Syntax Error: "parser/ecmascript5/ModuleDeclarations/parserModuleDeclaration5.ts"
|
||||
Expect Syntax Error: "parser/ecmascript5/ParameterLists/parserParameterList10.ts"
|
||||
Expect Syntax Error: "parser/ecmascript5/ParameterLists/parserParameterList11.ts"
|
||||
Expect Syntax Error: "parser/ecmascript5/ParameterLists/parserParameterList13.ts"
|
||||
Expect Syntax Error: "parser/ecmascript5/ParameterLists/parserParameterList14.ts"
|
||||
|
|
@ -4826,6 +4824,14 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
8 │ a0([1, 2, [["world"]], "string"]); // Error
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[es6/destructuring/destructuringParameterDeclaration4.ts:14:1]
|
||||
14 │ function a3(...b?) { } // Error, can't be optional
|
||||
15 │ function a4(...b = [1,2,3]) { } // Error, can't have initializer
|
||||
· ──────────────
|
||||
16 │ function a5([a, b, [[c]]]) { }
|
||||
╰────
|
||||
|
||||
× Expect token
|
||||
╭─[es6/destructuring/destructuringParameterDeclaration6.ts:6:1]
|
||||
6 │ // Error
|
||||
|
|
@ -9615,6 +9621,14 @@ Expect to Parse: "salsa/privateIdentifierExpando.ts"
|
|||
3 │ }
|
||||
╰────
|
||||
|
||||
× A rest parameter cannot have an initializer
|
||||
╭─[parser/ecmascript5/ParameterLists/parserParameterList10.ts:1:1]
|
||||
1 │ class C {
|
||||
2 │ foo(...bar = 0) { }
|
||||
· ──────────
|
||||
3 │ }
|
||||
╰────
|
||||
|
||||
× Expect token
|
||||
╭─[parser/ecmascript5/ParameterLists/parserParameterList5.ts:1:1]
|
||||
1 │ function A(): (public B) => C {
|
||||
|
|
|
|||
Loading…
Reference in a new issue