void prologue_function(IASNode n)
{
FunctionDefinition func = null;
IFunctionNode funcNode = null;
if ( n instanceof IFunctionNode )
funcNode = (IFunctionNode)n;
else if( n instanceof FunctionObjectNode )
funcNode = ((FunctionObjectNode)n).getFunctionNode();
// Add any parse problems which might have been encountered while lazily parsing the function
if( funcNode instanceof FunctionNode )
{
Collection<ICompilerProblem> parseProblems = ((FunctionNode) funcNode).getParsingProblems();
for( ICompilerProblem problem : parseProblems )
currentScope.addProblem(problem);
}
assert funcNode != null : n + " has no FunctionNode child";
func = (FunctionDefinition)funcNode.getDefinition();
assert(func != null): n + " has no definition.";
currentScope.setLocalASScope(func.getContainedScope());
currentScope.resetDebugInfo();
// Set the current file name - the function body will always start with an OP_debugfile
// so we never need emit another one unless the method body spans multiple files
currentScope.setDebugFile(SemanticUtils.getFileName(n));
currentScope.getMethodBodySemanticChecker().checkFunctionDefinition(funcNode, func);
for ( int i = 0; i < funcNode.getChildCount(); i++ )
scanFunctionBodyForActivations(funcNode.getChild(i));
}