public IRubyObject finvoke(ThreadContext context, IRubyObject self, String name, Block block) { DynamicMethod method = searchMethod(name); if (shouldCallMethodMissing(method)) { return Helpers.callMethodMissing(context, self, this, method.getVisibility(), name, CallType.FUNCTIONAL, block); } return method.call(context, self, this, name, block); }
protected final IRubyObject callMethodMissing(ThreadContext context, IRubyObject self, RubyClass selfType, DynamicMethod method, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) { return Helpers.selectMethodMissing(context, selfType, method.getVisibility(), methodName, callType).call(context, self, self.getMetaClass(), methodName, arg0, arg1, arg2, block); }
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, RubyModule klass, String name, IRubyObject[] args, Block block) { checkSuperDisabledOrOutOfMethod(context, klass, name); RubyClass superClass = findImplementerIfNecessary(self.getMetaClass(), klass).getSuperClass(); DynamicMethod method = superClass != null ? superClass.searchMethod(name) : UndefinedMethod.INSTANCE; if (method.isUndefined()) { return callMethodMissing(context, self, method.getVisibility(), name, CallType.SUPER, args, block); } return method.call(context, self, superClass, name, args, block); }
private void putPointer(ThreadContext context, long offset, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { putPointer(context, offset, (Pointer) value); } else if (value.isNil()) { getMemoryIO().putAddress(offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { putPointer(context, offset, conversionMethod.call(context, value, value.getMetaClass(), "to_ptr")); } else { throw context.runtime.newTypeError(value, context.runtime.getFFI().pointerClass); } }
public static IRubyObject invokedynamic(ThreadContext context, IRubyObject self, MethodNames method) { RubyClass metaclass = self.getMetaClass(); String name = method.realName(); return getMethodCached(context, metaclass, method.ordinal(), name).call(context, self, metaclass, name); }
public IRubyObject finvoke(ThreadContext context, IRubyObject self, String name, IRubyObject[] args, Block block) { assert args != null; DynamicMethod method = searchMethod(name); if (shouldCallMethodMissing(method)) { return Helpers.callMethodMissing(context, self, this, method.getVisibility(), name, CallType.FUNCTIONAL, args, block); } return method.call(context, self, this, name, args, block); }
protected final IRubyObject callMethodMissing(ThreadContext context, IRubyObject self, RubyClass selfType, DynamicMethod method, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) { return Helpers.selectMethodMissing(context, selfType, method.getVisibility(), methodName, callType).call(context, self, self.getMetaClass(), methodName, arg0, arg1, arg2, block); }
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, RubyModule klass, String name, IRubyObject[] args, Block block) { checkSuperDisabledOrOutOfMethod(context, klass, name); RubyClass superClass = findImplementerIfNecessary(self.getMetaClass(), klass).getSuperClass(); DynamicMethod method = superClass != null ? superClass.searchMethod(name) : UndefinedMethod.INSTANCE; if (method.isUndefined()) { return callMethodMissing(context, self, method.getVisibility(), name, CallType.SUPER, args, block); } return method.call(context, self, superClass, name, args, block); }
private void putPointer(ThreadContext context, long offset, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { putPointer(context, offset, (Pointer) value); } else if (value.isNil()) { getMemoryIO().putAddress(offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { putPointer(context, offset, conversionMethod.call(context, value, value.getMetaClass(), "to_ptr")); } else { throw context.runtime.newTypeError(value, context.runtime.getFFI().pointerClass); } }
public static IRubyObject invokedynamic(ThreadContext context, IRubyObject self, MethodNames method, IRubyObject arg0) { RubyClass metaclass = self.getMetaClass(); String name = method.realName(); return getMethodCached(context, metaclass, method.ordinal(), name).call(context, self, metaclass, name, arg0); }
/** * Same behavior as finvoke, but uses the given caller object to check visibility if callType demands it. */ public IRubyObject invokeFrom(ThreadContext context, CallType callType, IRubyObject caller, IRubyObject self, String name) { DynamicMethod method = searchMethod(name); if (shouldCallMethodMissing(method, name, caller, callType)) { return Helpers.callMethodMissing(context, self, this, method.getVisibility(), name, callType, Block.NULL_BLOCK); } return method.call(context, self, this, name); }
public static IRubyObject callMethodMissing(CacheEntry entry, CallType callType, ThreadContext context, IRubyObject self, String name, IRubyObject arg) { return Helpers.selectMethodMissing(context, self, entry.method.getVisibility(), name, callType).call(context, self, self.getMetaClass(), name, arg, Block.NULL_BLOCK); }
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, IRubyObject arg0, Block block) { checkSuperDisabledOrOutOfMethod(context); RubyModule klazz = context.getFrameKlazz(); String name = context.getFrameName(); RubyClass superClass = findImplementerIfNecessary(self.getMetaClass(), klazz).getSuperClass(); DynamicMethod method = superClass != null ? superClass.searchMethod(name) : UndefinedMethod.INSTANCE; if (method.isUndefined()) { return callMethodMissing(context, self, method.getVisibility(), name, CallType.SUPER, arg0, block); } return method.call(context, self, superClass, name, arg0, block); }
private void putPointer(ThreadContext context, long offset, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { putPointer(context, offset, (Pointer) value); } else if (value.isNil()) { getMemoryIO().putAddress(offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { putPointer(context, offset, conversionMethod.call(context, value, value.getMetaClass(), "to_ptr")); } else { throw context.runtime.newTypeError(value, context.runtime.getFFI().pointerClass); } }
public static IRubyObject invokedynamic(ThreadContext context, IRubyObject self, MethodNames method) { RubyClass metaclass = self.getMetaClass(); String name = method.realName(); return getMethodCached(context, metaclass, method.ordinal(), name).call(context, self, metaclass, name); }
/** * Same behavior as finvoke, but uses the given caller object to check visibility if callType demands it. */ public IRubyObject invokeFrom(ThreadContext context, CallType callType, IRubyObject caller, IRubyObject self, String name, IRubyObject[] args, Block block) { assert args != null; DynamicMethod method = searchMethod(name); if (shouldCallMethodMissing(method, name, caller, callType)) { return Helpers.callMethodMissing(context, self, this, method.getVisibility(), name, callType, args, block); } return method.call(context, self, this, name, args, block); }
public static IRubyObject callMethodMissing(CacheEntry entry, CallType callType, ThreadContext context, IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, Block block) { return Helpers.selectMethodMissing(context, self, entry.method.getVisibility(), name, callType).call(context, self, self.getMetaClass(), name, arg0, arg1, block); }
public static IRubyObject invokeSuper(ThreadContext context, IRubyObject self, IRubyObject arg0, IRubyObject arg1, Block block) { checkSuperDisabledOrOutOfMethod(context); RubyModule klazz = context.getFrameKlazz(); String name = context.getFrameName(); RubyClass superClass = findImplementerIfNecessary(self.getMetaClass(), klazz).getSuperClass(); DynamicMethod method = superClass != null ? superClass.searchMethod(name) : UndefinedMethod.INSTANCE; if (method.isUndefined()) { return callMethodMissing(context, self, method.getVisibility(), name, CallType.SUPER, arg0, arg1, block); } return method.call(context, self, superClass, name, arg0, arg1, block); }
private void putPointer(ThreadContext context, long offset, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { putPointer(context, offset, (Pointer) value); } else if (value.isNil()) { getMemoryIO().putAddress(offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { putPointer(context, offset, conversionMethod.call(context, value, value.getMetaClass(), "to_ptr")); } else { throw context.runtime.newTypeError(value, context.runtime.getFFI().pointerClass); } }
public static IRubyObject invokedynamic(ThreadContext context, IRubyObject self, MethodNames method, IRubyObject arg0) { RubyClass metaclass = self.getMetaClass(); String name = method.realName(); return getMethodCached(context, metaclass, method.ordinal(), name).call(context, self, metaclass, name, arg0); }