Exemplo n.º 1
0
        public void RemoveMethod(IMethodHolder <TNode> owner, ResolvedMethodId methodId)
        {
            var method = owner.FindLocalMethod(methodId);

            var toRemove = method.Methods.Keys.ToList();

            foreach (var localFunction in toRemove)
            {
                RemoveMethod(method, localFunction);
            }

            var toDelete = method.GetOwnedNodes();

            foreach (var node in toDelete)
            {
                RemoveVertex(node);
                myOnNodeRemovedHandler(node);
            }

            var exists = owner.RemoveMethod(methodId);

            Trace.Assert(exists);
        }
Exemplo n.º 2
0
        public ResolvedMethod <TNode> GetOrCreateMethod(IMethodHolder <TNode> owner, string name)
        {
            var rawMethodId = Methods.FindOrAdd(name);
            var methodId    = new ResolvedMethodId(rawMethodId);

            var method = owner.FindLocalMethod(methodId);

            if (method == null)
            {
                var start = myNodesProvider();
                var end   = myNodesProvider();

                AddVertex(start);
                AddVertex(end);

                method = new ResolvedMethod <TNode>(methodId, start, end);

                owner.AddMethod(methodId, method);
                return(method);
            }

            return(method);
        }