public virtual void Visit(ReturnStatement returnStatement) { WriteLinkLine(returnStatement); Write("return"); if (returnStatement.Value != null) { Write(" "); VisitDynamic(returnStatement.Value); } WriteLine(";"); }
protected void Visit(ReturnStatement returnStatement) { // First, dispatch to resolve type of node at deeper level Visit((Node)returnStatement); if (returnStatement.Value != null) { var expressionType = returnStatement.Value.TypeInference.TargetType; if (expressionType != null) returnStatement.Value = Cast(expressionType, returnStatement.Value.TypeInference.ExpectedType ?? expressionType, returnStatement.Value); } }
protected virtual void Visit(ReturnStatement returnStatement) { // First, dispatch to resolve type of node at deeper level Visit((Node)returnStatement); if (returnStatement.Value != null) { var function = NodeStack.OfType<MethodDefinition>().Last(); returnStatement.Value.TypeInference.ExpectedType = function.ReturnType.ResolveType(); } }
public override Node Visit(ReturnStatement returnStatement) { // First, dispatch to resolve type of node at deeper level base.Visit(returnStatement); if (returnStatement.Value != null) { var expressionType = returnStatement.Value.TypeInference.TargetType; if (expressionType != null) returnStatement.Value = Cast(expressionType, returnStatement.Value.TypeInference.ExpectedType ?? expressionType, returnStatement.Value); } return returnStatement; }
public override Node Visit(ReturnStatement returnStatement) { // First, dispatch to resolve type of node at deeper level base.Visit(returnStatement); if (returnStatement.Value != null) { var function = NodeStack.OfType<MethodDefinition>().Last(); returnStatement.Value.TypeInference.ExpectedType = function.ReturnType.ResolveType(); } return returnStatement; }