(file string)
| 217 | } |
| 218 | |
| 219 | func (d *Debugger) BreakpointLocations(file string) ([]*ast.LocationRange, error) { |
| 220 | abs, err := filepath.Abs(file) |
| 221 | if err != nil { |
| 222 | return nil, err |
| 223 | } |
| 224 | raw, err := os.ReadFile(abs) |
| 225 | if err != nil { |
| 226 | return nil, fmt.Errorf("reading file: %w", err) |
| 227 | } |
| 228 | a, err := SnippetToAST(file, string(raw)) |
| 229 | if err != nil { |
| 230 | return nil, fmt.Errorf("invalid source file: %w", err) |
| 231 | } |
| 232 | bps := []*ast.LocationRange{} |
| 233 | traverse(a, func(n *ast.Node) error { |
| 234 | if n != nil { |
| 235 | l := (*n).Loc() |
| 236 | if l.File != nil { |
| 237 | bps = append(bps, l) |
| 238 | } |
| 239 | } |
| 240 | return nil |
| 241 | }) |
| 242 | return bps, nil |
| 243 | } |
| 244 | |
| 245 | func (d *Debugger) SetBreakpoint(file string, line int, column int) (string, error) { |
| 246 | valid, err := d.BreakpointLocations(file) |
no test coverage detected