QmlJS: Fix member completion at the end of a nested object definition.

The parser's error recovery generates three nested object definitions
for code like
Item { Item { font } }
where the innermost definition corresponds to 'font }' and has an empty
lbrace token.

If we create a Range for this recovered definition, code completion will
fail for 'font.'.

Task-number: QTCREATORBUG-2767
Reviewed-by: Roberto Raggi
This commit is contained in:
Christian Kamm
2010-10-27 11:11:36 +02:00
committed by con
parent 2e650d0fa1
commit 592396c254

View File

@@ -404,14 +404,14 @@ protected:
virtual bool visit(AST::UiObjectBinding *ast)
{
if (ast->initializer)
if (ast->initializer && ast->initializer->lbraceToken.length)
_ranges.append(createRange(ast, ast->initializer));
return true;
}
virtual bool visit(AST::UiObjectDefinition *ast)
{
if (ast->initializer)
if (ast->initializer && ast->initializer->lbraceToken.length)
_ranges.append(createRange(ast, ast->initializer));
return true;
}