summaryrefslogtreecommitdiffstats
path: root/library/msgcat
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2018-01-16 14:13:14 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2018-01-16 14:13:14 (GMT)
commite89d1e331e09f13b01ad0436d00bf199214d4d46 (patch)
tree686496e6b69066ee61507a9220129e31c0428ab0 /library/msgcat
parente841295386a779136b49e7ca3843a43279a8c185 (diff)
downloadtcl-e89d1e331e09f13b01ad0436d00bf199214d4d46.zip
tcl-e89d1e331e09f13b01ad0436d00bf199214d4d46.tar.gz
tcl-e89d1e331e09f13b01ad0436d00bf199214d4d46.tar.bz2
Solve case where msgcat is called within a class definition script (works only for 8.7)
Diffstat (limited to 'library/msgcat')
-rw-r--r--library/msgcat/msgcat.tcl29
1 files changed, 19 insertions, 10 deletions
diff --git a/library/msgcat/msgcat.tcl b/library/msgcat/msgcat.tcl
index 4233005..0b1079b 100644
--- a/library/msgcat/msgcat.tcl
+++ b/library/msgcat/msgcat.tcl
@@ -1151,17 +1151,26 @@ proc msgcat::ConvertLocale {value} {
proc ::msgcat::PackageNamespaceGet {} {
uplevel 2 {
# Check for no object
- # (undocumented test proposed by dkf 2018-01-12)
- if { [namespace which self] ne "::oo::Helpers::self"} {
- return [namespace current]
- }
- set Class [info object class [self]]
- # Check for classless defined object
- if {$Class eq {::oo::object}} {
- return [namespace qualifiers [self]]
+ 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]
+ }
}
- # Class defined object
- return [namespace qualifiers $Class]
}
}