home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / filesbbs / os2 / fp1os2.arj / OS2 / DATA / 49 / C / 0 / F_26836 / JScriptExprConst.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-05-15  |  1.9 KB  |  55 lines

  1. import java.io.PrintStream;
  2.  
  3. public class JScriptExprConst extends JScriptExprNode {
  4.    private String aConst;
  5.    private JSbxValue aValue;
  6.  
  7.    public JScriptExprConst(String var1, JSbxValue var2) {
  8.       this(var1, var2, (JScriptExprNode)null);
  9.    }
  10.  
  11.    public JScriptExprConst(String var1, JSbxValue var2, JScriptExprNode var3) {
  12.       super(var3);
  13.       this.aConst = new String(var1);
  14.       this.aValue = (JSbxValue)(var2 != null ? var2.clone() : null);
  15.    }
  16.  
  17.    public boolean IsConstant() {
  18.       return true;
  19.    }
  20.  
  21.    public boolean IsLValue() {
  22.       return false;
  23.    }
  24.  
  25.    public void Show(PrintStream var1, int var2) {
  26.       var1.println("{const:" + this.aConst + "}");
  27.    }
  28.  
  29.    protected void DoGenerateCode(JScriptCodeGenParam var1) throws JScriptExprParserException, JSbxException {
  30.       switch (this.aValue.GetType()) {
  31.          case 1:
  32.             throw new JScriptExprParserException(1015);
  33.          case 2:
  34.             var1.AddCode(new JSP_ObjectConst(this.aValue.GetObject()));
  35.             return;
  36.          case 4:
  37.             var1.AddCode(new JSP_StringConst(this.aValue.GetString()));
  38.             return;
  39.          case 8:
  40.             var1.AddCode(new JSP_BoolConst(this.aValue.GetBool()));
  41.             return;
  42.          case 16:
  43.             var1.AddCode(new JSP_NumConst(this.aValue.GetDouble()));
  44.             return;
  45.          default:
  46.       }
  47.    }
  48.  
  49.    protected void DoPreGenerateCode(JScriptCodeGenParam var1) throws JScriptExprParserException, JSbxException {
  50.    }
  51.  
  52.    protected void DoPostGenerateCode(JScriptCodeGenParam var1) throws JScriptExprParserException, JSbxException {
  53.    }
  54. }
  55.