public override InoTypeEnum Visit(FunctioncallAstNode node) //Node does not have any symbol rn :/ (Should ideally share symbol with it's declaration) { if (IsFirstWalk) { return(InoTypeEnum.undefined); } if (node.Symbol.IsExtern && node.Symbol.Type == SALTypeEnum.number) // SUPER ROUGH WORKAROUND - SHOULD BE MODIFIED IN THE FUTURE { node.InoType = InoTypeEnum.@int; return(InoTypeEnum.@int); } else if (node.Symbol.IsExtern) { node.InoType = InoTypeEnum.@void; return(InoTypeEnum.@void); } InoTypeEnum InoType = FunctionTypes[node.Symbol]; CurrentFunction = node.Symbol; node.InoType = InoType; if (!(CalledFunctions.Any(x => x == node))) // If-Statement Makes sure we're not going to evaluate the parameters more than once (first call decides type) { Visit(node.Arguments); CalledFunctions.Add(node); } return(InoType); }
public override string Visit(FunctioncallAstNode node) { if (node.Arguments != null) { return(Visit(node.FunctionId) + $"({Visit(node.Arguments)});"); } else { return(Visit(node.FunctionId) + "();"); } }