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

fix: appsync and step function visitor hoist refactor #280

Merged
merged 32 commits into from
Jun 20, 2022
Merged

Conversation

thantos
Copy link
Collaborator

@thantos thantos commented Jun 19, 2022

Closes #212

Refactor step functions and app sync interpreters to refactor nested tasks to a normal form. This change will make the #202 easier by providing a generic interface for re-writing the AST tree. Async introduces more complex statements that need to be hoisted to a-normal form which would have been previously difficult.

@netlify
Copy link

netlify bot commented Jun 19, 2022

Deploy Preview for effortless-malabi-1c3e77 ready!

Name Link
🔨 Latest commit 246f34e
🔍 Latest deploy log https://app.netlify.com/sites/effortless-malabi-1c3e77/deploys/62b06e06c031480008276748
😎 Deploy Preview https://deploy-preview-280--effortless-malabi-1c3e77.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@thantos thantos marked this pull request as draft June 19, 2022 18:45
@thantos thantos changed the title feat: appsync and step function visitor hoist refactor fix: appsync and step function visitor hoist refactor Jun 19, 2022
src/visit.ts Outdated Show resolved Hide resolved
@thantos thantos marked this pull request as ready for review June 19, 2022 21:22
@thantos thantos requested a review from sam-goodwin June 19, 2022 21:22
github-actions added 10 commits June 19, 2022 21:41
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
github-actions added 7 commits June 20, 2022 01:06
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
github-actions added 2 commits June 20, 2022 03:38
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
src/asl.ts Outdated
Comment on lines 902 to 862
return taskState;
throw Error("");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should error message be? Why did the logic change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got rid of findIntegration which will align better with validating and handling the async change. Will fix error.

*/
public generateOrGet(node: FunctionlessNode): string {
if (!this.generatedNames.has(node)) {
this.generatedNames.set(node, `${this.generatedNames.size}_tmp`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at who is using mutability ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied your code ;-) but in this case the risk seemed low in a small isolated private methods.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied your code ;-)

Loool

src/visit.ts Outdated
): BlockStmt {
return visitEachChild(block, (stmt) => {
const nestedTasks: FunctionlessNode[] = [];
function hoist(expr: Expr): Expr {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the return type be an Identifier?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh, yeah, it could be, it was more complex at one point.

/**
* Like {@link visitEachChild} but it only visits the statements of a block.
*
* Provides the hoist function that allows hoisting expressions into variable statements above the current statement.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty nice I must say. Neat.

test/__snapshots__/table.test.ts.snap Show resolved Hide resolved
github-actions and others added 7 commits June 20, 2022 04:15
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: App Sync: Nested Integrations
2 participants