Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
		static int GetElementIndentDepth (NodeStack nodes)
		{
			return nodes.OfType<XElement> ().Count (el => !el.IsClosed);
		}
Exemplo n.º 5
0
 private List <IDeclaration> GetDeclarationContainers()
 {
     return(NodeStack.OfType <IDeclaration>().ToList());
 }
 static int GetElementIndentDepth(NodeStack nodes)
 {
     return(nodes.OfType <XElement> ().Count(el => !el.IsClosed));
 }