nsmcp::CodeUpstreamTool method selectDefinition (protected)

 <instance of nsmcp::CodeUpstreamTool[i]> selectDefinition source \
    name local

Defined in /usr/local/ns/tcl/nsmcp/code-upstream.tcl

Parameters:
source (required)
name (required)
local (required)

Testcases:
No testcase defined.
Source code:
set state [::nsmcp::codeStaticDefinitions $source $name]
set candidates [dict get $state matches]
set conditional false
foreach candidate $candidates {if {[llength [dict get $candidate conditions]]} {set conditional true}}
if {[llength $candidates]>1 && !$conditional} {error "upstream-definition-missing-or-ambiguous"}
if {!$conditional} {
    return [dict create selected true selection unique-literal-declaration remote [dict merge [lindex $candidates 0] [dict remove $state matches]] candidates $candidates]
}
set normalizedMatches {}; set index 0
foreach candidate $candidates {
    set comparison {}; foreach {key type value} [:comparison $local $candidate] {dict set comparison $key $value}
    if {[dict get $comparison normalizedIdentical]} {lappend normalizedMatches $index}
    incr index
}
set matches $normalizedMatches
if {[llength $matches]!=1} {
    return [dict create selected false selection unresolved-conditional-variants candidates $candidates matchingCandidates $matches]
}
set index [lindex $matches 0]
return [dict create selected true selection matching-loaded-conditional-variant selectedCandidate $index remote [dict merge [lindex $candidates $index] [dict remove $state matches]] candidates $candidates]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: