nsmcp::codeResolve

 nsmcp::codeResolve

Defined in

Partial Call Graph (max 5 caller/called nodes):
Class ::nsmcp::CodeDefinitionTool Class ::nsmcp::CodeDefinitionTool (public) nsmcp::codeResolve nsmcp::codeResolve Class ::nsmcp::CodeDefinitionTool->nsmcp::codeResolve execute execute execute->nsmcp::codeResolve instproc instproc instproc->nsmcp::codeResolve nsmcp::CodeDefinitionTool nsmcp::CodeDefinitionTool nsmcp::CodeDefinitionTool->nsmcp::codeResolve nsmcp::codeMetadata nsmcp::codeMetadata nsmcp::codeResolve->nsmcp::codeMetadata

Testcases:
No testcase defined.
Source code:
    # Exact Tcl command lookup: namespace which is literal, unlike info procs.
    set absolute [expr {[string first :: $name]==0 ? $name : "::$name"}]
    set command [namespace which -command $absolute]
    if {$command ne {} && ![catch {
        info body $command
    } body]} {
        set arguments {}
        if {[catch {
            info args $command
        } formals]} {
            # nsf::proc exposes info body but needs NSF signature introspection.
            set native [::nx::Object info method definition ::nsf::procs::$command]
            set arguments [lindex $native end-1]
            set doc [codeMetadata $command]
            if {$doc eq {}} {
                set doc [codeMetadata [string trimleft $command :]]
            }
            if {[dict exists $doc arg_list]} {
                set arguments [dict get $doc arg_list]
            }
        } else {
            foreach arg $formals {
                if {[info default $command $arg default]} {
                    lappend arguments [list $arg $default]
                } else {
                    lappend arguments $arg
                }
            }
        }
        return [dict create kind tcl definition [list proc $command $arguments $body]]
    }
    if {[catch {
        llength $name
    } length] || $length!=3} {
        error "Definition unavailable in this interpreter"
    }
    lassign $name object tag member
    if {$tag ni {proc instproc} || ![nsf::is object $object]} {
        error "Definition unavailable in this interpreter"
    }
    set scope [expr {$tag eq "instproc" ? "class" : "object"}]
    if {$scope eq "class" && ![nsf::is class $object]} {
        error "Definition unavailable in this interpreter"
    }
    set api ::nsf::methods::${scope}::info::method
    # The built-in returns definitions for scripted methods and native aliases;
    # directdispatch bypasses application overrides of 'info' and filters.
    set definition [nsf::directdispatch $object $api definition $member]
    if {$definition eq {}} {
        error "Definition unavailable in this interpreter"
    }
    set kind [expr {[nsf::is object,type=::nx::Object $object] ? "nx" : "xotcl"}]
    return [dict create kind $kind definition $definition]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: