Fix bug where declarations of arrays of func. ptrs would be lost.
Issue #126.
This commit is contained in:
16
decl.cpp
16
decl.cpp
@@ -492,15 +492,19 @@ Declaration::GetVariableDeclarations() const {
|
|||||||
if (declarators[i] == NULL)
|
if (declarators[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
Declarator *decl = declarators[i];
|
Declarator *decl = declarators[i];
|
||||||
if (decl == NULL || decl->kind == DK_FUNCTION)
|
if (decl == NULL)
|
||||||
// Ignore earlier errors or external function declarations
|
// Ignore earlier errors
|
||||||
// inside other functions.
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Symbol *sym = decl->GetSymbol();
|
Symbol *sym = decl->GetSymbol();
|
||||||
m->symbolTable->AddVariable(sym);
|
if (dynamic_cast<const FunctionType *>(sym->type) != NULL) {
|
||||||
|
// function declaration
|
||||||
vars.push_back(VariableDeclaration(sym, decl->initExpr));
|
m->symbolTable->AddFunction(sym);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m->symbolTable->AddVariable(sym);
|
||||||
|
vars.push_back(VariableDeclaration(sym, decl->initExpr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return vars;
|
return vars;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user