(symbol *ast.Symbol, staticBlocks []*ast.Node)
| 2456 | } |
| 2457 | |
| 2458 | func (c *Checker) getFlowTypeInStaticBlocks(symbol *ast.Symbol, staticBlocks []*ast.Node) *Type { |
| 2459 | var accessName *ast.Node |
| 2460 | if strings.HasPrefix(symbol.Name, ast.InternalSymbolNamePrefix+"#") { |
| 2461 | accessName = c.factory.NewPrivateIdentifier(symbol.Name[strings.Index(symbol.Name, "@")+1:]) |
| 2462 | } else { |
| 2463 | accessName = c.factory.NewIdentifier(symbol.Name) |
| 2464 | } |
| 2465 | for _, staticBlock := range staticBlocks { |
| 2466 | reference := c.factory.NewPropertyAccessExpression(c.factory.NewKeywordExpression(ast.KindThisKeyword), nil, accessName, ast.NodeFlagsNone) |
| 2467 | reference.Expression().Parent = reference |
| 2468 | reference.Parent = staticBlock |
| 2469 | reference.FlowNodeData().FlowNode = staticBlock.AsClassStaticBlockDeclaration().ReturnFlowNode |
| 2470 | flowType := c.getFlowTypeOfProperty(reference, symbol) |
| 2471 | if c.noImplicitAny && (flowType == c.autoType || flowType == c.autoArrayType) { |
| 2472 | c.error(symbol.ValueDeclaration, diagnostics.Member_0_implicitly_has_an_1_type, c.symbolToString(symbol), c.TypeToString(flowType)) |
| 2473 | } |
| 2474 | // We don't infer a type if assignments are only null or undefined. |
| 2475 | if everyType(flowType, c.IsNullableType) { |
| 2476 | continue |
| 2477 | } |
| 2478 | return c.convertAutoToAny(flowType) |
| 2479 | } |
| 2480 | return nil |
| 2481 | } |
| 2482 | |
| 2483 | func (c *Checker) isReachableFlowNode(flow *ast.FlowNode) bool { |
| 2484 | f := c.getFlowState() |
no test coverage detected