@@ -7656,7 +7656,7 @@ func (c *Checker) checkSuperExpression(node *ast.Node) *Type {
7656
7656
7657
7657
func (c *Checker) isInConstructorArgumentInitializer(node *ast.Node, constructorDecl *ast.Node) bool {
7658
7658
return ast.FindAncestorOrQuit(node, func(n *ast.Node) ast.FindAncestorResult {
7659
- if ast.IsFunctionLikeDeclaration(n) {
7659
+ if n != nil && ast.IsFunctionLikeDeclaration(n) {
7660
7660
return ast.FindAncestorQuit
7661
7661
}
7662
7662
if ast.IsParameter(n) && n.Parent == constructorDecl {
@@ -11415,7 +11415,7 @@ func (c *Checker) isNodeUsedDuringClassInitialization(node *ast.Node) bool {
11415
11415
return ast.FindAncestorOrQuit(node, func(element *ast.Node) ast.FindAncestorResult {
11416
11416
if ast.IsConstructorDeclaration(element) && ast.NodeIsPresent(element.Body()) || ast.IsPropertyDeclaration(element) {
11417
11417
return ast.FindAncestorTrue
11418
- } else if ast.IsClassLike(element) || ast.IsFunctionLikeDeclaration(element) {
11418
+ } else if ast.IsClassLike(element) || (element != nil && ast.IsFunctionLikeDeclaration(element) ) {
11419
11419
return ast.FindAncestorQuit
11420
11420
}
11421
11421
return ast.FindAncestorFalse
@@ -19474,7 +19474,7 @@ func (c *Checker) createGeneratorType(yieldType *Type, returnType *Type, nextTyp
19474
19474
19475
19475
func (c *Checker) reportErrorsFromWidening(declaration *ast.Node, t *Type, wideningKind WideningKind) {
19476
19476
if c.noImplicitAny && t.objectFlags&ObjectFlagsContainsWideningType != 0 {
19477
- if wideningKind == WideningKindNormal || ast.IsFunctionLikeDeclaration(declaration) && c.shouldReportErrorsFromWideningWithContextualSignature(declaration, wideningKind) {
19477
+ if wideningKind == WideningKindNormal || declaration != nil && ast.IsFunctionLikeDeclaration(declaration) && c.shouldReportErrorsFromWideningWithContextualSignature(declaration, wideningKind) {
19478
19478
// Report implicit any error within type if possible, otherwise report error on declaration
19479
19479
if !c.reportWideningErrorsInType(t) {
19480
19480
c.reportImplicitAny(declaration, t, wideningKind)
0 commit comments