Fix bug where declarations of arrays of func. ptrs would be lost.

Issue #126.
This commit is contained in:
Matt Pharr
2011-12-05 05:35:47 -08:00
parent f95504fb5e
commit dc525f281d

View File

@@ -492,15 +492,19 @@ Declaration::GetVariableDeclarations() const {
if (declarators[i] == NULL)
continue;
Declarator *decl = declarators[i];
if (decl == NULL || decl->kind == DK_FUNCTION)
// Ignore earlier errors or external function declarations
// inside other functions.
if (decl == NULL)
// Ignore earlier errors
continue;
Symbol *sym = decl->GetSymbol();
m->symbolTable->AddVariable(sym);
vars.push_back(VariableDeclaration(sym, decl->initExpr));
if (dynamic_cast<const FunctionType *>(sym->type) != NULL) {
// function declaration
m->symbolTable->AddFunction(sym);
}
else {
m->symbolTable->AddVariable(sym);
vars.push_back(VariableDeclaration(sym, decl->initExpr));
}
}
return vars;
}