summaryrefslogtreecommitdiffstats
path: root/generic/tclOOInfo.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-04-04 22:53:26 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-04-04 22:53:26 (GMT)
commit4b3579029f185d116b809a5697720ceeb868c022 (patch)
treeb63e806ef1238d4d4a16441419f7a6625fd66c33 /generic/tclOOInfo.c
parent94153a5def93c7aa8fb86247f30c40b138c2e57e (diff)
downloadtcl-4b3579029f185d116b809a5697720ceeb868c022.zip
tcl-4b3579029f185d116b809a5697720ceeb868c022.tar.gz
tcl-4b3579029f185d116b809a5697720ceeb868c022.tar.bz2
More generation of error codes (TclOO miscellany).
Diffstat (limited to 'generic/tclOOInfo.c')
-rw-r--r--generic/tclOOInfo.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/generic/tclOOInfo.c b/generic/tclOOInfo.c
index 2cd7cc3..4f25772 100644
--- a/generic/tclOOInfo.c
+++ b/generic/tclOOInfo.c
@@ -216,30 +216,22 @@ InfoObjectClassCmd(
TclOOObjectName(interp, oPtr->selfCls->thisPtr));
return TCL_OK;
} else {
- Object *o2Ptr;
- Class *mixinPtr;
+ Class *mixinPtr, *o2clsPtr;
int i;
- o2Ptr = (Object *) Tcl_GetObjectFromObj(interp, objv[2]);
- if (o2Ptr == NULL) {
- return TCL_ERROR;
- }
- if (o2Ptr->classPtr == NULL) {
- Tcl_AppendResult(interp, "object \"", TclGetString(objv[2]),
- "\" is not a class", NULL);
- Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "CLASS",
- TclGetString(objv[2]), NULL);
+ o2clsPtr = GetClassFromObj(interp, objv[2]);
+ if (o2clsPtr == NULL) {
return TCL_ERROR;
}
FOREACH(mixinPtr, oPtr->mixins) {
- if (TclOOIsReachable(o2Ptr->classPtr, mixinPtr)) {
+ if (TclOOIsReachable(o2clsPtr, mixinPtr)) {
Tcl_SetObjResult(interp, Tcl_NewIntObj(1));
return TCL_OK;
}
}
Tcl_SetObjResult(interp, Tcl_NewIntObj(
- TclOOIsReachable(o2Ptr->classPtr, oPtr->selfCls)));
+ TclOOIsReachable(o2clsPtr, oPtr->selfCls)));
return TCL_OK;
}
}
@@ -496,6 +488,7 @@ InfoObjectIsACmd(
}
if (o2Ptr->classPtr == NULL) {
Tcl_AppendResult(interp, "non-classes cannot be mixins", NULL);
+ Tcl_SetErrorCode(interp, "TCL", "OO", "NONCLASS", NULL);
return TCL_ERROR;
} else {
Class *mixinPtr;
@@ -520,6 +513,7 @@ InfoObjectIsACmd(
}
if (o2Ptr->classPtr == NULL) {
Tcl_AppendResult(interp, "non-classes cannot be types", NULL);
+ Tcl_SetErrorCode(interp, "TCL", "OO", "NONCLASS", NULL);
return TCL_ERROR;
}
if (TclOOIsReachable(o2Ptr->classPtr, oPtr->selfCls)) {
@@ -882,6 +876,7 @@ InfoClassConstrCmd(
if (procPtr == NULL) {
Tcl_AppendResult(interp,
"definition not available for this kind of method", NULL);
+ Tcl_SetErrorCode(interp, "TCL", "OO", "METHOD_TYPE", NULL);
return TCL_ERROR;
}
@@ -1009,6 +1004,7 @@ InfoClassDestrCmd(
if (procPtr == NULL) {
Tcl_AppendResult(interp,
"definition not available for this kind of method", NULL);
+ Tcl_SetErrorCode(interp, "TCL", "OO", "METHOD_TYPE", NULL);
return TCL_ERROR;
}