MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / PerformLoop

Method PerformLoop

source/script.cpp:10766–10788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10764
10765
10766ResultType Line::PerformLoop(ResultToken *aResultToken, Line *&aJumpToLine, Line *aUntil
10767 , __int64 aIterationLimit, bool aIsInfinite) // bool performs better than BOOL in current benchmarks for this.
10768// This performs much better (by at least 7%) as a function than as inline code, probably because
10769// it's only called to set up the loop, not each time through the loop.
10770{
10771 ResultType result = CONDITION_FALSE;
10772 Line *jump_to_line = nullptr;
10773 global_struct &g = *::g; // Primarily for performance in this case.
10774
10775 for (; aIsInfinite || g.mLoopIteration <= aIterationLimit; ++g.mLoopIteration)
10776 {
10777 // Execute the body of the loop (either just one statement or a block of statements).
10778 // Preparser has ensured that every LOOP has a non-NULL next line.
10779 PERFORMLOOP_EXECUTE_BODY
10780 PERFORMLOOP_EVALUATE_UNTIL
10781 // Since the macro didn't "break", the result of executing the body of the loop was either OK
10782 // (the current iteration completed normally) or LOOP_CONTINUE (the current loop iteration
10783 // was cut short). In both cases, just continue on through the loop.
10784 } // for()
10785
10786 // The script's loop is now over.
10787 return result;
10788}
10789
10790
10791

Callers 1

ExecUntilMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected