Exemplo n.º 1
0
        public override object VisitFunctionBody(PParser.FunctionBodyContext context)
        {
            // TODO: check that parameters have been added to internal scope?

            // Add all local variables to scope.
            foreach (PParser.VarDeclContext varDeclContext in context.varDecl())
            {
                Visit(varDeclContext);
            }

            // Build the statement trees
            var statementVisitor = new StatementVisitor(handler, machine, method);

            method.Body = new CompoundStmt(context, context.statement().Select(statementVisitor.Visit).ToList());
            return(null);
        }
Exemplo n.º 2
0
 public override object VisitFunctionBody(PParser.FunctionBodyContext context)
 {
     return(null);
 }
Exemplo n.º 3
0
        public override IPStmt VisitFunctionBody(PParser.FunctionBodyContext context)
        {
            List <IPStmt> statements = context.statement().Select(Visit).ToList();

            return(new CompoundStmt(context, statements));
        }