21
21
import org .truffleruby .language .RubyBaseNode ;
22
22
import org .truffleruby .language .RubyContextSourceNode ;
23
23
import org .truffleruby .language .RubyNode ;
24
- import org .truffleruby .language .arguments .RubyArguments ;
25
24
import org .truffleruby .language .methods .BlockDefinitionNode ;
26
25
import org .truffleruby .language .methods .InternalMethod ;
27
26
@@ -189,8 +188,6 @@ private class DefinedNode extends RubyBaseNode {
189
188
private final BranchProfile allArgumentsDefinedProfile = BranchProfile .create ();
190
189
private final BranchProfile receiverExceptionProfile = BranchProfile .create ();
191
190
private final ConditionProfile methodNotFoundProfile = ConditionProfile .create ();
192
- private final ConditionProfile methodUndefinedProfile = ConditionProfile .create ();
193
- private final ConditionProfile methodNotVisibleProfile = ConditionProfile .create ();
194
191
195
192
@ ExplodeLoop
196
193
public Object isDefined (VirtualFrame frame , RubyContext context ) {
@@ -217,26 +214,16 @@ public Object isDefined(VirtualFrame frame, RubyContext context) {
217
214
}
218
215
219
216
final InternalMethod method = lookupMethodNode .lookup (frame , receiverObject , methodName , dispatchConfig );
220
- final Object self = RubyArguments .getSelf (frame );
221
217
222
218
if (methodNotFoundProfile .profile (method == null )) {
223
219
final Object r = respondToMissing .call (receiverObject , "respond_to_missing?" , methodNameSymbol , false );
224
220
225
221
if (r != DispatchNode .MISSING && !respondToMissingCast .executeToBoolean (r )) {
226
222
return nil ;
227
223
}
228
- } else if (methodUndefinedProfile .profile (method .isUndefined ())) {
229
- return nil ;
230
- } else if (methodNotVisibleProfile
231
- .profile (!dispatchConfig .ignoreVisibility && !isVisibleTo (method , self ))) {
232
- return nil ;
233
224
}
234
225
235
226
return coreStrings ().METHOD .createInstance (context );
236
227
}
237
-
238
- private boolean isVisibleTo (InternalMethod method , Object self ) {
239
- return method .isVisibleTo (coreLibrary ().getMetaClass (self ));
240
- }
241
228
}
242
229
}
0 commit comments