-
Notifications
You must be signed in to change notification settings - Fork 155
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
Refactored ast nodes into separate package #45
Conversation
Codecov Report
@@ Coverage Diff @@
## master #45 +/- ##
===========================================
- Coverage 93.32% 73.59% -19.73%
===========================================
Files 62 66 +4
Lines 1318 1530 +212
===========================================
- Hits 1230 1126 -104
- Misses 63 378 +315
- Partials 25 26 +1
Continue to review full report at Codecov.
|
Hi @bongo227 - interestingly I did actually have all of these files in an For each TODO:
|
Reviewed 66 of 125 files at r1. main.go, line 15 at r1 (raw file):
Can we use a relative package name here? ast/function_decl.go, line 57 at r1 (raw file):
This trim is not necessary anymore. It was ported from the original Python. Comments from Reviewable |
Reviewed 59 of 125 files at r1. ast/common.go, line 51 at r1 (raw file):
You can remove this now. ast/compound_stmt.go, line 35 at r1 (raw file):
Is this supposed to be here? ast/resolve.go, line 77 at r1 (raw file):
Not for this PR. But I would like to make the whole type resolving system a separate package ( Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. main.go, line 15 at r1 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Relative import paths are highly discouraged, I was going to switch these out at the end with the correct path. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. main.go, line 15 at r1 (raw file): Previously, bongo227 (Ben Sheffield) wrote…
That's fair enough. Or maybe it would be easier to rename your directory path to be the same when this pops up in the future. Comments from Reviewable |
Reviewed 55 of 125 files at r1, 59 of 59 files at r2. ast/ast.go, line 52 at r2 (raw file):
It occurs to me that not all node types will have children, like a type NodeWithChildren interface {
*Node
AddChild(node Node)
} However, this might be a bit too pedantic and maybe more appropriate for a separate PR where each node can be checked if it can indeed have children. ast/common.go, line 51 at r1 (raw file): Previously, elliotchance (Elliot Chance) wrote…
I'm not sure if you have used reviewable before or if you simply haven't responded to these yet. Discussions stay open until you respond (notice the handy "Done" button). Comments from Reviewable |
Review status: all files reviewed at latest revision, 5 unresolved discussions, some commit checks failed. main.go, line 15 at r1 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. ast/ast.go, line 52 at r2 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Is their a spec for the clang AST anywhere? I haven't managed to find one. I agree that a separate PR is probably best for this one. ast/common.go, line 51 at r1 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. ast/compound_stmt.go, line 35 at r1 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. ast/function_decl.go, line 57 at r1 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. ast/resolve.go, line 77 at r1 (raw file): Previously, elliotchance (Elliot Chance) wrote…
Done. I created an issue. Comments from Reviewable |
@bongo227 this is a really great change. I'm happy to merge this in if your ready? Codecov is failing because of the drop in coverage, that's understandable since all the new code. That will be cleaned up over time. |
Their is still a problem with those variable declarations (I just ignore them to parse the tests). This can probably be fixed when resolve is refactored out so I would say merging now would be fine. |
All the ast nodes seemed like a good candidate for separating out into a separate package so the root folder is cleaner.
I also merged
Render()
andRenderLine()
into oneRender()
function since having both seemed redundant, this should also cover #38. This means we can get rid of all the slow reflection since all nodes now implement theast.Node
interface.TODO
_LIB_VERSION, _IO_2_1_stdin_, _IO_2_1_stdout_, _IO_2_1_stderr_, stdin, stdout, stderr
If this is not how you want the project structured feel free to discard this PR.
This change is