public override SLValue VisitFunctionDecl(FunctionDeclContext ctx) { List <ITerminalNode> param = ctx.idList() != null?ctx.idList().Identifier().ToList() : new List <ITerminalNode>(); List <TypeDefContext> paramType = ctx.idList() != null?ctx.idList().typeDef().ToList() : new List <TypeDefContext>(); IParseTree block = ctx.block(); String id = ctx.Identifier().GetText(); // + param.Count; functions[id] = new Function(param, paramType, block); return(SLValue.VOID); }
/// <summary> /// Pushes a <see cref="FunctionDeclContext"/> to the stack. /// </summary> /// <param name="context">The context.</param> public void PushFunctionDecl(FunctionDeclContext context) { Push(LocationTypes.FunctionDecl, context); }