Commit 0497c535 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

cleanup

parent b409202b
......@@ -333,8 +333,8 @@ BaseSpecifierAST *BaseSpecifierAST::clone(MemoryPool *pool) const
{
BaseSpecifierAST *ast = new (pool) BaseSpecifierAST;
ast->comma_token = comma_token;
ast->token_virtual = token_virtual;
ast->token_access_specifier = token_access_specifier;
ast->virtual_token = virtual_token;
ast->access_specifier_token = access_specifier_token;
if (name)
ast->name = name->clone(pool);
if (next)
......@@ -352,8 +352,8 @@ void BaseSpecifierAST::accept0(ASTVisitor *visitor)
unsigned BaseSpecifierAST::firstToken() const
{
if (token_virtual && token_access_specifier)
return std::min(token_virtual, token_access_specifier);
if (virtual_token && access_specifier_token)
return std::min(virtual_token, access_specifier_token);
return name->firstToken();
}
......@@ -361,12 +361,12 @@ unsigned BaseSpecifierAST::lastToken() const
{
if (name)
return name->lastToken();
else if (token_virtual && token_access_specifier)
return std::min(token_virtual, token_access_specifier) + 1;
else if (token_virtual)
return token_virtual + 1;
else if (token_access_specifier)
return token_access_specifier + 1;
else if (virtual_token && access_specifier_token)
return std::min(virtual_token, access_specifier_token) + 1;
else if (virtual_token)
return virtual_token + 1;
else if (access_specifier_token)
return access_specifier_token + 1;
// assert?
return 0;
}
......@@ -441,7 +441,7 @@ unsigned BinaryExpressionAST::lastToken() const
BoolLiteralAST *BoolLiteralAST::clone(MemoryPool *pool) const
{
BoolLiteralAST *ast = new (pool) BoolLiteralAST;
ast->token = token;
ast->literal_token = literal_token;
return ast;
}
......@@ -454,12 +454,12 @@ void BoolLiteralAST::accept0(ASTVisitor *visitor)
unsigned BoolLiteralAST::firstToken() const
{
return token;
return literal_token;
}
unsigned BoolLiteralAST::lastToken() const
{
return token + 1;
return literal_token + 1;
}
CompoundLiteralAST *CompoundLiteralAST::clone(MemoryPool *pool) const
......@@ -1928,7 +1928,7 @@ LinkageSpecificationAST *LinkageSpecificationAST::clone(MemoryPool *pool) const
{
LinkageSpecificationAST *ast = new (pool) LinkageSpecificationAST;
ast->extern_token = extern_token;
ast->extern_type = extern_type;
ast->extern_type_token = extern_type_token;
if (declaration)
ast->declaration = declaration->clone(pool);
return ast;
......@@ -1951,8 +1951,8 @@ unsigned LinkageSpecificationAST::lastToken() const
{
if (declaration)
return declaration->lastToken();
else if (extern_type)
return extern_type + 1;
else if (extern_type_token)
return extern_type_token + 1;
return extern_token + 1;
}
......@@ -2101,7 +2101,7 @@ NamespaceAliasDefinitionAST *NamespaceAliasDefinitionAST::clone(MemoryPool *pool
{
NamespaceAliasDefinitionAST *ast = new (pool) NamespaceAliasDefinitionAST;
ast->namespace_token = namespace_token;
ast->namespace_name = namespace_name;
ast->namespace_name_token = namespace_name_token;
ast->equal_token = equal_token;
if (name)
ast->name = name->clone(pool);
......@@ -2130,8 +2130,8 @@ unsigned NamespaceAliasDefinitionAST::lastToken() const
return name->lastToken();
else if (equal_token)
return equal_token + 1;
else if (namespace_name)
return namespace_name + 1;
else if (namespace_name_token)
return namespace_name_token + 1;
return namespace_token + 1;
}
......@@ -2438,7 +2438,7 @@ unsigned NewTypeIdAST::lastToken() const
NumericLiteralAST *NumericLiteralAST::clone(MemoryPool *pool) const
{
NumericLiteralAST *ast = new (pool) NumericLiteralAST;
ast->token = token;
ast->literal_token = literal_token;
return ast;
}
......@@ -2451,12 +2451,12 @@ void NumericLiteralAST::accept0(ASTVisitor *visitor)
unsigned NumericLiteralAST::firstToken() const
{
return token;
return literal_token;
}
unsigned NumericLiteralAST::lastToken() const
{
return token + 1;
return literal_token + 1;
}
OperatorAST *OperatorAST::clone(MemoryPool *pool) const
......@@ -3005,7 +3005,7 @@ unsigned SizeofExpressionAST::lastToken() const
StringLiteralAST *StringLiteralAST::clone(MemoryPool *pool) const
{
StringLiteralAST *ast = new (pool) StringLiteralAST;
ast->token = token;
ast->literal_token = literal_token;
if (next)
ast->next = next->clone(pool);
return ast;
......@@ -3021,14 +3021,14 @@ void StringLiteralAST::accept0(ASTVisitor *visitor)
unsigned StringLiteralAST::firstToken() const
{
return token;
return literal_token;
}
unsigned StringLiteralAST::lastToken() const
{
if (next)
return next->lastToken();
return token + 1;
return literal_token + 1;
}
SwitchStatementAST *SwitchStatementAST::clone(MemoryPool *pool) const
......
......@@ -488,8 +488,8 @@ class CPLUSPLUS_EXPORT BaseSpecifierAST: public AST
{
public:
unsigned comma_token;
unsigned token_virtual;
unsigned token_access_specifier;
unsigned virtual_token;
unsigned access_specifier_token;
NameAST *name;
BaseSpecifierAST *next;
......@@ -1218,7 +1218,7 @@ class CPLUSPLUS_EXPORT LinkageSpecificationAST: public DeclarationAST
{
public:
unsigned extern_token;
unsigned extern_type;
unsigned extern_type_token;
DeclarationAST *declaration;
public:
......@@ -1431,7 +1431,7 @@ class CPLUSPLUS_EXPORT NamespaceAliasDefinitionAST: public DeclarationAST
{
public:
unsigned namespace_token;
unsigned namespace_name;
unsigned namespace_name_token;
unsigned equal_token;
NameAST *name;
unsigned semicolon_token;
......@@ -1964,7 +1964,7 @@ protected:
class CPLUSPLUS_EXPORT NumericLiteralAST: public ExpressionAST
{
public:
unsigned token;
unsigned literal_token;
public:
virtual NumericLiteralAST *asNumericLiteral()
......@@ -1982,7 +1982,7 @@ protected:
class CPLUSPLUS_EXPORT BoolLiteralAST: public ExpressionAST
{
public:
unsigned token;
unsigned literal_token;
public:
virtual BoolLiteralAST *asBoolLiteral()
......@@ -2038,7 +2038,7 @@ protected:
class CPLUSPLUS_EXPORT StringLiteralAST: public ExpressionAST
{
public:
unsigned token;
unsigned literal_token;
StringLiteralAST *next;
public:
......
......@@ -321,10 +321,10 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
Name *baseClassName = semantic()->check(base->name, _scope);
BaseClass *baseClass = control()->newBaseClass(ast->firstToken(), baseClassName);
base->symbol = baseClass;
if (base->token_virtual)
if (base->virtual_token)
baseClass->setVirtual(true);
if (base->token_access_specifier) {
int accessSpecifier = tokenKind(base->token_access_specifier);
if (base->access_specifier_token) {
int accessSpecifier = tokenKind(base->access_specifier_token);
int visibility = semantic()->visibilityForAccessSpecifier(accessSpecifier);
baseClass->setVisibility(visibility);
}
......
......@@ -450,7 +450,7 @@ bool Parser::parseLinkageSpecification(DeclarationAST *&node)
if (LA() == T_EXTERN && LA(2) == T_STRING_LITERAL) {
LinkageSpecificationAST *ast = new (_pool) LinkageSpecificationAST;
ast->extern_token = consumeToken();
ast->extern_type = consumeToken();
ast->extern_type_token = consumeToken();
if (LA() == T_LBRACE)
parseLinkageBody(ast->declaration);
......@@ -503,7 +503,7 @@ bool Parser::parseNamespace(DeclarationAST *&node)
NamespaceAliasDefinitionAST *ast =
new (_pool) NamespaceAliasDefinitionAST;
ast->namespace_token = namespace_token;
ast->namespace_name = consumeToken();
ast->namespace_name_token = consumeToken();
ast->equal_token = consumeToken();
parseName(ast->name);
match(T_SEMICOLON, &ast->semicolon_token);
......@@ -1694,18 +1694,18 @@ bool Parser::parseBaseSpecifier(BaseSpecifierAST *&node)
BaseSpecifierAST *ast = new (_pool) BaseSpecifierAST;
if (LA() == T_VIRTUAL) {
ast->token_virtual = consumeToken();
ast->virtual_token = consumeToken();
int tk = LA();
if (tk == T_PUBLIC || tk == T_PROTECTED || tk == T_PRIVATE)
ast->token_access_specifier = consumeToken();
ast->access_specifier_token = consumeToken();
} else {
int tk = LA();
if (tk == T_PUBLIC || tk == T_PROTECTED || tk == T_PRIVATE)
ast->token_access_specifier = consumeToken();
ast->access_specifier_token = consumeToken();
if (LA() == T_VIRTUAL)
ast->token_virtual = consumeToken();
ast->virtual_token = consumeToken();
}
parseName(ast->name);
......@@ -1794,7 +1794,7 @@ bool Parser::parseStringLiteral(ExpressionAST *&node)
while (LA() == T_STRING_LITERAL || LA() == T_WIDE_STRING_LITERAL) {
*ast = new (_pool) StringLiteralAST;
(*ast)->token = consumeToken();
(*ast)->literal_token = consumeToken();
ast = &(*ast)->next;
}
return true;
......@@ -2215,7 +2215,7 @@ bool Parser::parseNamespaceAliasDefinition(DeclarationAST *&node)
if (LA() == T_NAMESPACE && LA(2) == T_IDENTIFIER && LA(3) == T_EQUAL) {
NamespaceAliasDefinitionAST *ast = new (_pool) NamespaceAliasDefinitionAST;
ast->namespace_token = consumeToken();
ast->namespace_name = consumeToken();
ast->namespace_name_token = consumeToken();
ast->equal_token = consumeToken();
parseName(ast->name);
match(T_SEMICOLON, &ast->semicolon_token);
......@@ -2622,7 +2622,7 @@ bool Parser::parseBoolLiteral(ExpressionAST *&node)
{
if (LA() == T_TRUE || LA() == T_FALSE) {
BoolLiteralAST *ast = new (_pool) BoolLiteralAST;
ast->token = consumeToken();
ast->literal_token = consumeToken();
node = ast;
return true;
}
......@@ -2634,7 +2634,7 @@ bool Parser::parseNumericLiteral(ExpressionAST *&node)
if (LA() == T_INT_LITERAL || LA() == T_FLOAT_LITERAL ||
LA() == T_CHAR_LITERAL || LA() == T_WIDE_CHAR_LITERAL) {
NumericLiteralAST *ast = new (_pool) NumericLiteralAST;
ast->token = consumeToken();
ast->literal_token = consumeToken();
node = ast;
return true;
}
......@@ -2733,7 +2733,7 @@ bool Parser::parseObjCStringLiteral(ExpressionAST *&node)
while (LA() == T_AT_STRING_LITERAL) {
*ast = new (_pool) StringLiteralAST;
(*ast)->token = consumeToken();
(*ast)->literal_token = consumeToken();
ast = &(*ast)->next;
}
return true;
......
......@@ -192,8 +192,8 @@ bool PrettyPrinter::visit(AttributeAST *ast)
bool PrettyPrinter::visit(BaseSpecifierAST *ast)
{
outToken(ast->token_virtual);
outToken(ast->token_access_specifier);
outToken(ast->virtual_token);
outToken(ast->access_specifier_token);
accept(ast->name);
return false;
}
......@@ -208,7 +208,7 @@ bool PrettyPrinter::visit(BinaryExpressionAST *ast)
bool PrettyPrinter::visit(BoolLiteralAST *ast)
{
outToken(ast->token);
outToken(ast->literal_token);
return false;
}
......@@ -636,8 +636,8 @@ bool PrettyPrinter::visit(LinkageBodyAST *ast)
bool PrettyPrinter::visit(LinkageSpecificationAST *ast)
{
outToken(ast->extern_token);
if (ast->extern_type) {
outToken(ast->extern_type);
if (ast->extern_type_token) {
outToken(ast->extern_type_token);
}
accept(ast->declaration);
......@@ -681,7 +681,7 @@ bool PrettyPrinter::visit(NamespaceAST *ast)
bool PrettyPrinter::visit(NamespaceAliasDefinitionAST *ast)
{
outToken(ast->namespace_token);
outToken(ast->namespace_name);
outToken(ast->namespace_name_token);
outToken(ast->equal_token);
accept(ast->name);
outToken(ast->semicolon_token);
......@@ -770,7 +770,7 @@ bool PrettyPrinter::visit(NewTypeIdAST *ast)
bool PrettyPrinter::visit(NumericLiteralAST *ast)
{
outToken(ast->token);
outToken(ast->literal_token);
return false;
}
......@@ -913,7 +913,7 @@ bool PrettyPrinter::visit(SizeofExpressionAST *ast)
bool PrettyPrinter::visit(StringLiteralAST *ast)
{
for (StringLiteralAST *it = ast; it; it = it->next) {
outToken(it->token);
outToken(it->literal_token);
}
return false;
}
......
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