public void Visit(FunctionCallNode call) { foreach (var arg in call.Arguments) { arg.Accept(this); } Emit("{0}();", call.Name.Name); }
public PrinterNode Visit(FunctionCallNode node) { var pNode = new PrinterNode("Function"); pNode.AddChild(node.Name.Accept(this)); foreach (var arg in node.Args) { pNode.AddChild(arg.Accept(this)); } return(pNode); }
public void Visit(FunctionCallNode call) { foreach (var argument in call.Arguments) { argument.Accept(this); } string argumentTypes = string.Join(", ", Enumerable.Repeat("int32", call.Arguments.Count)); string signature = string.Format("int32 Vsl.VslMain::{0}({1})", call.Name.Name, argumentTypes); EmitComment("Call function " + call.Name.Name); Emit("call", signature); }
public void Visit(FunctionCallNode call) { foreach (var argument in call.Arguments) { argument.Accept(this); } var argumentTypes = new string('I', call.Arguments.Count); string signature = string.Format("VslMain/{0}({1})I", call.Name.Name, argumentTypes); EmitComment("Call function " + call.Name.Name); Emit("invokestatic", signature); }
public void VisitFunctionCallNode(FunctionCallNode node) { node.Accept(this.typeChecker); VariableIdNode idNode = node.IdNode; ArgumentsNode arguments = node.ArgumentsNode; idNode.Accept(this); if (arguments != null) { arguments.Accept(this); if (!analyzer.SyntaxTree.Root.Functions.ContainsKey(idNode.ID)) { analyzer.notifyError(new NotAValidFunctionError(idNode)); } else { FunctionNode function = analyzer.SyntaxTree.Root.Functions [idNode.ID]; CompareParamsAndArgs(node, function.Parameters.Parameters, arguments.Arguments); } } }
public InvalidArgumentError(FunctionCallNode callNode, int position, TokenType parameterEvaluation = TokenType.UNDEFINED, TokenType argumentEvaluation = TokenType.UNDEFINED) : base(ErrorConstants.SEMANTIC_ERROR_TITLE, ErrorConstants.INVALID_ARGUMENT_ERROR_MSG(position, parameterEvaluation, argumentEvaluation), callNode) { }
public ProcedureCallNode(FunctionCallNode function) { Function = function; }
public bool Visit(FunctionCallNode node) { if (node.Type != null) { return(true); } node.Name.Accept(this); //todo: rmk when add pointers if (!(node.Name.Type is SymFunc funcIdentifier)) { var t = ExprNode.GetClosestToken(node); throw new FunctionExpectedException(node.Name.Type, t.Lexeme, t.Line, t.Column); } foreach (var arg in node.Args) { arg.Accept(this); } //the very special crutches if (node.Name.Type is ExitSymFunc exit) { if (FunctionReturnType == null) { if (node.Args.Count != 0) { var t = ExprNode.GetClosestToken(node.Name); throw new WrongArgumentsNumberException(0, node.Args.Count, t.Lexeme, t.Line, t.Column); } } else { if (node.Args.Count != 1) { var t = ExprNode.GetClosestToken(node.Name); throw new WrongArgumentsNumberException(0, node.Args.Count, t.Lexeme, t.Line, t.Column); } var tmp = node.Args[0]; _typeChecker.RequireCast(FunctionReturnType, ref tmp); node.Args[0] = tmp; } node.Symbol = _stack.ExitFunc; return(true); } if (node.Name.Type is HighSymFunc high) { node.Symbol = _stack.HighFunc; node.Type = _stack.HighFunc.ReturnType; var t = ExprNode.GetClosestToken(node.Name); if (node.Args.Count != 1) { throw new WrongArgumentsNumberException(1, node.Args.Count, t.Lexeme, t.Line, t.Column); } if (!(node.Args[0].Type is SymArray || node.Args[0].Type is OpenArray)) { throw new IllegalExprException(t.Lexeme, t.Line, t.Column); } return(true); } if (node.Name.Type is LowSymFunc low) { node.Symbol = _stack.LowFunc; node.Type = _stack.LowFunc.ReturnType; var t = ExprNode.GetClosestToken(node.Name); if (node.Args.Count != 1) { throw new WrongArgumentsNumberException(1, node.Args.Count, t.Lexeme, t.Line, t.Column); } if (!(node.Args[0].Type is SymArray || node.Args[0].Type is OpenArray)) { throw new IllegalExprException(t.Lexeme, t.Line, t.Column); } //inline functions add here return(true); } var symbol = _typeChecker.RequireFunction(ExprNode.GetClosestToken(node.Name), funcIdentifier, node.Args); node.Type = symbol.ReturnType; node.Symbol = symbol; return(true); }
public void VisitFunctionCallNode(FunctionCallNode node) { node.IdNode.Accept(this); node.EvaluationType = node.IdNode.EvaluationType; }