public int getDepth(IVerb verb)
        {
            if (verbDepth.ContainsKey(verb))
            {
                return(verbDepth[verb]);
            }

            int depth;

            if (verb is DafnyVerifyOneVerb)
            {
                DafnyVerifyOneVerb vone = (DafnyVerifyOneVerb)verb;
                int deepestParent       = -1;
                foreach (SourcePath sourcePath in vone.getDirectIncludes())
                {
                    IVerb parent      = new DafnyVerifyOneVerb(sourcePath);
                    int   parentDepth = getDepth(parent);
                    deepestParent = Math.Max(deepestParent, parentDepth);
                }
                depth = deepestParent + 1;
            }
            else
            {
                //- Right now we only care about ordering the DafnyVerifyOneVerbs
                //- wrt one another. Other verbs will be constrained by build
                //- dependency anyway.
                depth = 0;
            }
            verbDepth[verb] = depth;
            return(depth);
        }
Example #2
0
        /// <summary>
        /// Gets the "depth" (dependency order) of a verb.
        /// </summary>
        /// <param name="verb">The verb in question.</param>
        /// <returns>The verb depth.</returns>
        private int GetDepth(IVerb verb)
        {
            if (this.verbDepth.ContainsKey(verb))
            {
                return(this.verbDepth[verb]);
            }

            int depth;
            DafnyVerifyOneVerb vone = verb as DafnyVerifyOneVerb;

            if (vone != null)
            {
                int deepestParent = -1;
                foreach (SourcePath sourcePath in vone.getDirectIncludes())
                {
                    IVerb parent      = new DafnyVerifyOneVerb(sourcePath);
                    int   parentDepth = this.GetDepth(parent);
                    deepestParent = Math.Max(deepestParent, parentDepth);
                }

                depth = deepestParent + 1;
            }
            else
            {
                // Right now we only care about ordering the DafnyVerifyOneVerbs
                // wrt one another. Other verbs will be constrained by build
                // dependency anyway.
                depth = 0;
            }

            this.verbDepth[verb] = depth;
            return(depth);
        }