@Specialization(guards = "isRubyModule(lexicalParentModule)") public Object defineModule(VirtualFrame frame, DynamicObject lexicalParentModule) { final RubyConstant constant = lookupForExistingModule(frame, name, lexicalParentModule); final DynamicObject definingModule; if (needToDefineProfile.profile(constant == null)) { definingModule = ModuleNodes.createModule( getContext(), coreLibrary().getModuleClass(), lexicalParentModule, name, this); } else { final Object constantValue = constant.getValue(); if (!RubyGuards.isRubyModule(constantValue) || RubyGuards.isRubyClass(constantValue)) { errorProfile.enter(); throw new RaiseException(coreExceptions().typeErrorIsNotA(name, "module", this)); } definingModule = (DynamicObject) constantValue; } return definingModule; }