1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
|
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
|
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
# There are 3 possibilities:
# - called from a proc
# - called from a oo class
# - called from a classless oo object
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]]
}
# Class defined object
return [namespace qualifiers $Class]
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]
}
}
}
}
# Initialize the default locale
proc msgcat::Init {} {
global env
|