Skip to content
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

Closed

Conversation

m4yk3ldev
Copy link

Fixes #17

Changes:

  • Added support callback in coin.transactions

Does this change need to mentioned in CHANGELOG.md?

No

@m4yk3ldev m4yk3ldev added this to the 0.1.0 milestone Jan 20, 2020
@m4yk3ldev m4yk3ldev self-assigned this Jan 20, 2020
src/cmd/cgogen.go Outdated Show resolved Hide resolved
call_func_code =
jen.List(retvars...).Op(":=").Id(fdecl.Name.Name).Call(callparams...)
}
callFuncCode =
Copy link
Contributor

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 ?

Copy link
Author

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

} else {
call_func_code = jen.Id(fdecl.Name.Name).Call(callparams...)
}
callFuncCode = jen.Qual(mainPackagePath+packagePath,
Copy link
Contributor

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 ?

Copy link
Author

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" {
Copy link
Contributor

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

Copy link
Contributor

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 .

Copy link
Author

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.

Copy link
Contributor

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 .

Copy link
Author

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

src/cmd/cgogen.go Outdated Show resolved Hide resolved
src/cmd/cgogen.go Outdated Show resolved Hide resolved
@olemis olemis mentioned this pull request Feb 24, 2020
@m4yk3ldev m4yk3ldev closed this Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support to define callback
2 participants