-
Notifications
You must be signed in to change notification settings - Fork 784
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Original code:
const parent = findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)?.parent || previousParent!;
New code:
parent := astnav.FindPrecedingToken(w.sourceFile, tokenInfo.Loc.End())
if parent == nil {
parent = w.previousParent
}typescript-go/internal/format/span.go
Lines 304 to 307 in 0527802
| parent := astnav.FindPrecedingToken(w.sourceFile, tokenInfo.Loc.End()) | |
| if parent == nil { | |
| parent = w.previousParent | |
| } |
Looks like we at least need something like
- parent := astnav.FindPrecedingToken(w.sourceFile, tokenInfo.Loc.End())
+ var parent *ast.Node
+ prevToken := astnav.FindPrecedingToken(w.sourceFile, tokenInfo.Loc.End())
+ if prevToken != nil {
+ parent = prevToken.Parent
+ }
if parent == nil {
parent = w.previousParent
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working