OSDN Git Service

add some comments
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Tue, 15 Mar 2011 18:43:27 +0000 (19:43 +0100)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>
Wed, 16 Mar 2011 11:24:37 +0000 (12:24 +0100)
src/shared/proparser/profileparser.cpp
src/shared/proparser/profileparser.h

index c6b9821..9cfcf8b 100644 (file)
@@ -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);
index 5187ef2..304ebff 100644 (file)
@@ -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
     };