From a3e578f3181a0d963160f501313f8f821d18d3e0 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 15 Mar 2011 19:43:27 +0100 Subject: [PATCH] add some comments --- src/shared/proparser/profileparser.cpp | 4 ++++ src/shared/proparser/profileparser.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shared/proparser/profileparser.cpp b/src/shared/proparser/profileparser.cpp index c6b9821b97..9cfcf8bb06 100644 --- a/src/shared/proparser/profileparser.cpp +++ b/src/shared/proparser/profileparser.cpp @@ -840,6 +840,7 @@ void ProFileParser::leaveScope(ushort *&tokPtr) m_blockstack.resize(m_blockstack.size() - 1); } +// If we are on a fresh line, close all open one-line scopes. void ProFileParser::flushScopes(ushort *&tokPtr) { if (m_state == StNew) { @@ -854,6 +855,7 @@ void ProFileParser::flushScopes(ushort *&tokPtr) } } +// If there is a pending conditional, enter a new scope, otherwise flush scopes. void ProFileParser::flushCond(ushort *&tokPtr) { if (m_state == StCond) { @@ -899,6 +901,8 @@ void ProFileParser::finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr) } BlockScope &top = m_blockstack.top(); if (m_canElse && (!top.special || top.braceLevel)) { + // A list of tests (the last one likely with side effects), + // but no assignment, scope, etc. putTok(tokPtr, TokBranch); // Put empty then block putBlockLen(tokPtr, 0); diff --git a/src/shared/proparser/profileparser.h b/src/shared/proparser/profileparser.h index 5187ef2b7f..304ebff55e 100644 --- a/src/shared/proparser/profileparser.h +++ b/src/shared/proparser/profileparser.h @@ -86,7 +86,7 @@ private: special(other.special), inBranch(other.inBranch) {} ushort *start; // Where this block started; store length here int braceLevel; // Nesting of braces in scope - bool special; // Single-line conditionals cannot have else branches + bool special; // Single-line conditionals inside loops, etc. cannot have else branches bool inBranch; // The 'else' branch of the previous TokBranch is still open }; -- 2.11.0