private Visibility getCurrentVisibilityForDefineMethod(ThreadContext context) { // These checks are similar to rb_vm_cref_in_context from MRI. return context.getCurrentFrame().getSelf() == this ? context.getCurrentVisibility() : PUBLIC; }
private Visibility getCurrentVisibilityForDefineMethod(ThreadContext context) { // These checks are similar to rb_vm_cref_in_context from MRI. return context.getCurrentFrame().getSelf() == this ? context.getCurrentVisibility() : PUBLIC; }
/** rb_mod_attr_reader * */ @JRubyMethod(name = "attr_reader", rest = true, reads = VISIBILITY) public IRubyObject attr_reader(ThreadContext context, IRubyObject[] args) { // Check the visibility of the previous frame, which will be the frame in which the class is being eval'ed Visibility visibility = context.getCurrentVisibility(); for (int i = 0; i < args.length; i++) { addAccessor(context, TypeConverter.checkID(args[i]), visibility, true, false); } return context.nil; }
/** rb_mod_attr_writer * */ @JRubyMethod(name = "attr_writer", rest = true, reads = VISIBILITY) public IRubyObject attr_writer(ThreadContext context, IRubyObject[] args) { // Check the visibility of the previous frame, which will be the frame in which the class is being eval'ed Visibility visibility = context.getCurrentVisibility(); for (int i = 0; i < args.length; i++) { addAccessor(context, TypeConverter.checkID(args[i]), visibility, false, true); } return context.nil; }
/** rb_mod_attr_writer * */ @JRubyMethod(name = "attr_writer", rest = true, reads = VISIBILITY) public IRubyObject attr_writer(ThreadContext context, IRubyObject[] args) { // Check the visibility of the previous frame, which will be the frame in which the class is being eval'ed Visibility visibility = context.getCurrentVisibility(); for (int i = 0; i < args.length; i++) { addAccessor(context, TypeConverter.checkID(args[i]), visibility, false, true); } return context.nil; }
/** rb_mod_attr_reader * */ @JRubyMethod(name = "attr_reader", rest = true, visibility = PRIVATE, reads = VISIBILITY) public IRubyObject attr_reader(ThreadContext context, IRubyObject[] args) { // Check the visibility of the previous frame, which will be the frame in which the class is being eval'ed Visibility visibility = context.getCurrentVisibility(); for (int i = 0; i < args.length; i++) { addAccessor(context, args[i].asJavaString().intern(), visibility, true, false); } return context.runtime.getNil(); }
/** rb_mod_attr_reader * */ @JRubyMethod(name = "attr_reader", rest = true, visibility = PRIVATE, reads = VISIBILITY) public IRubyObject attr_reader(ThreadContext context, IRubyObject[] args) { // Check the visibility of the previous frame, which will be the frame in which the class is being eval'ed Visibility visibility = context.getCurrentVisibility(); for (int i = 0; i < args.length; i++) { addAccessor(context, args[i].asJavaString().intern(), visibility, true, false); } return context.runtime.getNil(); }
/** rb_mod_attr_writer * */ @JRubyMethod(name = "attr_writer", rest = true, visibility = PRIVATE, reads = VISIBILITY) public IRubyObject attr_writer(ThreadContext context, IRubyObject[] args) { // Check the visibility of the previous frame, which will be the frame in which the class is being eval'ed Visibility visibility = context.getCurrentVisibility(); for (int i = 0; i < args.length; i++) { addAccessor(context, args[i].asJavaString().intern(), visibility, false, true); } return context.runtime.getNil(); }
/** rb_mod_attr_writer * */ @JRubyMethod(name = "attr_writer", rest = true, visibility = PRIVATE, reads = VISIBILITY) public IRubyObject attr_writer(ThreadContext context, IRubyObject[] args) { // Check the visibility of the previous frame, which will be the frame in which the class is being eval'ed Visibility visibility = context.getCurrentVisibility(); for (int i = 0; i < args.length; i++) { addAccessor(context, args[i].asJavaString().intern(), visibility, false, true); } return context.runtime.getNil(); }
/** rb_mod_attr_reader * */ @JRubyMethod(name = "attr_reader", rest = true, reads = VISIBILITY) public IRubyObject attr_reader(ThreadContext context, IRubyObject[] args) { // Check the visibility of the previous frame, which will be the frame in which the class is being eval'ed Visibility visibility = context.getCurrentVisibility(); for (int i = 0; i < args.length; i++) { addAccessor(context, TypeConverter.checkID(args[i]), visibility, true, false); } return context.nil; }
/** rb_mod_attr * */ @JRubyMethod(name = "attr", required = 1, optional = 1, visibility = PRIVATE, reads = VISIBILITY, compat = RUBY1_8) public IRubyObject attr(ThreadContext context, IRubyObject[] args) { boolean writeable = args.length > 1 ? args[1].isTrue() : false; // Check the visibility of the previous frame, which will be the frame in which the class is being eval'ed Visibility visibility = context.getCurrentVisibility(); addAccessor(context, args[0].asJavaString().intern(), visibility, true, writeable); return getRuntime().getNil(); }
/** rb_mod_attr * */ @JRubyMethod(name = "attr", required = 1, optional = 1, visibility = PRIVATE, reads = VISIBILITY, compat = RUBY1_8) public IRubyObject attr(ThreadContext context, IRubyObject[] args) { boolean writeable = args.length > 1 ? args[1].isTrue() : false; // Check the visibility of the previous frame, which will be the frame in which the class is being eval'ed Visibility visibility = context.getCurrentVisibility(); addAccessor(context, args[0].asJavaString().intern(), visibility, true, writeable); return getRuntime().getNil(); }
@JIT public static void defCompiledInstanceMethod(ThreadContext context, MethodHandle handle, IRScope method, DynamicScope currDynScope, IRubyObject self) { Ruby runtime = context.runtime; RubySymbol methodName = method.getName(); RubyModule clazz = findInstanceMethodContainer(context, currDynScope, self); Visibility currVisibility = context.getCurrentVisibility(); Visibility newVisibility = Helpers.performNormalMethodChecksAndDetermineVisibility(runtime, clazz, methodName, currVisibility); DynamicMethod newMethod = new CompiledIRMethod(handle, method, newVisibility, clazz); // FIXME: needs checkID and proper encoding to force hard symbol Helpers.addInstanceMethod(clazz, methodName, newMethod, currVisibility, context, runtime); }
@JIT public static void defCompiledInstanceMethod(ThreadContext context, MethodHandle variable, MethodHandle specific, int specificArity, IRScope method, DynamicScope currDynScope, IRubyObject self) { Ruby runtime = context.runtime; RubySymbol methodName = method.getName(); RubyModule clazz = findInstanceMethodContainer(context, currDynScope, self); Visibility currVisibility = context.getCurrentVisibility(); Visibility newVisibility = Helpers.performNormalMethodChecksAndDetermineVisibility(runtime, clazz, methodName, currVisibility); DynamicMethod newMethod = new CompiledIRMethod(variable, specific, specificArity, method, newVisibility, clazz); // FIXME: needs checkID and proper encoding to force hard symbol Helpers.addInstanceMethod(clazz, methodName, newMethod, currVisibility, context, runtime); }
@JIT public static void defCompiledInstanceMethod(ThreadContext context, MethodHandle handle, IRScope method, DynamicScope currDynScope, IRubyObject self) { Ruby runtime = context.runtime; RubySymbol methodName = method.getName(); RubyModule clazz = findInstanceMethodContainer(context, currDynScope, self); Visibility currVisibility = context.getCurrentVisibility(); Visibility newVisibility = Helpers.performNormalMethodChecksAndDetermineVisibility(runtime, clazz, methodName, currVisibility); DynamicMethod newMethod = new CompiledIRMethod(handle, method, newVisibility, clazz); // FIXME: needs checkID and proper encoding to force hard symbol Helpers.addInstanceMethod(clazz, methodName, newMethod, currVisibility, context, runtime); }
@JIT public static void defCompiledInstanceMethod(ThreadContext context, MethodHandle variable, MethodHandle specific, int specificArity, IRScope method, DynamicScope currDynScope, IRubyObject self) { Ruby runtime = context.runtime; RubySymbol methodName = method.getName(); RubyModule clazz = findInstanceMethodContainer(context, currDynScope, self); Visibility currVisibility = context.getCurrentVisibility(); Visibility newVisibility = Helpers.performNormalMethodChecksAndDetermineVisibility(runtime, clazz, methodName, currVisibility); DynamicMethod newMethod = new CompiledIRMethod(variable, specific, specificArity, method, newVisibility, clazz); // FIXME: needs checkID and proper encoding to force hard symbol Helpers.addInstanceMethod(clazz, methodName, newMethod, currVisibility, context, runtime); }
@JRubyMethod(name = "attr", rest = true, visibility = PRIVATE, reads = VISIBILITY, compat = RUBY1_9) public IRubyObject attr19(ThreadContext context, IRubyObject[] args) { Ruby runtime = context.runtime; if (args.length == 2 && (args[1] == runtime.getTrue() || args[1] == runtime.getFalse())) { runtime.getWarnings().warn(ID.OBSOLETE_ARGUMENT, "optional boolean argument is obsoleted"); addAccessor(context, args[0].asJavaString().intern(), context.getCurrentVisibility(), args[0].isTrue(), true); return runtime.getNil(); } return attr_reader(context, args); }
@JRubyMethod(name = "attr", rest = true, visibility = PRIVATE, reads = VISIBILITY, compat = RUBY1_9) public IRubyObject attr19(ThreadContext context, IRubyObject[] args) { Ruby runtime = context.runtime; if (args.length == 2 && (args[1] == runtime.getTrue() || args[1] == runtime.getFalse())) { runtime.getWarnings().warn(ID.OBSOLETE_ARGUMENT, "optional boolean argument is obsoleted"); addAccessor(context, args[0].asJavaString().intern(), context.getCurrentVisibility(), args[0].isTrue(), true); return runtime.getNil(); } return attr_reader(context, args); }
/** rb_mod_attr * */ @JRubyMethod(name = "attr", rest = true, reads = VISIBILITY) public IRubyObject attr(ThreadContext context, IRubyObject[] args) { Ruby runtime = context.runtime; if (args.length == 2 && (args[1] == runtime.getTrue() || args[1] == runtime.getFalse())) { runtime.getWarnings().warn(ID.OBSOLETE_ARGUMENT, "optional boolean argument is obsoleted"); addAccessor(context, TypeConverter.checkID(args[0]), context.getCurrentVisibility(), args[0].isTrue(), args[1].isTrue()); return runtime.getNil(); } return attr_reader(context, args); }
/** rb_mod_attr * */ @JRubyMethod(name = "attr", rest = true, reads = VISIBILITY) public IRubyObject attr(ThreadContext context, IRubyObject[] args) { Ruby runtime = context.runtime; if (args.length == 2 && (args[1] == runtime.getTrue() || args[1] == runtime.getFalse())) { runtime.getWarnings().warn(ID.OBSOLETE_ARGUMENT, "optional boolean argument is obsoleted"); addAccessor(context, TypeConverter.checkID(args[0]), context.getCurrentVisibility(), args[0].isTrue(), args[1].isTrue()); return runtime.getNil(); } return attr_reader(context, args); }