Commit 592396c2 authored by Christian Kamm's avatar Christian Kamm Committed by con
Browse files

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
parent 2e650d0f
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment