Skip to content

Fix prototype callback generation if direct reference is used #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Handle more cases when searching for callback reference
the tag will be searched only if its signature is void and it's not being skipped for other reasons
  • Loading branch information
facchinm committed Mar 17, 2017
commit 4a7df6babf3e05b39929a15c37727019bc059059
5 changes: 2 additions & 3 deletions src/arduino.cc/builder/ctags/ctags_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ func parseTag(row string) *types.CTag {

parts = parts[2:]

signature := ""
returntype := ""
for _, part := range parts {
if strings.Contains(part, ":") {
Expand All @@ -253,7 +252,7 @@ func parseTag(row string) *types.CTag {
case "typeref":
tag.Typeref = value
case "signature":
signature = value
tag.Signature = value
case "returntype":
returntype = value
case "class":
Expand All @@ -265,7 +264,7 @@ func parseTag(row string) *types.CTag {
}
}
}
tag.Prototype = returntype + " " + tag.FunctionName + signature + ";"
tag.Prototype = returntype + " " + tag.FunctionName + tag.Signature + ";"

if strings.Contains(row, "/^") && strings.Contains(row, "$/;") {
tag.Code = row[strings.Index(row, "/^")+2 : strings.Index(row, "$/;")]
Expand Down
3 changes: 3 additions & 0 deletions src/arduino.cc/builder/ctags/ctags_to_prototypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ func functionNameUsedAsFunctionPointerIn(tag *types.CTag, functionNames []string
if strings.Index(tag.Code, "&"+functionName) != -1 {
return true
}
if strings.Index(tag.Code, functionName) != -1 {
return true
}
}
return false
}
Expand Down
1 change: 1 addition & 0 deletions src/arduino.cc/builder/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ type CTag struct {
Filename string
Typeref string
SkipMe bool
Signature string

Prototype string
Function string
Expand Down