Skip to content

Commit

Permalink
Handle optional extra field in warn_unused_result (#863)
Browse files Browse the repository at this point in the history
Fixes #861
  • Loading branch information
kroppt authored Jul 20, 2020
1 parent d3c9135 commit 0307ff6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ast/warn_unused_result_attr.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type WarnUnusedResultAttr struct {
}

func parseWarnUnusedResultAttr(line string) *WarnUnusedResultAttr {
groups := groupsFromRegex(`<(?P<position>.*)>(?P<inherited> Inherited)?( warn_unused_result)?`, line)
groups := groupsFromRegex(`<(?P<position>.*)>(?P<inherited> Inherited)?( warn_unused_result)?( "")?`, line)

return &WarnUnusedResultAttr{
Addr: ParseAddress(groups["address"]),
Expand Down
6 changes: 6 additions & 0 deletions ast/warn_unused_result_attr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ func TestWarnUnusedResultAttr(t *testing.T) {
Inherited: true,
ChildNodes: []Node{},
},
`0x55c2df4f93b8 <col:53> warn_unused_result ""`: &WarnUnusedResultAttr{
Addr: 0x55c2df4f93b8,
Pos: NewPositionFromString("col:53"),
Inherited: false,
ChildNodes: []Node{},
},
}

runNodeTests(t, nodes)
Expand Down

0 comments on commit 0307ff6

Please sign in to comment.