diff options
| author | dkf <donal.k.fellows@manchester.ac.uk> | 2019-12-30 15:35:51 (GMT) |
|---|---|---|
| committer | dkf <donal.k.fellows@manchester.ac.uk> | 2019-12-30 15:35:51 (GMT) |
| commit | 6eb109c913cd2b43ad9298df8f9eaf9e66c75a77 (patch) | |
| tree | 8d77b0be0653b53557cb66a10e698be748fefa6c /generic/tclOOScript.h | |
| parent | edb3a561eb7b62dd8d6140994b96f589afa40a02 (diff) | |
| download | tcl-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 'generic/tclOOScript.h')
| -rw-r--r-- | generic/tclOOScript.h | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/generic/tclOOScript.h b/generic/tclOOScript.h index 7a4a0bb..e8fd814 100644 --- a/generic/tclOOScript.h +++ b/generic/tclOOScript.h @@ -348,7 +348,21 @@ static const char *tclOOSetupScript = "\t\tproc ReadAll {object my} {\n" "\t\t\tset result {}\n" "\t\t\tforeach prop [info object property $object -all -readable] {\n" -"\t\t\t\tdict set result $prop [$my <ReadProp$prop>]\n" +"\t\t\t\ttry {\n" +"\t\t\t\t\tdict set result $prop [$my <ReadProp$prop>]\n" +"\t\t\t\t} on error {msg opt} {\n" +"\t\t\t\t\tdict set opt -level 2\n" +"\t\t\t\t\treturn -options $opt $msg\n" +"\t\t\t\t} on return {msg opt} {\n" +"\t\t\t\t\tdict incr opt -level 2\n" +"\t\t\t\t\treturn -options $opt $msg\n" +"\t\t\t\t} on break {} {\n" +"\t\t\t\t\treturn -code error -level 2 -errorcode {TCLOO SHENANIGANS} \\\n" +"\t\t\t\t\t\t\"property getter for $prop did a break\"\n" +"\t\t\t\t} on continue {} {\n" +"\t\t\t\t\treturn -code error -level 2 -errorcode {TCLOO SHENANIGANS} \\\n" +"\t\t\t\t\t\t\"property getter for $prop did a continue\"\n" +"\t\t\t\t}\n" "\t\t\t}\n" "\t\t\treturn $result\n" "\t\t}\n" @@ -358,7 +372,22 @@ static const char *tclOOSetupScript = "\t\t\t\t\t-level 2 -errorcode [list \\\n" "\t\t\t\t\t\tTCL LOOKUP INDEX property $propertyName]] \\\n" "\t\t\t\t\t\t $props $propertyName]\n" -"\t\t\treturn [$my <ReadProp$prop>]\n" +"\t\t\ttry {\n" +"\t\t\t\tset value [$my <ReadProp$prop>]\n" +"\t\t\t} on error {msg opt} {\n" +"\t\t\t\tdict set opt -level 2\n" +"\t\t\t\treturn -options $opt $msg\n" +"\t\t\t} on return {msg opt} {\n" +"\t\t\t\tdict incr opt -level 2\n" +"\t\t\t\treturn -options $opt $msg\n" +"\t\t\t} on break {} {\n" +"\t\t\t\treturn -code error -level 2 -errorcode {TCLOO SHENANIGANS} \\\n" +"\t\t\t\t\t\"property getter for $prop did a break\"\n" +"\t\t\t} on continue {} {\n" +"\t\t\t\treturn -code error -level 2 -errorcode {TCLOO SHENANIGANS} \\\n" +"\t\t\t\t\t\"property getter for $prop did a continue\"\n" +"\t\t\t}\n" +"\t\t\treturn $value\n" "\t\t}\n" "\t\tproc WriteMany {object my setterMap} {\n" "\t\t\tset props [info object property $object -all -writable]\n" @@ -367,7 +396,21 @@ static const char *tclOOSetupScript = "\t\t\t\t\t-level 2 -errorcode [list \\\n" "\t\t\t\t\t\tTCL LOOKUP INDEX property $prop]] \\\n" "\t\t\t\t\t\t\t $props $prop]\n" -"\t\t\t\t$my <WriteProp$prop> $value\n" +"\t\t\t\ttry {\n" +"\t\t\t\t\t$my <WriteProp$prop> $value\n" +"\t\t\t\t} on error {msg opt} {\n" +"\t\t\t\t\tdict set opt -level 2\n" +"\t\t\t\t\treturn -options $opt $msg\n" +"\t\t\t\t} on return {msg opt} {\n" +"\t\t\t\t\tdict incr opt -level 2\n" +"\t\t\t\t\treturn -options $opt $msg\n" +"\t\t\t\t} on break {} {\n" +"\t\t\t\t\treturn -code error -level 2 -errorcode {TCLOO SHENANIGANS} \\\n" +"\t\t\t\t\t\t\"property setter for $prop did a break\"\n" +"\t\t\t\t} on continue {} {\n" +"\t\t\t\t\treturn -code error -level 2 -errorcode {TCLOO SHENANIGANS} \\\n" +"\t\t\t\t\t\t\"property setter for $prop did a continue\"\n" +"\t\t\t\t}\n" "\t\t\t}\n" "\t\t\treturn\n" "\t\t}\n" |
