-
Notifications
You must be signed in to change notification settings - Fork 1
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
TASK: Split parsing logic from AST objects #31
Conversation
7aa7a59
to
8cc5fd4
Compare
cd7ef26
to
57b82e5
Compare
This also turns the EnumName class into a domain concern.
54a3d40
to
fb4b6c5
Compare
5efc19a
to
36cd9bb
Compare
$this->booleanLiteralParser ??= BooleanLiteralParser::singleton(); | ||
|
||
$booleanLiteralNode = $this->booleanLiteralParser->parse($tokens); |
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.
I dont think, we need this second instance cache layer. Calling ::singleton()
every-time should be fine?
Also it seems we are not using it for tests to swap out implementations...
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.
The underlying consideration is:
using($this->booleanLiteralParser) = cost_of(ReferenceLookup)
vs.
using(BooleanLiteralParser::singleton()) = cost_of(FunctionCall) + cost_of(ReferenceLookup)
It's just a performance optimization (maybe a bit over the top, but it's not nothing :D).
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.
As I'm working on #34, I noticed that I'm just one step away from being able to make all parsers static.
That will effectively eliminate this problem :)
Remaining TODOs