public override void Visit(ReturnStatementNode node) { node.expression.Accept(this); }
public override void Visit(ReturnStatementNode node) { try { node.expression.Accept(this); if(node.expression.ExpressionType.GetType() == typeof(ClassType) && !IsClassCompatible((ClassType)node.expression.ExpressionType, (ClassType)MethodBeingVisited.ReturnType)) { throw new Exception("Return Expression should have compatible Type as in the Method Declaration!"); } else if (!AreTypeCompatible(node.expression.ExpressionType.GetType(), MethodBeingVisited.ReturnType.GetType())) throw new Exception("Return Expression should have compatible Type as in the Method Declaration!"); } catch (Exception e) { Analysis.LogSemanticError(e.Message, node.lineNumber); } }
public virtual void Visit(ReturnStatementNode node) { node.expression.Accept(this); }
public override void Visit(ReturnStatementNode node) { Console.WriteLine(this.indentation + "return ---- Statement ----"); indentation = indentation + " "; node.expression.Accept(this); indentation = indentation.Substring(0, indentation.Length - 3); }