Changed startOffset to point to the start of the scope.

This commit is contained in:
Erik Verbruggen
2010-07-16 15:26:37 +02:00
parent 03402a07d9
commit cb4104e171
3 changed files with 17 additions and 4 deletions

View File

@@ -310,9 +310,13 @@ bool CheckSpecifier::visit(ClassSpecifierAST *ast)
if (ast->name)
sourceLocation = ast->name->firstToken();
unsigned classScopeStart = tokenAt(ast->firstToken()).offset;
if (ast->lbrace_token)
classScopeStart = tokenAt(ast->lbrace_token).end();
const Name *className = semantic()->check(ast->name, _scope);
Class *klass = control()->newClass(sourceLocation, className);
klass->setStartOffset(tokenAt(ast->firstToken()).offset);
klass->setStartOffset(classScopeStart);
klass->setEndOffset(tokenAt(ast->lastToken() - 1).end());
ast->symbol = klass;
unsigned classKey = tokenKind(ast->classkey_token);
@@ -397,9 +401,13 @@ bool CheckSpecifier::visit(EnumSpecifierAST *ast)
if (ast->name)
sourceLocation = ast->name->firstToken();
unsigned scopeStart = tokenAt(ast->firstToken()).offset;
if (ast->lbrace_token)
scopeStart = tokenAt(ast->lbrace_token).end();
const Name *name = semantic()->check(ast->name, _scope);
Enum *e = control()->newEnum(sourceLocation, name);
e->setStartOffset(tokenAt(ast->firstToken()).offset);
e->setStartOffset(scopeStart);
e->setEndOffset(tokenAt(ast->lastToken() - 1).end());
e->setVisibility(semantic()->currentVisibility());
_scope->enterSymbol(e);