forked from qt-creator/qt-creator
add some comments
This commit is contained in:
@@ -840,6 +840,7 @@ void ProFileParser::leaveScope(ushort *&tokPtr)
|
|||||||
m_blockstack.resize(m_blockstack.size() - 1);
|
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)
|
void ProFileParser::flushScopes(ushort *&tokPtr)
|
||||||
{
|
{
|
||||||
if (m_state == StNew) {
|
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)
|
void ProFileParser::flushCond(ushort *&tokPtr)
|
||||||
{
|
{
|
||||||
if (m_state == StCond) {
|
if (m_state == StCond) {
|
||||||
@@ -899,6 +901,8 @@ void ProFileParser::finalizeCond(ushort *&tokPtr, ushort *uc, ushort *ptr)
|
|||||||
}
|
}
|
||||||
BlockScope &top = m_blockstack.top();
|
BlockScope &top = m_blockstack.top();
|
||||||
if (m_canElse && (!top.special || top.braceLevel)) {
|
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);
|
putTok(tokPtr, TokBranch);
|
||||||
// Put empty then block
|
// Put empty then block
|
||||||
putBlockLen(tokPtr, 0);
|
putBlockLen(tokPtr, 0);
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ private:
|
|||||||
special(other.special), inBranch(other.inBranch) {}
|
special(other.special), inBranch(other.inBranch) {}
|
||||||
ushort *start; // Where this block started; store length here
|
ushort *start; // Where this block started; store length here
|
||||||
int braceLevel; // Nesting of braces in scope
|
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
|
bool inBranch; // The 'else' branch of the previous TokBranch is still open
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user