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


Hi,

The following code crashes parrot if run with -t (trace).
It seems to be due to an unused .param, see line marked with XXX.

jens
.sub main
    __create_class( "A" )
    __create_class( "B" )
    
    find_type I0, "A"
    print "type1:"
    print I0
    print "\n"

    new P0, I0
    typeof I0, P0
    print "type2:"
    print I0
    print "\n"
    end
.end

.sub _A::__init
    .local pmc temp
    
    print "_A::__init()\n"
    find_type I0, "B"
    new temp, I0

    __add_method( "A", "f1" )
    __add_method( "A", "f2" )
    __add_method( "A", "f3" )

    .pcc_begin_return
    .pcc_end_return
.end

.sub _B::__init
    print "_B::__init()\n"
    __add_method( "B", "f1" )
    .pcc_begin_return
    .pcc_end_return
.end

.sub _A::f1
    .pcc_begin_return
    .pcc_end_return
.end
.sub _A::f2
    .pcc_begin_return
    .pcc_end_return
.end
.sub _A::f3
    .pcc_begin_return
    .pcc_end_return
.end

.sub _B::f1
    .pcc_begin_return
    .pcc_end_return
.end

.sub __add_method
    .param string class
    .param string method
    .local string tmp
    .local pmc sub

    # construct the class'es method name
    set tmp, "_"
    concat tmp, class
    concat tmp, "::"
    concat tmp, method

    # find the sub
    find_global sub, tmp
    # store it as the method sub
    store_global class, method, sub

    .pcc_begin_return
    .pcc_end_return
.end

.sub __create_class
    .param string name
    .param pmc base
    .local pmc ret
    # XXX: it works if you remove the (unused) parameter "base"

    newclass ret, name

    # add the constructor
    __add_method( name, "__init" )

    .pcc_begin_return
    .return ret
    .pcc_end_return
.end

Reply via email to