# New Ticket Created by  NotFound 
# Please include the string:  [perl #54454]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=54454 >


The static function parrot_class_register in src/oo.c is never used.

This patch removes it.

-- 
Salu2
Index: src/oo.c
===================================================================
--- src/oo.c	(revisión: 27646)
+++ src/oo.c	(copia de trabajo)
@@ -97,16 +97,6 @@
 static void invalidate_type_caches(PARROT_INTERP, UINTVAL type)
         __attribute__nonnull__(1);
 
-static void parrot_class_register(PARROT_INTERP,
-    ARGIN(PMC *name),
-    ARGIN(PMC *new_class),
-    ARGIN_NULLOK(PMC *parent),
-    ARGIN(PMC *mro))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        __attribute__nonnull__(5);
-
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: static */
 
@@ -695,125 +685,6 @@
 
 /*
 
-=item C<static void parrot_class_register>
-
-This is the way to register a new Parrot class as an instantiable
-type. Doing this involves putting it in the class hash, setting its
-vtable so that the C<init> method initializes objects of the class rather than
-the class itself, and adding it to the interpreter's base type table so
-you can create a new C<foo> in PASM like this: C<new Px, foo>.
-
-=cut
-
-*/
-
-static void
-parrot_class_register(PARROT_INTERP, ARGIN(PMC *name),
-        ARGIN(PMC *new_class), ARGIN_NULLOK(PMC *parent), ARGIN(PMC *mro))
-{
-    PMC    *vtable_pmc;
-    const INTVAL new_type = Parrot_oo_register_type(interp, name);
-
-    /* check if we already have a NameSpace */
-    PMC *top = CONTEXT(interp)->current_namespace;
-    PMC *ns  = VTABLE_get_pmc_keyed(interp, top, name);
-
-    /* Build a new vtable for this class
-     * The child class PMC gets the vtable of its parent class or
-     * a ParrotClass vtable
-     */
-    VTABLE *parent_vtable =
-        (parent && PObj_is_class_TEST(parent))
-            ? parent->vtable
-            : new_class->vtable;
-
-    VTABLE *new_vtable = Parrot_clone_vtable(interp, parent_vtable);
-
-    /* Set the vtable's type to the newly allocated type */
-    new_vtable->base_type = new_type;
-
-    /* And cache our class PMC in the vtable so we can find it later */
-    new_vtable->pmc_class = new_class;
-    new_vtable->mro       = mro;
-
-    if (parent_vtable->ro_variant_vtable)
-        new_vtable->ro_variant_vtable =
-            Parrot_clone_vtable(interp, parent_vtable->ro_variant_vtable);
-
-    /* Reset the init method to our instantiation method */
-    new_vtable->init          = Parrot_instantiate_object;
-    new_vtable->init_pmc      = Parrot_instantiate_object_init;
-    new_class->vtable         = new_vtable;
-
-    /* Put our new vtable in the global table */
-    interp->vtables[new_type] = new_vtable;
-
-    /* RT#45979 nested, use current as base ? */
-    if (PMC_IS_NULL(ns)) {
-        /* RT#45983 try HLL namespace too */
-        top = Parrot_get_ctx_HLL_namespace(interp);
-        ns  = VTABLE_get_pmc_keyed(interp, top, name);
-    }
-
-    if (PMC_IS_NULL(ns)) {
-        ns = pmc_new(interp, enum_class_NameSpace);
-        VTABLE_set_pmc_keyed(interp, top, name, ns);
-    }
-
-    /* attach namespace to vtable */
-    new_vtable->_namespace = ns;
-
-    if (new_vtable->ro_variant_vtable) {
-        VTABLE * const ro_vt = new_vtable->ro_variant_vtable;
-
-        ro_vt->base_type  = new_vtable->base_type;
-        ro_vt->pmc_class  = new_vtable->pmc_class;
-        ro_vt->mro        = new_vtable->mro;
-        ro_vt->_namespace = new_vtable->_namespace;
-    }
-
-    /*
-     * prepare object vtable - again that of the parent or
-     * a ParrotObject vtable
-     */
-    if (parent && PObj_is_class_TEST(parent)) {
-        vtable_pmc    =
-            get_attrib_num((SLOTTYPE *)PMC_data(parent), PCD_OBJECT_VTABLE);
-        parent_vtable = (VTABLE *)PMC_struct_val(vtable_pmc);
-    }
-    else
-        parent_vtable = interp->vtables[enum_class_Object];
-
-    new_vtable = Parrot_clone_vtable(interp, parent_vtable);
-
-    if (parent_vtable->ro_variant_vtable)
-        new_vtable->ro_variant_vtable =
-            Parrot_clone_vtable(interp, parent_vtable->ro_variant_vtable);
-
-    new_vtable->base_type = new_type;
-    new_vtable->mro       = mro;
-    new_vtable->pmc_class = new_class;
-
-    set_attrib_num(new_class, (SLOTTYPE*)PMC_data(new_class), PCD_OBJECT_VTABLE,
-            vtable_pmc = constant_pmc_new(interp, enum_class_VtableCache));
-    PMC_struct_val(vtable_pmc) = new_vtable;
-
-    /* attach namespace to object vtable too */
-    new_vtable->_namespace = ns;
-
-    if (new_vtable->ro_variant_vtable) {
-        VTABLE * const ro_vt = new_vtable->ro_variant_vtable;
-
-        ro_vt->base_type  = new_vtable->base_type;
-        ro_vt->pmc_class  = new_vtable->pmc_class;
-        ro_vt->mro        = new_vtable->mro;
-        ro_vt->_namespace = new_vtable->_namespace;
-    }
-}
-
-
-/*
-
 =item C<static PMC* get_init_meth>
 
 RT#48260: Not yet documented!!!

Reply via email to