Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
rev7176, potential bug
(1/1)
ollydbg:
@loaden:
rev7176, you add a function call
--- Code: --- // After add a variable token, we should skip to semicolon
SkipToOneOfChars(ParserConsts::semicolonclbrace, true);
m_Str.Clear();
--- End code ---
But look at the DoParse() code:
--- Code: --- case ParserConsts::semicolon_chr:
{
m_Str.Clear();
m_PointerOrRef.Clear();
// Notice: clears the queue "m_EncounteredTypeNamespaces"
while (!m_EncounteredTypeNamespaces.empty())
m_EncounteredTypeNamespaces.pop();
m_TemplateArgument.Clear();
}
break;
--- End code ---
So, if you Get(eat) the semicolon too earlier, you have no change to clear the context.
ollydbg:
BTW:
who can explain the logic to detect a "variable" in these code snippet:
--- Code: --- else if ( (peek == ParserConsts::semicolon)
|| ( ( m_Options.useBuffer
&& (peek.GetChar(0) == ParserConsts::opbracket_chr) )
&& (!m_Str.Contains(ParserConsts::dcolon)) ) )
{
if ( !m_Str.IsEmpty()
&& ( wxIsalpha(token.GetChar(0))
|| (token.GetChar(0) == ParserConsts::underscore_chr) ) )
{
if (m_Options.handleVars)
{
Token* newToken = DoAddToken(tkVariable, token, m_Tokenizer.GetLineNumber());
if (newToken && !m_TemplateArgument.IsEmpty())
ResolveTemplateArgs(newToken);
}
// After add a variable token, we should skip to semicolon
SkipToOneOfChars(ParserConsts::semicolonclbrace, true);
m_Str.Clear();
}
}
--- End code ---
Too hard to understand the logic... :(
MortenMacFly:
--- Quote from: ollydbg on May 30, 2011, 08:04:27 am ---So, if you Get(eat) the semicolon too earlier, you have no change to clear the context.
--- End quote ---
I had another concern, but did not try (yet):
What about such constructs:
--- Code: ---void main(void)
{
int a,b,c;
MyClass d,e,f;
}
--- End code ---
... will b,c and e,f be skipped?
Loaden:
--- Quote from: MortenMacFly on May 30, 2011, 09:10:14 am ---
--- Quote from: ollydbg on May 30, 2011, 08:04:27 am ---So, if you Get(eat) the semicolon too earlier, you have no change to clear the context.
--- End quote ---
I had another concern, but did not try (yet):
What about such constructs:
--- Code: ---void main(void)
{
int a,b,c;
MyClass d,e,f;
}
--- End code ---
... will b,c and e,f be skipped?
--- End quote ---
I think no problem.
This can improve performance.
the a,b,c are local variable.
you can try:
--- Code: --- int a,b,c;
MyClass d,e,f;
--- End code ---
Loaden:
--- Quote from: ollydbg on May 30, 2011, 08:04:27 am ---@loaden:
rev7176, you add a function call
--- Code: --- // After add a variable token, we should skip to semicolon
SkipToOneOfChars(ParserConsts::semicolonclbrace, true);
m_Str.Clear();
--- End code ---
But look at the DoParse() code:
--- Code: --- case ParserConsts::semicolon_chr:
{
m_Str.Clear();
m_PointerOrRef.Clear();
// Notice: clears the queue "m_EncounteredTypeNamespaces"
while (!m_EncounteredTypeNamespaces.empty())
m_EncounteredTypeNamespaces.pop();
m_TemplateArgument.Clear();
}
break;
--- End code ---
So, if you Get(eat) the semicolon too earlier, you have no change to clear the context.
--- End quote ---
I see, you are right!
Thanks!
Navigation
[0] Message Index
Go to full version