-
Notifications
You must be signed in to change notification settings - Fork 185
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/1697 introduce parse function which returns ParsedCommand #1698
Conversation
I just had an idea... |
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’m not sure I understand the name change here. CommandParser
describes and action. It does something that the name describes. ParsedCommand
, however, suggests a thing has already been done. This name describes an immutable thing.
Perhaps that’s the direction? I want to call it out now, tho, cause naming is incredibly important.
@n8rzz Your totally right, I updated the PR now such that there is an actual |
264ef64
to
c357ea3
Compare
c357ea3
to
076617d
Compare
e87333b
to
52f106c
Compare
This is better :) The parser logic is now separated from the command that is returned. |
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.
Just a couple small things and you’re good to go.
|
||
if (aircraftCommandParser.command !== PARSED_COMMAND_NAME.TRANSMIT) { | ||
return this.processSystemCommand(aircraftCommandParser); | ||
const parsedCommand = cmd; |
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.
Why are we reassigning here? Could we continue to use cmd
?
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 reason is that I want the parsed command to be const
, but I cannot do it in the try block as it is then only scoped to the block. To make it const
, I need to trick and use a reassign here.
2992535
to
1b5dfa2
Compare
Closes #1697
By this, the call site in
InputController.js
gets more readable.Consider this PR as a trick to reduce the diff of the following PR. Once this is merged, I can start to separate the parsing process from the command that is returned and handled.