Skip to content

Convert deeply nested if/else to do/while(false) with breaks for parseAttribute#9770

Merged
saqimtiaz merged 1 commit into
TiddlyWiki:masterfrom
hoelzro:master
Jul 13, 2026
Merged

Convert deeply nested if/else to do/while(false) with breaks for parseAttribute#9770
saqimtiaz merged 1 commit into
TiddlyWiki:masterfrom
hoelzro:master

Conversation

@hoelzro

@hoelzro hoelzro commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

01d3cde refactored parseMacroParameterAsAttribute to use a do/while(false) construct with break statements - this updates parseAttribute with an analogous refactoring for consistency

@netlify

netlify Bot commented Mar 31, 2026

Copy link
Copy Markdown

Deploy Preview for tiddlywiki-previews ready!

Name Link
🔨 Latest commit 6908bd8
🔍 Latest deploy log https://app.netlify.com/projects/tiddlywiki-previews/deploys/6a542fd73db9d300084ed9f2
😎 Deploy Preview https://deploy-preview-9770--tiddlywiki-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown

Confirmed: hoelzro has already signed the Contributor License Agreement (see contributing.md)

@github-actions

github-actions Bot commented Mar 31, 2026

Copy link
Copy Markdown

📊 Build Size Comparison: empty.html

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.

@linonetwo

Copy link
Copy Markdown
Contributor

what does do while (false) mean here? could it be a function return instead?

@hoelzro

hoelzro commented Apr 6, 2026

Copy link
Copy Markdown
Contributor Author

@linonetwo do { ... } while(false) just means the "loop" will run exactly once - so it's not really a loop at all! This is definitely a little weird, but it's for the sake of the break statements.

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 do/while(false).

@saqimtiaz

Copy link
Copy Markdown
Member

@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
@hoelzro

hoelzro commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@saqimtiaz Should be all set now!

@saqimtiaz

Copy link
Copy Markdown
Member

Thank you @hoelzro

@saqimtiaz
saqimtiaz merged commit 1eb7ec4 into TiddlyWiki:master Jul 13, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Planning for v5.5.0 Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants