示例#1
0
文件: ConstNode.java 项目: GUI/jruby
 @Override
 public RubyString definition(
     Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
   return context.getConstantDefined(name)
       ? runtime.getDefinedMessage(DefinedMessage.CONSTANT)
       : null;
 }
示例#2
0
文件: OrNode.java 项目: RB-DPR/RB-DPR
 @Override
 public RubyString definition(
     Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
   if (!context.runtime.is1_9()) {
     return super.definition(runtime, context, self, aBlock);
   } else {
     return runtime.getDefinedMessage(DefinedMessage.EXPRESSION);
   }
 }
示例#3
0
文件: NthRefNode.java 项目: xb/jruby
  @Override
  public RubyString definition(
      Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
    IRubyObject backref = context.getBackRef();
    if (backref instanceof RubyMatchData) {
      if (!((RubyMatchData) backref).group(matchNumber).isNil()) {
        return runtime.getDefinedMessage(DefinedMessage.GLOBAL_VARIABLE);
      }
    }

    return null;
  }
  @Override
  public RubyString definition(
      Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
    IRubyObject lastError = context.getErrorInfo();
    try {
      if (Helpers.isModuleAndHasConstant(
          leftNode.interpret(runtime, context, self, aBlock), name)) {
        return runtime.getDefinedMessage(DefinedMessage.CONSTANT);
      }
    } catch (JumpException e) {
      // replace lastError
      context.setErrorInfo(lastError);
    }

    return null;
  }
示例#5
0
 @Override
 public RubyString definition(
     Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
   return runtime.getDefinedMessage(DefinedMessage.LOCAL_VARIABLE);
 }