Skip to content

Commit

Permalink
Fix another case for FieldDecl
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotchance committed Apr 16, 2017
1 parent d2c8c41 commit 64814cd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions ast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,15 @@ var nodes = map[string]interface{}{
Referenced: false,
Children: []interface{}{},
},
`0x30363a0 <col:18, col:29> __val 'int [2]'`: &FieldDecl{
Address: "0x30363a0",
Position: "col:18, col:29",
Position2: "",
Name: "__val",
Type: "int [2]",
Referenced: false,
Children: []interface{}{},
},

// FloatingLiteral
`0x7febe106f5e8 <col:24> 'double' 1.230000e+00`: &FloatingLiteral{
Expand Down
8 changes: 4 additions & 4 deletions field_decl.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type FieldDecl struct {
func parseFieldDecl(line string) *FieldDecl {
groups := groupsFromRegex(
`<(?P<position>.*)>
(?P<position2> [^ ]+)?
(?P<position2> col:\d+| line:\d+:\d+)?
(?P<referenced> referenced)?
(?P<name> \w+?)?
'(?P<type>.+?)'`,
Expand All @@ -40,9 +40,9 @@ func (n *FieldDecl) Render() []string {
fieldType := resolveType(n.Type)
name := n.Name

if name == "" {
return []string{"", "unknown71"}
}
//if name == "" {
// return []string{"", "unknown71"}
//}

// Go does not allow the name of a variable to be called "type". For the
// moment I will rename this to avoid the error.
Expand Down

0 comments on commit 64814cd

Please sign in to comment.