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

View File

@@ -494,6 +494,7 @@ declaration_statement
$$ = NULL;
}
else {
$1->DeclareFunctions();
std::vector<VariableDeclaration> vars = $1->GetVariableDeclarations();
$$ = new DeclStmt(vars, @1);
}