Inheritance: AbstractTreeNode, IReturnableNode
        private IBooParseTreeNode ToTreeNode(IMethod method)
        {
            var member = new MethodTreeNode(new EntitySourceOrigin(method), method.ReturnType.ToString(), method.DeclaringType.FullName);

            foreach (var parameter in method.GetParameters())
            {
                member.Parameters.Add(new MethodParameter
                {
                    Name = parameter.Name,
                    Type = parameter.Type.ToString()
                });
            }

            return member;
        }
Ejemplo n.º 2
0
        public override bool EnterMethod(Method node)
        {
            var parameters = new List<MethodParameter>();

            // add parameters...
            // TODO: Clean Me
            foreach (var parameter in node.Parameters)
            {
                parameters.Add(new MethodParameter
                {
                    Name = parameter.Name,
                    Type = parameter.Type.ToString()
                });
            }

            //           method in class                   ?? method in property, in class
            var parent = node.ParentNode as TypeDefinition ?? node.ParentNode.ParentNode as TypeDefinition;
            var method = new MethodTreeNode(new EntitySourceOrigin(GetEntity(node)), node.ReturnType != null ? node.ReturnType.ToString() : "void", parent != null ? parent.Name : "");
            method.Parameters = parameters;

            Push(method, node.LexicalInfo.Line);

            return base.EnterMethod(node);
        }
Ejemplo n.º 3
0
        public override bool EnterMethod(Method node)
        {
            var parameters = new List<MethodParameter>();

            // add parameters...
            // TODO: Clean Me
            foreach (var parameter in node.Parameters)
            {
                parameters.Add(new MethodParameter
                {
                    Name = parameter.Name,
                    Type = parameter.Type.ToString()
                });
            }

            //           method in class                   ?? method in property, in class
            var parent = node.ParentNode as TypeDefinition ?? node.ParentNode.ParentNode as TypeDefinition;
            MethodTreeNode method = null;

            // find if the method has already been declared (if so, we're an overload)
            foreach (var child in currentScope.Children)
            {
                if (child.Name == node.Name)
                {
                    method = (MethodTreeNode)child;
                }
            }

            if (method == null)
            {
                // new method
                method = new MethodTreeNode(new EntitySourceOrigin(GetEntity(node)), node.ReturnType != null ? node.ReturnType.ToString() : "void", parent != null ? parent.Name : "");
                method.Parameters = parameters;

                Push(method, node.LexicalInfo.Line);
            }
            else
            {
                // method overload
                var overload = new MethodTreeNode(new EntitySourceOrigin(GetEntity(node)), node.ReturnType != null ? node.ReturnType.ToString() : "void", parent != null ? parent.Name : "");
                overload.Parameters = parameters;

                method.Overloads.Add(overload);

                Push(overload, node.LexicalInfo.Line);
            }

            return base.EnterMethod(node);
        }
Ejemplo n.º 4
0
 public BooMethods(MethodTreeNode method)
 {
     this.method = method;
 }