예제 #1
0
        public Task <IEnumerable <Annotation> > GetAnnotationsAsync()
        {
            var result = new List <CodeGraphModel.Annotation>();

            //result.Add(this.methodEntity.DeclarationInfo);

            foreach (var callNode in this.methodEntity.PropGraph.CallNodes)
            {
                var invocationInfo = Roslyn.CodeGraphHelper.GetMethodInvocationInfo(this.methodEntity.MethodDescriptor, callNode);
                result.Add(invocationInfo);
            }

            foreach (var anonymousEntity in this.methodEntity.GetAnonymousMethodEntities())
            {
                foreach (var callNode in anonymousEntity.PropGraph.CallNodes)
                {
                    var invocationInfo = Roslyn.CodeGraphHelper.GetMethodInvocationInfo(anonymousEntity.MethodDescriptor, callNode);
                    invocationInfo.range = CodeGraphHelper.GetAbsoluteRange(invocationInfo.range, anonymousEntity.DeclarationInfo.range);
                    result.Add(invocationInfo);
                }
            }

            return(Task.FromResult(result.AsEnumerable()));
        }
        public override MethodEntity ParseMethod()
        {
            Contract.Assert(this.lambdaExpression != null);
            var propGraphGenerator = new MethodSyntaxVisitor(this.model, this.RoslynMethod, this, this.containingTypeNode, this.lambdaExpression);

            propGraphGenerator.Visit(this.lambdaExpression);

            var descriptor      = new MethodEntityDescriptor(propGraphGenerator.MethodDescriptor); //EntityFactory.Create(this.MethodDescriptor, this.Dispatcher);
            var declarationInfo = CodeGraphHelper.GetMethodDeclarationInfo(this.lambdaExpression, this.RoslynMethod);

            // TODO: Hack
            declarationInfo.range = CodeGraphHelper.GetRelativeRange(declarationInfo.range, CodeGraphHelper.GetRange(CodeGraphHelper.GetSpan(declarationNode)));

            var referenceInfo = CodeGraphHelper.GetMethodReferenceInfo(this.declarationNode);

            var methodEntity = new MethodEntity(propGraphGenerator.MethodDescriptor,
                                                propGraphGenerator.MethodInterfaceData,
                                                propGraphGenerator.PropGraph, descriptor,
                                                propGraphGenerator.InstantiatedTypes,
                                                propGraphGenerator.StatementProcessor.AnonymousMethods,
                                                declarationInfo, referenceInfo);

            return(methodEntity);
        }
 public Task <IEnumerable <CodeGraphModel.FileResponse> > GetDocumentsAsync()
 {
     return(CodeGraphHelper.GetDocumentsAsync(this.Project));
 }