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(); } }
private Node GetDeclarationContainer() { // By default use the method definition as the main declarator container var methodDefinition = (Node)NodeStack.OfType <MethodDefinition>().LastOrDefault(); if (methodDefinition != null) { return(methodDefinition); } // Else use the IDeclaration return((Node)NodeStack.OfType <IDeclaration>().LastOrDefault()); }
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); }
static int GetElementIndentDepth (NodeStack nodes) { return nodes.OfType<XElement> ().Count (el => !el.IsClosed); }
private List <IDeclaration> GetDeclarationContainers() { return(NodeStack.OfType <IDeclaration>().ToList()); }
static int GetElementIndentDepth(NodeStack nodes) { return(nodes.OfType <XElement> ().Count(el => !el.IsClosed)); }