Exemplo n.º 1
0
        public virtual bool IsMarkedLocal(IDeclaredElement declaredElement, CallGraphDataElement dataElement)
        {
            if (IsContextAvailable == false)
            {
                return(false);
            }

            if (declaredElement == null || dataElement == null)
            {
                return(false);
            }

            var vertex = myElementIdProvider.GetElementId(declaredElement);

            if (vertex == null)
            {
                return(false);
            }

            if (!dataElement.Vertices.Contains(vertex.Value) || dataElement.BanMarks.GetOrEmpty(MarkId).Contains(vertex.Value))
            {
                return(false);
            }

            if (dataElement.RootMarks.GetOrEmpty(MarkId).Contains(vertex.Value))
            {
                return(true);
            }

            return(IsMarkedInternal(declaredElement, shouldPropagate: false, vertex));
        }
        public CallGraphContext(DaemonProcessKind processKind, [NotNull] IDaemonProcess daemonProcess)
        {
            myProcessKind   = processKind;
            myDaemonProcess = daemonProcess;

            if (processKind == DaemonProcessKind.VISIBLE_DOCUMENT)
            {
                var collectUsageProcess = daemonProcess.GetStageProcess <CollectUsagesStageProcess>().NotNull();
                myGraphDataElement = collectUsageProcess.SwaExtensionsUsageDataInfo[CallGraphSwaExtensionProvider.Id].As <CallGraphDataElement>();
            }

            myStack.Push(new BoundContextTag(CallGraphContextTag.NONE, null));
        }
        public override bool IsMarkedLocal(IDeclaredElement declaredElement, CallGraphDataElement dataElement)
        {
            if (IsContextAvailable == false)
            {
                return(false);
            }
            // there is problem:
            // due to root-ban check at not-merged state we have 2 data for graph - local data and index
            // they checks marks independently on their data
            // and the result on not-merged and merged state MAY DIFFER, for e.x. index has strict ban while data not
            // !!BUT!!!
            // cuz strictly banned at only at function declaration, it is impossible for index data to differ from local data very hard
            // only partial functions may result in false positives
            // in burst there are too little partial root(job) functions, performance-expensive same, they are mono behaviour hard coded
            // so it is mostly ok

            if (declaredElement == null || dataElement == null)
            {
                return(false);
            }

            var vertex = myElementIdProvider.GetElementId(declaredElement);

            if (vertex == null)
            {
                return(false);
            }

            if (!dataElement.Vertices.Contains(vertex.Value) || dataElement.BanMarks.GetOrEmpty(BurstStrictlyBannedMarkProvider.RootMarkId).Contains(vertex.Value))
            {
                return(false);
            }

            if (dataElement.RootMarks.GetOrEmpty(MarkId).Contains(vertex.Value))
            {
                return(true);
            }

            return(IsMarkedInternal(declaredElement, shouldPropagate: false, vertex));
        }