call.java

来自「RESIN 3.2 最新源码」· Java 代码 · 共 965 行 · 第 1/2 页

JAVA
965
字号
      }    }    throw new ESUndefinedException("undefined call `" + id + "'");  }  public ESBase callScope(ESString id, int i, ESBase a) throws Throwable  {    top = i + 1;    int scopeLength = caller.scopeLength;    ESBase []scope = caller.scope;    for (int j = scopeLength - 1; j >= 0; j--) {      ESBase value;       if ((value = scope[j].getProperty(id)) != esEmpty) {        callee = value;	stack[i] = scope[j];	stack[i + 1] = a;	return value.call(this, 1);      }    }    throw new ESUndefinedException("undefined call `" + id + "'");  }  public ESBase callScope(ESString id, int i, ESBase a, ESBase b)     throws Throwable  {    top = i + 1;     int scopeLength = caller.scopeLength;    ESBase []scope = caller.scope;    for (int j = scopeLength - 1; j >= 0; j--) {      ESBase value;       if ((value = scope[j].getProperty(id)) != esEmpty) {        callee = value;	stack[i] = scope[j];	stack[i + 1] = a;	stack[i + 2] = b;	return value.call(this, 2);      }    }    throw new ESUndefinedException("undefined call `" + id + "'");  }  public ESBase callScope(ESString id, int i, ESBase a, ESBase b, ESBase c,                          int length)    throws Throwable  {    top = i + 1;     int scopeLength = caller.scopeLength;    ESBase []scope = caller.scope;    for (int j = scopeLength - 1; j >= 0; j--) {      ESBase value;      if ((value = scope[j].getProperty(id)) != esEmpty) {        callee = value;	stack[i] = scope[j];	stack[i + 1] = a;	stack[i + 2] = b;	stack[i + 3] = c;	return value.call(this, length);      }    }    throw new ESUndefinedException("undefined call `" + id + "'");  }  public ESBase call(ESBase base, ESString name, int i)     throws Throwable  {    top = i + 1;     stack[i] = base;        return base.call(this, 0, name);  }  public ESBase call(ESBase base, ESString name, int i, ESBase a)     throws Throwable  {    top = i + 1;    stack[i] = base;    stack[i + 1] = a;    return base.call(this, 1, name);  }  public ESBase call(ESBase base, ESString name, int i, ESBase a, ESBase b)     throws Throwable  {    top = i + 1;     stack[i] = base;    stack[i + 1] = a;    stack[i + 2] = b;    return base.call(this, 2, name);  }  public ESBase call(ESBase base, ESString name, int i,                      ESBase a, ESBase b, ESBase c, int length)    throws Throwable  {    top = i + 1;     stack[i] = base;    stack[i + 1] = a;    stack[i + 2] = b;    stack[i + 3] = c;    return base.call(this, length, name);  }  public ESBase call(ESBase base, int i)     throws Throwable  {    top = i + 1;     stack[i] = global;    callee = base;        return base.call(this, 0);  }  public ESBase call(ESBase base, int i, ESBase a)     throws Throwable  {    top = i + 1;    stack[i + 1] = a;    stack[i] = global;    callee = base;    return base.call(this, 1);  }  public ESBase call(ESBase base, int i, ESBase a, ESBase b)     throws Throwable  {    top = i + 1;     stack[i] = base;    stack[i + 1] = a;    stack[i + 2] = b;    stack[i] = global;    callee = base;    return base.call(this, 2);  }  public ESBase call(ESBase base, int i,                     ESBase a, ESBase b, ESBase c, int length)    throws Throwable  {    top = i + 1;     stack[i] = base;    stack[i + 1] = a;    stack[i + 2] = b;    stack[i + 3] = c;    stack[i] = global;    callee = base;    return base.call(this, length);  }  public ESBase newScope(ESString id, int i) throws Throwable  {    top = i + 1;    int scopeLength = caller.scopeLength;    ESBase []scope = caller.scope;    for (int j = scopeLength - 1; j >= 0; j--) {      ESBase value;       if ((value = scope[j].getProperty(id)) != esEmpty) {        callee = value;	stack[i] = global;	return value.construct(this, 0);      }    }    throw new ESUndefinedException("undefined constructor `" + id + "'");  }  public ESBase newScope(ESString id, int i, ESBase a) throws Throwable  {    top = i + 1;    int scopeLength = caller.scopeLength;    ESBase []scope = caller.scope;    for (int j = scopeLength - 1; j >= 0; j--) {      ESBase value;       if ((value = scope[j].getProperty(id)) != esEmpty) {        callee = value;	stack[i] = global;	stack[i + 1] = a;	return value.construct(this, 1);      }    }    throw new ESUndefinedException("undefined constructor `" + id + "'");  }  public ESBase newScope(ESString id, int i, ESBase a, ESBase b)    throws Throwable  {    top = i + 1;    int scopeLength = caller.scopeLength;    ESBase []scope = caller.scope;    for (int j = scopeLength - 1; j >= 0; j--) {      ESBase value;       if ((value = scope[j].getProperty(id)) != esEmpty) {        callee = value;	stack[i] = global;	stack[i + 1] = a;	stack[i + 2] = b;	return value.construct(this, 2);      }    }    throw new ESUndefinedException("undefined constructor `" + id + "'");  }  public ESBase newScope(ESString id, int i, ESBase a, ESBase b, ESBase c,			  int length)    throws Throwable  {    top = i + 1;     int scopeLength = caller.scopeLength;    ESBase []scope = caller.scope;    for (int j = scopeLength - 1; j >= 0; j--) {      ESBase value;       if ((value = scope[j].getProperty(id)) != esEmpty) {        callee = value;	stack[i] = global;	stack[i + 1] = a;	stack[i + 2] = b;	stack[i + 3] = c;	return value.construct(this, length);      }    }    throw new ESUndefinedException("undefined constructor `" + id + "'");  }  public ESBase doNew(ESBase base, ESString name, int i)     throws Throwable  {    top = i + 1;     ESBase obj = base.getProperty(name);    stack[i] = base;    callee = obj;    if (obj != esEmpty)      return obj.construct(this, 0);    else      throw new ESUndefinedException("undefined constructor `" + name + "'");  }  public ESBase doNew(ESBase base, ESString name, int i, ESBase a)     throws Throwable  {    top = i + 1;    stack[i] = base;    stack[i + 1] = a;    ESBase obj = base.getProperty(name);    callee = obj;    if (obj != esEmpty)      return obj.construct(this, 1);    else      throw new ESUndefinedException("undefined constructor `" + name + "'");  }  public ESBase doNew(ESBase base, ESString name, int i, ESBase a, ESBase b)     throws Throwable  {    top = i + 1;     stack[i] = base;    stack[i + 1] = a;    stack[i + 2] = b;    ESBase obj = base.getProperty(name);    callee = obj;    if (obj != esEmpty)      return obj.construct(this, 2);    else      throw new ESUndefinedException("undefined constructor `" + name + "'");  }  public ESBase doNew(ESBase base, ESString name, int i,                       ESBase a, ESBase b, ESBase c, int length)    throws Throwable  {    top = i + 1;     stack[i] = base;    stack[i + 1] = a;    stack[i + 2] = b;    stack[i + 3] = c;    ESBase obj = base.getProperty(name);    callee = obj;    if (obj != esEmpty)      return obj.construct(this, length);    else      throw new ESUndefinedException("undefined constructor `" + name + "'");  }  public ESBase doNew(ESBase base, int i)     throws Throwable  {    top = i + 1;     stack[i] = global;    callee = base;    return base.construct(this, 0);  }  public ESBase doNew(ESBase base, int i, ESBase a)     throws Throwable  {    top = i + 1;    stack[i] = global;    stack[i + 1] = a;    callee = base;        return base.construct(this, 1);  }  public ESBase doNew(ESBase base, int i, ESBase a, ESBase b)     throws Throwable  {    top = i + 1;     stack[i] = global;    stack[i + 1] = a;    stack[i + 2] = b;    callee = base;        return base.construct(this, 2);  }  public ESBase doNew(ESBase base, int i,                       ESBase a, ESBase b, ESBase c, int length)    throws Throwable  {    top = i + 1;     stack[i] = global;    stack[i + 1] = a;    stack[i + 2] = b;    stack[i + 3] = c;    callee = base;        return base.construct(this, length);  }  public void free()  {    clear();        for (int i = stack.length - 1; i >= 0; i--)      stack[i] = null;    for (int i = scope.length - 1; i >= 0; i--)      scope[i] = null;    for (int i = values.length - 1; i >= 0; i--)      values[i] = null;    global = null;  }  public static Iterator toESIterator(Iterator i)  {    return new ESIterator(i);  }  public static Iterator toESIterator(Enumeration e)  {    return new ESEnumIterator(e);  }  public static boolean matchException(ESBase test, Exception e)  {    String testString;    try {      testString = test.toStr().toString();    } catch (Throwable foo) {      testString = "undefined";    }    Class eClass = e.getClass();    String dotted = "." + test;    for (; eClass != null; eClass = eClass.getSuperclass()) {      String eString = eClass.getName();      if (testString.equals(eString) || eString.endsWith(dotted))	return true;    }    return false;  }  static class ESIterator implements Iterator {    Global resin;    Iterator i;    public boolean hasNext()     {      return i != null && i.hasNext();    }    public Object next()    {      Object value = i == null ? null : i.next();      Object result;      try {        if (value == null)          result = ESBase.esNull;        else          result = resin.objectWrap(value);      } catch (Throwable e) {        result = ESBase.esNull;      }      return result;    }    public void remove() { throw new RuntimeException(); }    ESIterator(Iterator i)    {      this.i = i;      this.resin = Global.getGlobalProto();    }  }  static class ESEnumIterator implements Iterator {    Global resin;    Enumeration e;    public boolean hasNext()     {      return e != null && e.hasMoreElements();    }    public Object next()    {      Object value = e != null ? e.nextElement() : null;;      try {        if (value == null)          return ESBase.esNull;        else          return resin.objectWrap(value);      } catch (Throwable e) {        return ESBase.esNull;      }    }    public void remove() { throw new RuntimeException(); }    ESEnumIterator(Enumeration e)    {      this.e = e;      this.resin = Global.getGlobalProto();    }  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?