Exemple #1
0
            public ContextAnalysisResult AnalyzeInternal(ITreeNode type)
            {
                var res = new ContextAnalysisResult
                {
                    Context = new Context()
                };

                Execute.WithExceptionLogging(_logger, () => AnalyzeInternal(type, res));

                return(res);
            }
            private void AnalyzeInternal(ITreeNode nodeInFile, ContextAnalysisResult res)
            {
                var context = res.Context;
                var sst     = new SST();

                context.SST = sst;

                res.CompletionMarker = _completionTargetAnalysis.Analyze(nodeInFile);

                var typeDecl = FindEnclosing <ICSharpTypeDeclaration>(nodeInFile);

                if (typeDecl != null && typeDecl.DeclaredElement != null)
                {
                    context.TypeShape = _typeShapeAnalysis.Analyze(typeDecl);

                    var entryPointRefs = new EntryPointSelector(typeDecl, context.TypeShape).GetEntryPoints();
                    res.EntryPoints = Sets.NewHashSetFrom(entryPointRefs.Select(epr => epr.Name));

                    sst.EnclosingType = typeDecl.DeclaredElement.GetName <ITypeName>();

                    if (typeDecl.IsPartial)
                    {
                        var file = nodeInFile.GetSourceFile();
                        sst.PartialClassIdentifier = file != null
                            ? file.DisplayName
                            : _srcFile != null
                                ? _srcFile.DisplayName
                                : "partial";
                    }

                    typeDecl.Accept(
                        new DeclarationVisitor(_logger, res.EntryPoints, res.CompletionMarker, _token),
                        sst);
                }
                else
                {
                    sst.EnclosingType = Names.UnknownType;
                }
            }