module: dfmc-optimization synopsis: simple-minded tail call analysis author: Nosa Omo Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND define method tail-position? (c :: ) returns-temporary?(c.next-computation, c.temporary) end method tail-position?; define method returns-temporary?(c :: , t) #f end method returns-temporary?; define method returns-temporary?(c :: , t :: ) #f end method returns-temporary?; define method returns-temporary?(c :: , t :: ) if (compiling-dylan-library?()) next-method(); end if; end method returns-temporary?; define method returns-temporary?(c :: , t :: ) let source = c.computation-value; if (instance?(source, )) (source == t) & returns-temporary?(c.next-computation, c.temporary); else returns-temporary?(c.next-computation, c.temporary); end if; end method returns-temporary?; define method returns-temporary?(c :: , t :: ) c.computation-value == t end method returns-temporary?; define method returns-temporary?(c :: , t :: ) returns-temporary?(c.next-computation, c.temporary) end method returns-temporary?; define method returns-temporary?(c :: , t :: ) returns-temporary?(c.next-computation, c.temporary) end method returns-temporary?; define method returns-temporary?(c :: , t :: ) // HACK: NEXT-COMPUTATION OF END-LOOP SHOULD BE THIS let loop-c = ending-loop(c); returns-temporary?(loop-c.next-computation, t) end method returns-temporary?;