summaryrefslogtreecommitdiffstats
path: root/tools/tclOOScript.tcl
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2019-12-30 15:35:51 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2019-12-30 15:35:51 (GMT)
commit6eb109c913cd2b43ad9298df8f9eaf9e66c75a77 (patch)
tree8d77b0be0653b53557cb66a10e698be748fefa6c /tools/tclOOScript.tcl
parentedb3a561eb7b62dd8d6140994b96f589afa40a02 (diff)
downloadtcl-6eb109c913cd2b43ad9298df8f9eaf9e66c75a77.zip
tcl-6eb109c913cd2b43ad9298df8f9eaf9e66c75a77.tar.gz
tcl-6eb109c913cd2b43ad9298df8f9eaf9e66c75a77.tar.bz2
Even more tests, this time of the return-code semantics of property getters and setters.
Diffstat (limited to 'tools/tclOOScript.tcl')
-rw-r--r--tools/tclOOScript.tcl49
1 files changed, 46 insertions, 3 deletions
diff --git a/tools/tclOOScript.tcl b/tools/tclOOScript.tcl
index 4dbc48c..56a7bf8 100644
--- a/tools/tclOOScript.tcl
+++ b/tools/tclOOScript.tcl
@@ -600,7 +600,21 @@
proc ReadAll {object my} {
set result {}
foreach prop [info object property $object -all -readable] {
- dict set result $prop [$my <ReadProp$prop>]
+ try {
+ dict set result $prop [$my <ReadProp$prop>]
+ } on error {msg opt} {
+ dict set opt -level 2
+ return -options $opt $msg
+ } on return {msg opt} {
+ dict incr opt -level 2
+ return -options $opt $msg
+ } on break {} {
+ return -code error -level 2 -errorcode {TCLOO SHENANIGANS} \
+ "property getter for $prop did a break"
+ } on continue {} {
+ return -code error -level 2 -errorcode {TCLOO SHENANIGANS} \
+ "property getter for $prop did a continue"
+ }
}
return $result
}
@@ -620,7 +634,22 @@
-level 2 -errorcode [list \
TCL LOOKUP INDEX property $propertyName]] \
$props $propertyName]
- return [$my <ReadProp$prop>]
+ try {
+ set value [$my <ReadProp$prop>]
+ } on error {msg opt} {
+ dict set opt -level 2
+ return -options $opt $msg
+ } on return {msg opt} {
+ dict incr opt -level 2
+ return -options $opt $msg
+ } on break {} {
+ return -code error -level 2 -errorcode {TCLOO SHENANIGANS} \
+ "property getter for $prop did a break"
+ } on continue {} {
+ return -code error -level 2 -errorcode {TCLOO SHENANIGANS} \
+ "property getter for $prop did a continue"
+ }
+ return $value
}
# ------------------------------------------------------------------
@@ -638,7 +667,21 @@
-level 2 -errorcode [list \
TCL LOOKUP INDEX property $prop]] \
$props $prop]
- $my <WriteProp$prop> $value
+ try {
+ $my <WriteProp$prop> $value
+ } on error {msg opt} {
+ dict set opt -level 2
+ return -options $opt $msg
+ } on return {msg opt} {
+ dict incr opt -level 2
+ return -options $opt $msg
+ } on break {} {
+ return -code error -level 2 -errorcode {TCLOO SHENANIGANS} \
+ "property setter for $prop did a break"
+ } on continue {} {
+ return -code error -level 2 -errorcode {TCLOO SHENANIGANS} \
+ "property setter for $prop did a continue"
+ }
}
return
}