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

Restructured compiler logic #439

Merged
merged 1 commit into from
May 24, 2024
Merged

Restructured compiler logic #439

merged 1 commit into from
May 24, 2024

Conversation

csansoon
Copy link
Contributor

@csansoon csansoon commented May 21, 2024

Describe your changes

Moved all of the logic for resolving 'logic nodes' from the main compiler/index.ts file, to different files for better organization. This change is made because this main file was getting way too long and complicated.

  1. Main file for compile method is no longer >1000 LOC
  2. Logic for how compiler interprets custom code is now way more organized and easier to understand.

This new structure works like this:
Each Logic Node has its own file with a resolve method that defines how to resolve the value returned by this method. Then, there's a resolveLogicNode method that runs the correct resolve function based on the node type.


🚂 TRENECITO. This PR was needed so that the next PR is not 2000 LOC :)
🚉 Next station: #434

Copy link

changeset-bot bot commented May 21, 2024

⚠️ No Changeset found

Latest commit: 0931006

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@csansoon csansoon changed the base branch from main to canary May 21, 2024 08:33
@csansoon csansoon changed the base branch from canary to fix/compiler-can-run-methods-from-scoped-variables-canary May 21, 2024 08:33
@csansoon csansoon removed the WIP label May 21, 2024
@csansoon csansoon force-pushed the fix/compiler-can-run-methods-from-scoped-variables-canary branch from b2fee7f to d33e41c Compare May 22, 2024 12:00
@csansoon csansoon changed the base branch from fix/compiler-can-run-methods-from-scoped-variables-canary to canary May 22, 2024 12:03
@csansoon csansoon force-pushed the restructured-compiler-logic branch 2 times, most recently from c8a9d19 to 2eb5531 Compare May 22, 2024 12:07
@@ -537,7 +537,7 @@ describe('custom methods', async () => {
})
const error = await getExpectedError(action, CompileError)
expect(error.code).toBe('function-call-error')
expect(error.message).toBe("Error calling function 'fooFn': \nError bar")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! The error message is a bit more generic now, but it will still showing the reference to the exact part of the query where it's the failing function when running latitude run for debugging purposes.

@csansoon csansoon force-pushed the restructured-compiler-logic branch 2 times, most recently from cd48840 to f155f00 Compare May 22, 2024 12:17
@csansoon csansoon force-pushed the restructured-compiler-logic branch from f155f00 to 0931006 Compare May 22, 2024 12:30
@csansoon csansoon merged commit f959cc7 into canary May 24, 2024
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants