-
Notifications
You must be signed in to change notification settings - Fork 246
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
feat(pacmak): go module resolution & compiler fixes #1956
feat(pacmak): go module resolution & compiler fixes #1956
Conversation
The title of this Pull Request does not conform with [Conventional Commits] guidelines. It will need to be adjusted before the PR can be merged. |
e5f4cf1
to
1ce2b07
Compare
import { TypeField } from './type-field'; | ||
import { getFieldDependencies } from '../util'; | ||
|
||
class InterfaceProperty implements TypeField { |
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.
Since this go type should only refer to a behavioral interface, there shouldn't be any properties on this, correct?
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.
Behavioral interfaces have properties and methods. DataType interfaces have only properties. We could merge the logic of these two. This class only serves to replace the inline emit of property getters/setters in Interface
so that we can resolve dependencies of each one.
public emit(code: CodeMaker) { | ||
const propName = code.toPascalCase(this.name); | ||
const type = new GoTypeRef( | ||
this.parent.parent.root, | ||
this.property.type, | ||
).scopedName(this.parent.parent); | ||
|
||
code.line(`Get${propName}() ${type}`); |
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.
For datatype interfaces, this should already be handled by https://github.com/aws/jsii/blob/master/packages/jsii-pacmak/lib/targets/golang/types/go-type.ts#L64-L66
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.
Interface doesn't currently inherit from from struct. We can/should do that for property shared property emit logic but I'd say thats another PR.
1ce2b07
to
e617eb3
Compare
Fixes a number of compiler bugs and adds support for external package dependency resolution. Changes package file layout to prevent extraneous directory nesting. Adds logic to `RootPackage` to be able to resolve types within external jsii modules. Also adds a `moduleName` field to the go target jsii config to allow imports across packages to resolve correctly. Changes logic of embedded interfaces to correctly resolve using local names and bubble embedded interfaces up to the package dependencies array to make sure their imports are resolved. Adds utility function for substituting reserved words in variable/function argument names. Some examples within jsii-calc have arguments named `map` which caused go compiler errors. More reserved words should be added to a central list for this functionality in the future.
e617eb3
to
11a04c9
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Fixes a number of compiler bugs and adds support for external package
dependency resolution.
Changes package file layout to prevent extraneous directory nesting.
Adds logic to
RootPackage
to be able to resolve types within externaljsii modules. Also adds a
moduleName
field to the go target jsiiconfig to allow imports across packages to resolve correctly.
Changes logic of embedded interfaces to correctly resolve using local
names and bubble embedded interfaces up to the package dependencies
array to make sure their imports are resolved.
Adds utility function for substituting reserved words in
variable/function argument names. Some examples within jsii-calc have
arguments named
map
which caused go compiler errors. More reservedwords should be added to a central list for this functionality in the
future.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.