(tp *typeparser.TypeParser, c *checker.Checker, sf *ast.SourceFile, n *ast.Node)
| 93 | } |
| 94 | |
| 95 | func checkOutdatedApiPropertyAccess(tp *typeparser.TypeParser, c *checker.Checker, sf *ast.SourceFile, n *ast.Node) *OutdatedApiMatch { |
| 96 | prop := n.AsPropertyAccessExpression() |
| 97 | if prop == nil { |
| 98 | return nil |
| 99 | } |
| 100 | |
| 101 | nameNode := prop.Name() |
| 102 | if nameNode == nil { |
| 103 | return nil |
| 104 | } |
| 105 | |
| 106 | identifierName := nameNode.Text() |
| 107 | if identifierName == "" { |
| 108 | return nil |
| 109 | } |
| 110 | |
| 111 | migration, ok := EffectModuleMigrationDb[identifierName] |
| 112 | if !ok { |
| 113 | return nil |
| 114 | } |
| 115 | |
| 116 | // Skip unchanged entries — they exist in both v3 and v4 |
| 117 | if migration.Tag == MigrationTagUnchanged { |
| 118 | return nil |
| 119 | } |
| 120 | |
| 121 | // Get the type of the expression (left side of the property access) |
| 122 | expr := prop.Expression |
| 123 | if expr == nil { |
| 124 | return nil |
| 125 | } |
| 126 | |
| 127 | targetType := tp.GetTypeAtLocation(expr) |
| 128 | if targetType == nil { |
| 129 | return nil |
| 130 | } |
| 131 | |
| 132 | // Only report if the property does NOT exist on the target type |
| 133 | // (confirming it's a v3-only API) |
| 134 | if c.GetPropertyOfType(targetType, identifierName) != nil { |
| 135 | return nil |
| 136 | } |
| 137 | |
| 138 | // Verify the expression references the Effect module |
| 139 | if !tp.IsExpressionEffectModule(expr) { |
| 140 | return nil |
| 141 | } |
| 142 | |
| 143 | return &OutdatedApiMatch{ |
| 144 | SourceFile: sf, |
| 145 | Location: scanner.GetErrorRangeForNode(sf, nameNode), |
| 146 | PropertyName: identifierName, |
| 147 | MigrationHint: migrationHintText(migration), |
| 148 | Migration: migration, |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | func migrationHintText(m Migration) string { |
no test coverage detected