Parser: Separate mandatory and optional arguments in parseArguments#903
Parser: Separate mandatory and optional arguments in parseArguments#903k4b7 merged 2 commits intoKaTeX:masterfrom marcianx:parse-args
Conversation
| * @param {string} name | ||
| * @param {Array<ParseNode>} args | ||
| * @param {Array<?ParseNode>} optArgs | ||
| * @param {Token=} token |
There was a problem hiding this comment.
Is the plan to turn this into flow types at a later date?
There was a problem hiding this comment.
Yes. The point is to write down all our intended types while we refactor to make porting to flow possible. That requires the ParseNode refactor we discussed in #892. Until we're there, writing out these types aids keeping our intended mental model better documented.
| const {args, optArgs} = this.parseArguments(func, funcData); | ||
| const token = baseGroup.token; | ||
| const result = this.callFunction(func, args, token); | ||
| const result = this.callFunction(func, args, optArgs, token); |
|
Looks like something changed in the output of the |
|
I'm not sure what's going on with |
|
Must have been something flaky. After rebasing to new master, all checks seem to succeed on Travis. |
| let arg = argType ? | ||
| this.parseGroupOfType(argType, isOptional) : | ||
| this.parseGroup(isOptional); | ||
| if (!arg) { |

This is for improved type strictness per one of the TODOs toward #892.
This overlaps in a minor way with PR 901, but since I don't know whether the former would require any discussion, I kept this PR independent.
It does require manual merging/rebasing (automatic doesn't work), but it's trivial.