Skip to content

Commit 96d74d8

Browse files
authored
Fix: replace deprecated method (#599)
1 parent 57c1508 commit 96d74d8

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

internal/checker/checker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9619,7 +9619,7 @@ func (c *Checker) isAritySmaller(signature *Signature, target *ast.Node) bool {
96199619
}
96209620
targetParameterCount++
96219621
}
9622-
if len(parameters) != 0 && parameterIsThisKeyword(parameters[0]) {
9622+
if len(parameters) != 0 && ast.IsThisParameter(parameters[0]) {
96239623
targetParameterCount--
96249624
}
96259625
return !c.hasEffectiveRestParameter(signature) && c.getParameterCount(signature) < targetParameterCount
@@ -18245,7 +18245,7 @@ func getEffectiveSetAccessorTypeAnnotationNode(node *ast.Node) *ast.Node {
1824518245
func getSetAccessorValueParameter(accessor *ast.Node) *ast.Node {
1824618246
parameters := accessor.Parameters()
1824718247
if len(parameters) > 0 {
18248-
hasThis := len(parameters) == 2 && parameterIsThisKeyword(parameters[0])
18248+
hasThis := len(parameters) == 2 && ast.IsThisParameter(parameters[0])
1824918249
return parameters[core.IfElse(hasThis, 1, 0)]
1825018250
}
1825118251
return nil

internal/checker/grammarchecks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ func (c *Checker) checkGrammarModifiers(node *ast.Node /*Union[HasModifiers, Has
201201
if c.reportObviousDecoratorErrors(node) || c.reportObviousModifierErrors(node) {
202202
return true
203203
}
204-
if ast.IsParameter(node) && parameterIsThisKeyword(node) {
204+
if ast.IsParameter(node) && ast.IsThisParameter(node) {
205205
return c.grammarErrorOnFirstToken(node, diagnostics.Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters)
206206
}
207207
blockScopeKind := ast.NodeFlagsNone

internal/checker/utilities.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,18 +1248,13 @@ func getThisParameter(signature *ast.Node) *ast.Node {
12481248
// callback tags do not currently support this parameters
12491249
if len(signature.Parameters()) != 0 {
12501250
thisParameter := signature.Parameters()[0]
1251-
if parameterIsThisKeyword(thisParameter) {
1251+
if ast.IsThisParameter(thisParameter) {
12521252
return thisParameter
12531253
}
12541254
}
12551255
return nil
12561256
}
12571257

1258-
// Deprecated: use ast.IsThisParameter
1259-
func parameterIsThisKeyword(parameter *ast.Node) bool {
1260-
return ast.IsThisParameter(parameter)
1261-
}
1262-
12631258
func isObjectOrArrayLiteralType(t *Type) bool {
12641259
return t.objectFlags&(ObjectFlagsObjectLiteral|ObjectFlagsArrayLiteral) != 0
12651260
}
@@ -1512,7 +1507,7 @@ func hasContextSensitiveParameters(node *ast.Node) bool {
15121507
// If the first parameter is not an explicit 'this' parameter, then the function has
15131508
// an implicit 'this' parameter which is subject to contextual typing.
15141509
parameter := core.FirstOrNil(node.Parameters())
1515-
if parameter == nil || !parameterIsThisKeyword(parameter) {
1510+
if parameter == nil || !ast.IsThisParameter(parameter) {
15161511
return true
15171512
}
15181513
}

0 commit comments

Comments
 (0)