summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2024-02-28 10:02:05 (GMT)
committersebres <sebres@users.sourceforge.net>2024-02-28 10:02:05 (GMT)
commitdec80af27bc53ffa91ad7cec63a0e562ef1994d1 (patch)
treedf5f751cdd02aa8bad6da17d1f56fe4dddf6a46e
parent6ddb50e8f57d98533b2944e8ab7ad30145c1a19f (diff)
parent7e734ace3b94f16fcead3e964d811bea13e0f2d5 (diff)
downloadtcl-dec80af27bc53ffa91ad7cec63a0e562ef1994d1.zip
tcl-dec80af27bc53ffa91ad7cec63a0e562ef1994d1.tar.gz
tcl-dec80af27bc53ffa91ad7cec63a0e562ef1994d1.tar.bz2
merge 8.7
-rw-r--r--library/clock.tcl2
-rw-r--r--library/msgcat/msgcat.tcl45
2 files changed, 26 insertions, 21 deletions
diff --git a/library/clock.tcl b/library/clock.tcl
index 706bc98..9d41b80 100644
--- a/library/clock.tcl
+++ b/library/clock.tcl
@@ -60,7 +60,7 @@ namespace eval ::tcl::clock {
namespace import ::msgcat::mcload
namespace import ::msgcat::mclocale
- namespace import ::msgcat::mc
+ proc mc {args} { tailcall ::msgcat::mcn [namespace current] {*}$args }
namespace import ::msgcat::mcpackagelocale
}
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index fa21685..589da7a 100644
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -1220,27 +1220,32 @@ proc msgcat::mcutil::ConvertLocale {value} {
# - called from an class defined oo object
# - called from a classless oo object
proc ::msgcat::PackageNamespaceGet {} {
- uplevel 2 {
- # Check self namespace to determine environment
- switch -exact -- [namespace which self] {
- {::oo::define::self} {
- # We are within a class definition
- return [namespace qualifiers [self]]
- }
- {::oo::Helpers::self} {
- # We are within an object
- set Class [info object class [self]]
- # Check for classless defined object
- if {$Class eq {::oo::object}} {
- return [namespace qualifiers [self]]
- }
- # Class defined object
- return [namespace qualifiers $Class]
- }
- default {
- # Not in object environment
- return [namespace current]
+ set ns [uplevel 2 { namespace current }]
+
+ if {![string match {::oo::*} $ns]} {
+ # Not in object environment
+ return $ns
+ }
+
+ # Check self namespace to determine environment
+ switch -exact -- [uplevel 2 { namespace which -command self }] {
+ {::oo::define::self} {
+ # We are within a class definition
+ return [namespace qualifiers [uplevel 2 { self }]]
+ }
+ {::oo::Helpers::self} {
+ # We are within an object
+ set Class [info object class [uplevel 2 { self }]]
+ # Check for classless defined object
+ if {$Class eq {::oo::object}} {
+ return [namespace qualifiers [uplevel 2 { self }]]
}
+ # Class defined object
+ return [namespace qualifiers $Class]
+ }
+ default {
+ # Not in object environment
+ return $ns
}
}
}