Convert deeply nested if/else to do/while(false) with breaks for parseAttribute#9770
Conversation
✅ Deploy Preview for tiddlywiki-previews ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Confirmed: hoelzro has already signed the Contributor License Agreement (see contributing.md) |
📊 Build Size Comparison:
|
| Branch | Size |
|---|---|
| Base (master) | 2492.6 KB |
| PR | 2492.3 KB |
Diff: ⬇️ Decrease: 0.3 KB
⚠️ Change Note Status
This PR appears to contain code changes but doesn't include a change note.
Please add a change note by creating a .tid file in editions/tw5.com/tiddlers/releasenotes/<version>/
📚 Documentation: Release Notes and Changes
💡 Note: If this is a documentation-only change, you can ignore this message.
|
what does do while (false) mean here? could it be a function return instead? |
|
@linonetwo A function return could be used - but if we did that, the other code at the end of the function body would get missed. And while we could wrap this in an immediately-executed function literal, like this: (function() {
if(cond) {
...
return;
}
...
})();...I feared the overhead of creating and calling those function objects might meaningfully impact performance, hence the |
|
@hoelzro could you please resolve the conflicts? We can now merge this for v5.5.0. |
…eAttribute 01d3cde refactored parseMacroParameterAsAttribute to use a do/while(false) construct with break statements - this updates parseAttribute with an analogous refactoring for consistency
|
@saqimtiaz Should be all set now! |
|
Thank you @hoelzro |
01d3cde refactored
parseMacroParameterAsAttributeto use a do/while(false) construct with break statements - this updatesparseAttributewith an analogous refactoring for consistency