forked from qt-creator/qt-creator
C++: Split designator AST
Change-Id: I9bfed2023624c818c0f35f24476693cffeaf2bbc Reviewed-by: Wang Hoi <wanghoi@126.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
cb079c5319
commit
ea4b4bff40
68
src/libs/3rdparty/cplusplus/AST.cpp
vendored
68
src/libs/3rdparty/cplusplus/AST.cpp
vendored
@@ -4478,41 +4478,49 @@ unsigned DesignatedInitializerAST::lastToken() const
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned DesignatorAST::firstToken() const
|
||||
/** \generated */
|
||||
unsigned BracketDesignatorAST::firstToken() const
|
||||
{
|
||||
if (type == DesignatorAST::Dot) {
|
||||
if (u.dot.dot_token)
|
||||
return u.dot.dot_token;
|
||||
if (u.dot.identifier_token)
|
||||
return u.dot.identifier_token;
|
||||
} else if (type == DesignatorAST::Bracket) {
|
||||
if (u.bracket.lbracket_token)
|
||||
return u.bracket.lbracket_token;
|
||||
if (u.bracket.expression)
|
||||
if (unsigned candidate = u.bracket.expression->firstToken())
|
||||
return candidate;
|
||||
if (u.bracket.rbracket_token)
|
||||
return u.bracket.rbracket_token;
|
||||
}
|
||||
if (lbracket_token)
|
||||
return lbracket_token;
|
||||
if (expression)
|
||||
if (unsigned candidate = expression->firstToken())
|
||||
return candidate;
|
||||
if (rbracket_token)
|
||||
return rbracket_token;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned DesignatorAST::lastToken() const
|
||||
/** \generated */
|
||||
unsigned BracketDesignatorAST::lastToken() const
|
||||
{
|
||||
if (type == DesignatorAST::Dot) {
|
||||
if (u.dot.identifier_token)
|
||||
return u.dot.identifier_token + 1;
|
||||
if (u.dot.dot_token)
|
||||
return u.dot.dot_token + 1;
|
||||
} else if (type == DesignatorAST::Bracket) {
|
||||
if (u.bracket.rbracket_token)
|
||||
return u.bracket.rbracket_token + 1;
|
||||
if (u.bracket.expression)
|
||||
if (unsigned candidate = u.bracket.expression->lastToken())
|
||||
return candidate;
|
||||
if (u.bracket.lbracket_token)
|
||||
return u.bracket.lbracket_token + 1;
|
||||
}
|
||||
if (rbracket_token)
|
||||
return rbracket_token + 1;
|
||||
if (expression)
|
||||
if (unsigned candidate = expression->lastToken())
|
||||
return candidate;
|
||||
if (lbracket_token)
|
||||
return lbracket_token + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** \generated */
|
||||
unsigned DotDesignatorAST::firstToken() const
|
||||
{
|
||||
if (dot_token)
|
||||
return dot_token;
|
||||
if (identifier_token)
|
||||
return identifier_token;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** \generated */
|
||||
unsigned DotDesignatorAST::lastToken() const
|
||||
{
|
||||
if (identifier_token)
|
||||
return identifier_token + 1;
|
||||
if (dot_token)
|
||||
return dot_token + 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user