-
Notifications
You must be signed in to change notification settings - Fork 2
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
Fixes #17 Support callback #18
Conversation
src/cmd/cgogen.go
Outdated
call_func_code = | ||
jen.List(retvars...).Op(":=").Id(fdecl.Name.Name).Call(callparams...) | ||
} | ||
callFuncCode = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this conditional statement ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already analyze mainPackage at the beginning, that rounds code
src/cmd/cgogen.go
Outdated
} else { | ||
call_func_code = jen.Id(fdecl.Name.Name).Call(callparams...) | ||
} | ||
callFuncCode = jen.Qual(mainPackagePath+packagePath, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why removed this conditional statement ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already analyze mainPackage at the beginning, that rounds code
@@ -805,8 +789,12 @@ func getCodeToConvertInParameter(_typeExpr *ast.Expr, packName string, name stri | |||
if !isPointer { | |||
leftPart = leftPart.Op("*") | |||
} | |||
leftPart = leftPart.Parens(jen.Op("*").Id(packName).Id(".").Id(typeName)). | |||
Parens(jen.Qual("unsafe", "Pointer").Parens(jen.Id(argName(name)))) | |||
if typeName == "FeeCalculator" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cgogen
code has to be generic , it must not depend upon specific names of a particular library used as input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in my opinion , maybe this check should be about whether type was defined as ast.FuncType
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem of callbacks that are very specific. And the functions are different, it can't be treated that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it definitely can't be treated as hard-coded type names belonging in a separate library package .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly then what do you suggest
Fixes #17
Changes:
callback
incoin.transactions
Does this change need to mentioned in CHANGELOG.md?
No