Blame testing/063_bug_729092.tcl

Packit Service 50c9f2
#// objective: test for bug 729092 - TCL: Full documentation not shown for procs in namespaces.
Packit Service 50c9f2
#// check: namespaceoo.xml
Packit Service 50c9f2
#// check: namespaceoo_1_1_helpers.xml
Packit Service 50c9f2
#// check: namespaceoo_1_1define.xml
Packit Service 50c9f2
#// config: EXTRACT_ALL = yes
Packit Service 50c9f2
#// config: GENERATE_HTML = yes
Packit Service 50c9f2
Packit Service 50c9f2
# taken from
Packit Service 50c9f2
# https://bugzilla.gnome.org/show_bug.cgi?id=729092
Packit Service 50c9f2
Packit Service 50c9f2
##
Packit Service 50c9f2
# Extension to TclOO to add static methods.
Packit Service 50c9f2
# Defines the method on the class instead of on the object. Can be used for
Packit Service 50c9f2
# the creation of megawidgets using TclOO by overriding the unknown method to
Packit Service 50c9f2
# detect if the user is trying to instantiate a widget (because the method
Packit Service 50c9f2
# will be unknown and start with a dot).
Packit Service 50c9f2
#
Packit Service 50c9f2
proc ::oo::define::classmethod {name {args ""} {body ""}} {
Packit Service 50c9f2
    # Create the method on the class if the caller gave arguments and body.
Packit Service 50c9f2
    if {[llength [info level 0]] == 4} {
Packit Service 50c9f2
        uplevel 1 [list self method $name $args $body]
Packit Service 50c9f2
    }
Packit Service 50c9f2
    # Get the name of the class being defined.
Packit Service 50c9f2
    set cls [lindex [info level -1] 1]
Packit Service 50c9f2
    # Make connection to private class "my" command by forwarding.
Packit Service 50c9f2
    uplevel forward $name [info object namespace $cls]::my $name
Packit Service 50c9f2
}
Packit Service 50c9f2
Packit Service 50c9f2
##
Packit Service 50c9f2
# Extension to TclOO to add static variables.
Packit Service 50c9f2
# Defines variables on the class instead of on the object. Can be used to
Packit Service 50c9f2
# enforce a limited number of instantiations.
Packit Service 50c9f2
#
Packit Service 50c9f2
proc ::oo::Helpers::classvar {args} {
Packit Service 50c9f2
    # Get reference to class's namespace.
Packit Service 50c9f2
    set nsCl [info object namespace [uplevel 1 {self class}]]
Packit Service 50c9f2
    set nsObj [uplevel 1 {namespace current}]
Packit Service 50c9f2
    # Link variables into local (caller's) scope.
Packit Service 50c9f2
    foreach v $args {
Packit Service 50c9f2
        uplevel "my variable $v"
Packit Service 50c9f2
        upvar #0 ${nsCl}::$v ${nsObj}::$v
Packit Service 50c9f2
    }
Packit Service 50c9f2
}