More work on scope suport.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5119 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-08-04 18:47:01 +00:00
parent d1efe1af90
commit 3593eb2869
4 changed files with 25 additions and 41 deletions

View File

@@ -76,7 +76,7 @@ Scope* ReadScope (FILE* F, ObjData* Obj, unsigned Id)
Scope* S = NewScope (Obj, Id);
/* Read the data from file */
S->Parent.Id = ReadVar (F);
S->ParentId = ReadVar (F);
S->LexicalLevel = ReadVar (F);
S->Flags = ReadVar (F);
S->Type = ReadVar (F);
@@ -94,29 +94,6 @@ Scope* ReadScope (FILE* F, ObjData* Obj, unsigned Id)
void ResolveScopes (ObjData* Obj)
/* Resolve a scope list. */
{
unsigned I;
/* Walk over the list and resolve the parent ids. */
for (I = 0; I < CollCount (&Obj->Scopes); ++I) {
/* Get the scope */
Scope* S = CollAtUnchecked (&Obj->Scopes, I);
/* Resolve the parent id. The root scope doesn't have a parent */
if (S->Id == 0) {
/* Root scope */
S->Parent.Scope = 0;
} else {
S->Parent.Scope = GetObjScope (Obj, S->Parent.Id);
}
}
}
void PrintDbgScopes (FILE* F)
/* Output the scopes to a debug info file */
{
@@ -144,8 +121,8 @@ void PrintDbgScopes (FILE* F)
fprintf (F, ",size=%lu", S->Size);
}
/* Print parent if available */
if (S->Parent.Scope) {
fprintf (F, ",parent=%u", BaseId + S->Parent.Scope->Id);
if (S->Id != S->ParentId) {
fprintf (F, ",parent=%u", BaseId + S->ParentId);
}
/* Terminate the output line */