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

refactor: Remove children field from ASTNode #956

Merged
merged 5 commits into from May 11, 2022

Conversation

samestep
Copy link
Collaborator

@samestep samestep commented May 11, 2022

Description

Resolves #841. The only place where a children function was actually necessary is synthesis/Search, so I just wrote one there using a very simple switch statement.

Implementation strategy and design decisions

I removed the traverseTree checks in our parser tests, because all they seem to do is check each node's nodeType, but that is already guaranteed via how each of our *.ne files defines a nodeData constant which sets nodeType.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new ESLint warnings
  • I have reviewed any generated changes to the diagrams/ folder

@cloudflare-pages
Copy link

cloudflare-pages bot commented May 11, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: ee905ac
Status: ✅  Deploy successful!
Preview URL: https://cc891268.penrose-panes.pages.dev

View logs

@codecov
Copy link

codecov bot commented May 11, 2022

Codecov Report

Merging #956 (ee905ac) into main (199e9c6) will decrease coverage by 0.06%.
The diff coverage is 55.26%.

@@            Coverage Diff             @@
##             main     #956      +/-   ##
==========================================
- Coverage   62.82%   62.75%   -0.07%     
==========================================
  Files          62       62              
  Lines        7857     7889      +32     
  Branches     1821     1842      +21     
==========================================
+ Hits         4936     4951      +15     
- Misses       2797     2814      +17     
  Partials      124      124              
Impacted Files Coverage Δ
packages/core/src/analysis/SubstanceAnalysis.ts 75.82% <ø> (ø)
packages/core/src/compiler/Domain.ts 86.22% <ø> (ø)
packages/core/src/compiler/Substance.ts 92.36% <ø> (ø)
packages/core/src/engine/EngineUtils.ts 64.74% <ø> (ø)
packages/core/src/engine/Evaluator.ts 32.55% <ø> (ø)
packages/core/src/parser/ParserUtil.ts 97.01% <ø> (ø)
packages/core/src/synthesis/Synthesizer.ts 28.13% <ø> (ø)
packages/core/src/types/ast.ts 100.00% <ø> (ø)
packages/core/src/synthesis/Search.ts 77.29% <54.05%> (-4.86%) ⬇️
packages/core/src/compiler/Style.ts 78.83% <100.00%> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 199e9c6...ee905ac. Read the comment docs.

@samestep samestep marked this pull request as ready for review May 11, 2022 16:39
@samestep samestep requested a review from wodeni May 11, 2022 16:40
Copy link
Member

@wodeni wodeni left a comment

Choose a reason for hiding this comment

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

Looks great! This is much cleaner and easier to maintain.

@samestep samestep merged commit 3262391 into main May 11, 2022
@samestep samestep deleted the remove-ast-children-field branch May 11, 2022 18:00
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.

Make AST children a function instead of a field
2 participants