diff options
author | dkf <dkf@noemail.net> | 2011-04-04 22:53:26 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2011-04-04 22:53:26 (GMT) |
commit | 3a411df191c09f5ec451fdecaa4b6dce075c48db (patch) | |
tree | b63e806ef1238d4d4a16441419f7a6625fd66c33 /generic/tclOOInfo.c | |
parent | 83e19c30446d2c15a632f16df1a29b59a2b0f110 (diff) | |
download | tcl-3a411df191c09f5ec451fdecaa4b6dce075c48db.zip tcl-3a411df191c09f5ec451fdecaa4b6dce075c48db.tar.gz tcl-3a411df191c09f5ec451fdecaa4b6dce075c48db.tar.bz2 |
More generation of error codes (TclOO miscellany).
FossilOrigin-Name: 08998a4f586f1580b406fb7ede45dccddbeebeb5
Diffstat (limited to 'generic/tclOOInfo.c')
-rw-r--r-- | generic/tclOOInfo.c | 22 |
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; } |