Removes lots of else-ifs from ScriptParser::run();
Details
Diff Detail
Event Timeline
Removed all changes except one because:
- Moving allocator inside ScriptParser was not good idea. Its much more clear to know it's lifetime is attached to LinkerScript class and not to parser. It did not work correctly I think.
- Restored checks of Error flag where removed. That also was incorrect change, thanks to Rui Ueyama for noticing that during review of another patch.
| ELF/LinkerScript.cpp | ||
|---|---|---|
| 143 | Actually. The if is on a repeated call to find. So just use auto C = Cmd.find(Tok); C->second(*this); | |
LGTM with a few nits.
| ELF/LinkerScript.cpp | ||
|---|---|---|
| 92 | Remove this function and move the code inside the constructor. | |
| 143 | Please rename C -> It (because it is not a command but an iterator.) | |
| 144–145 | Please assign to a local variable to make the actual type explicit. if (It != Cmd.end()) {
std::function<void(ScriptParser &)> &Handler = It->second;
Handler();
} else {
setError(...);
} | |
Remove this function and move the code inside the constructor.