//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\
// PLEASE DO NOT EDIT WITHOUT THE EXPLICIT CONSENT OF THE AUTHOR! \\
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\

package ilog.language.design.kernel;

/**
 * @version     Last modified on Fri Oct 18 17:50:15 2002 by hak
 * @version          modified on Wed Jul 24 12:17:57 2002 by pviry
 * @author      <a href="mailto:hak@ilog.fr">Hassan A&iuml;t-Kaci</a>
 * @copyright   &copy; 2000-2002 <a href="http://www.ilog.fr/">ILOG, S.A.</a>
 */

import ilog.language.design.types.*;
import ilog.language.design.base.*;

/**
 * This is the class used to encapsulate code that has been
 * compiled.
 */
public class CompiledExpression extends Expression
{
  private DefinedEntry _codeEntry;

  public CompiledExpression (CodeEntry entry)
    {
      _codeEntry = (DefinedEntry)entry;
    }

  public final Expression sanitizeNames (ParameterStack parameters, ClassTypeHandle handle)
    {
      return this;
    }

  public final void sanitizeSorts (Enclosure enclosure)
    {
    }

  public final Type type ()
    {
      return _codeEntry.type();
    }

  public final void setType (Type type)
    {
    }

  public final Type typeRef ()
    {
      return type();
    }

  public final Type checkedType ()
    {
      return type();
    }

  public final void setCheckedType ()
    {
      if (isSetCheckedType()) return;
    }

  public final void setCheckedType (Type type)
    {
    }

  public final void typeCheck (TypeChecker typeChecker) throws TypingErrorException
    {
      if (typeCheckLocked()) return;

    }
    
  public final Expression shiftOffsets (int intShift, int realShift, int objectShift,
                                        int intDepth, int realDepth, int objectDepth)
    {
      return this;
    }

  public final void compile (Compiler compiler)
    {
      compiler.inline(_codeEntry.code());
    }

  public final String toString ()
    {
      return "CompiledExpression("+CodeEntry.getId(_codeEntry.code())+")";
    }

  // Added by PV
  public final String toTypedString ()
    {
        return typed(toString());
    }
}
