-
Notifications
You must be signed in to change notification settings - Fork 28
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
Remove inspection function for syntax tree nodes #200
Remove inspection function for syntax tree nodes #200
Conversation
This commit was cherry-picked from a future commit which changed many files.
I carefully created `showDbg` for many syntax nodes so that this commit does not change any test files.
91925be
to
23c3645
Compare
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.
Nice simplification. But while we're at it, could you please remove the toString
printing for all the compiler tests? We should only print this stuff when :p
is on. It's far too verbose and noisy to be done by default.
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.
Hello, I have gone through it myself, and left two comments on areas I'm not quite sure about.
Thanks! |
This PR is extracted from #194. But I'm actually quite dubious about this PR, because manually creating a inspect function for every syntax nodes is really troublesome. I wonder if we can do this by macros or is there anything builtin that can achieve the similar results.TL;DR
The most important change this PR makes is, if you want to:
showDbg
;toString
.Changes
showDbg
function toStatement
(incl.Term
, etc),TypingUnit
, andPgrm
. The functionshowDbg
was there but not available at all of them.toString
functions of these syntax nodes, so that the compiler will synthesize a defaulttoString
for them.mlscript.codegen.Helpers.inspect
and replace all its call withtoString
.Note
I spent some time to make sure that
showDbg
behaves in the same way astoString
before. As a result, only test files that involves the output frommlscript.codegen.Helpers.inspect
should be changed in this PR.