-
Notifications
You must be signed in to change notification settings - Fork 245
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
fix(go): generate concrete structs for behavioral interfaces #2257
Conversation
Added runtime code gen for calls to jsii get/set apis. Changed order of args in runtime Get/Set functions to better match method invoke. Moved all property access to codegen to separate file.
Adds generation of empty structs for behavioral interfaces. These are to be used by the runtime so that methods that return behavioral interfaces have some known type that is able to be constructed and returned. These may be able to be made private (non-exported) though they may be referenced by other JSII modules that depend on them as necessitated by the runtime. Additionally, changes type signatures in places to always refer to the interface type of JSII classes, interfaces, and structs. This is required since JSII methods always return the interface implementation of complex types in order to resolve runtime reference values. In order for the returned values to be passed into other methods, the methods themselves must accept the interface type and not the concrete type.
Update runtime to properly handle Get/StaticGet calls from generated code. Updates jsii-calc-test to be runnable using `go test`.
Fixes bug in primitive type resolution for go type references.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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 see this already got merged, but had a few questions.
Also, moving forward, this was a pretty large PR that did multiple things -- the Get/Set code generation could have been submitted separately, for example. Just thoughts moving forward.
Renaming some args in go runtime as suggested in #2257.
Renaming some args in go runtime as suggested in #2257. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Adds generation of empty structs for behavioral interfaces. These are to
be used by the runtime so that methods that return behavioral interfaces
have some known type that is able to be constructed and returned. These
may be able to be made private (non-exported) though they may be
referenced by other JSII modules that depend on them as necessitated by
the runtime.
Additionally, changes type signatures in places to always refer to the
interface type of JSII classes, interfaces, and structs. This is
required since JSII methods always return the interface implementation
of complex types in order to resolve runtime reference values. In order
for the returned values to be passed into other methods, the methods
themselves must accept the interface type and not the concrete type.
Added runtime code gen for calls to jsii get/set apis. Changed order of
args in runtime Get/Set functions to better match method invoke.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.