Support function declarations in the definitions of other functions.

As part of this, function declarations are no longer scoped (this is permitted
by the C standard, as it turns out.)  So code like:

   void foo() { void bar(); }
   void bat() { bar(); }

Compiles correctly; the declaration of bar() in foo() is still available in the
definition of bar().

Fixes issue #129.
This commit is contained in:
Matt Pharr
2012-01-06 13:50:10 -08:00
parent 9b68b9087a
commit 4f97262cf2
5 changed files with 68 additions and 66 deletions

4
decl.h
View File

@@ -210,6 +210,10 @@ public:
Declarator representation.) */
std::vector<VariableDeclaration> GetVariableDeclarations() const;
/** For any function declarations in the Declaration, add the
declaration to the module. */
void DeclareFunctions();
DeclSpecs *declSpecs;
std::vector<Declarator *> declarators;
};