(node)
| 80055 | } |
| 80056 | } |
| 80057 | function checkParameter(node) { |
| 80058 | // Grammar checking |
| 80059 | // It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs as the |
| 80060 | // Identifier in a PropertySetParameterList of a PropertyAssignment that is contained in strict code |
| 80061 | // or if its FunctionBody is strict code(11.1.5). |
| 80062 | checkGrammarDecoratorsAndModifiers(node); |
| 80063 | checkVariableLikeDeclaration(node); |
| 80064 | var func = ts.getContainingFunction(node); |
| 80065 | if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { |
| 80066 | if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { |
| 80067 | error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); |
| 80068 | } |
| 80069 | if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { |
| 80070 | error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); |
| 80071 | } |
| 80072 | } |
| 80073 | if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { |
| 80074 | error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); |
| 80075 | } |
| 80076 | if (node.name && ts.isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) { |
| 80077 | if (func.parameters.indexOf(node) !== 0) { |
| 80078 | error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); |
| 80079 | } |
| 80080 | if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { |
| 80081 | error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); |
| 80082 | } |
| 80083 | if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { |
| 80084 | error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); |
| 80085 | } |
| 80086 | if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { |
| 80087 | error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); |
| 80088 | } |
| 80089 | } |
| 80090 | // Only check rest parameter type if it's not a binding pattern. Since binding patterns are |
| 80091 | // not allowed in a rest parameter, we already have an error from checkGrammarParameterList. |
| 80092 | if (node.dotDotDotToken && !ts.isBindingPattern(node.name) && !isTypeAssignableTo(getReducedType(getTypeOfSymbol(node.symbol)), anyReadonlyArrayType)) { |
| 80093 | error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); |
| 80094 | } |
| 80095 | } |
| 80096 | function checkTypePredicate(node) { |
| 80097 | var parent = getTypePredicateParent(node); |
| 80098 | if (!parent) { |
no test coverage detected
searching dependent graphs…