コード例 #1
0
ファイル: IR_ScopeImpl.java プロジェクト: slagyr/jruby
  public void addMethod(IR_Method m) {
    _methods.add(m);
    if (IR_Module.isAClassRootMethod(m)) return;

    if ((this instanceof IR_Method) && ((IR_Method) this).isAClassRootMethod()) {
      IR_Module c = (IR_Module) (((MetaObject) this._parent)._scope);
      c.getRootMethod()
          .addInstr(
              m._isInstanceMethod
                  ? new DEFINE_INSTANCE_METHOD_Instr(c, m)
                  : new DEFINE_CLASS_METHOD_Instr(c, m));
    } else if (m._isInstanceMethod && (this instanceof IR_Module)) {
      IR_Module c = (IR_Module) this;
      c.getRootMethod().addInstr(new DEFINE_INSTANCE_METHOD_Instr(c, m));
    } else if (!m._isInstanceMethod && (this instanceof IR_Module)) {
      IR_Module c = (IR_Module) this;
      c.getRootMethod().addInstr(new DEFINE_CLASS_METHOD_Instr(c, m));
    } else {
      // SSS FIXME: Do I have to generate a define method instruction here??
      // throw new RuntimeException("Encountered method add in a non-class scope!");
    }
  }
コード例 #2
0
ファイル: IR_ScopeImpl.java プロジェクト: slagyr/jruby
  public void setConstantValue(String constRef, Operand val) {
    if (val.isConstant()) _constMap.put(constRef, val);

    if (this instanceof IR_Module)
      ((IR_Module) this).getRootMethod().addInstr(new PUT_CONST_Instr(this, constRef, val));
  }