diff options
author | dkf <dkf@noemail.net> | 2008-09-23 05:05:41 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2008-09-23 05:05:41 (GMT) |
commit | 3628fb9e7a7c001f8363e2a09eae44423db49ed4 (patch) | |
tree | 6be64065e9b0dc708cce2d80b40e8aa2bdad98b8 /generic/tclOO.c | |
parent | 11329b482f28cec3164e6a3f73209220c56721dc (diff) | |
download | tcl-3628fb9e7a7c001f8363e2a09eae44423db49ed4.zip tcl-3628fb9e7a7c001f8363e2a09eae44423db49ed4.tar.gz tcl-3628fb9e7a7c001f8363e2a09eae44423db49ed4.tar.bz2 |
Implementation of TIP #320.#320.#320.
FossilOrigin-Name: 9bc559dfecaf90d35b29ada553d71366642a9017
Diffstat (limited to 'generic/tclOO.c')
-rw-r--r-- | generic/tclOO.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c index b25f070..11a7cbd 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclOO.c,v 1.16 2008/09/01 00:35:42 dkf Exp $ + * RCS: @(#) $Id: tclOO.c,v 1.17 2008/09/23 05:05:48 dkf Exp $ */ #ifdef HAVE_CONFIG_H @@ -38,6 +38,7 @@ static const struct { {"self", TclOODefineSelfObjCmd, 0}, {"superclass", TclOODefineSuperclassObjCmd, 0}, {"unexport", TclOODefineUnexportObjCmd, 0}, + {"variable", TclOODefineVariablesObjCmd, 0}, {NULL, NULL, 0} }, objdefCmds[] = { {"class", TclOODefineClassObjCmd, 1}, @@ -49,6 +50,7 @@ static const struct { {"mixin", TclOODefineMixinObjCmd, 1}, {"renamemethod", TclOODefineRenameMethodObjCmd, 1}, {"unexport", TclOODefineUnexportObjCmd, 1}, + {"variable", TclOODefineVariablesObjCmd, 1}, {NULL, NULL, 0} }; @@ -453,6 +455,7 @@ AllocObject( configNamespace: TclSetNsPath((Namespace *) oPtr->namespacePtr, 1, &fPtr->helpersNs); + TclOOSetupVariableResolver(oPtr->namespacePtr); /* * Suppress use of compiled versions of the commands in this object's @@ -761,7 +764,7 @@ ObjectNamespaceDeleted( FOREACH_HASH_DECLS; Class *clsPtr = oPtr->classPtr, *mixinPtr; Method *mPtr; - Tcl_Obj *filterObj; + Tcl_Obj *filterObj, *variableObj; int i, preserved = !(oPtr->flags & OBJECT_DELETED); /* @@ -808,6 +811,13 @@ ObjectNamespaceDeleted( ckfree((char *) oPtr->methodsPtr); } + FOREACH(variableObj, oPtr->variables) { + Tcl_DecrRefCount(variableObj); + } + if (i) { + ckfree((char *) oPtr->variables.list); + } + if (oPtr->chainCache) { TclOODeleteChainCache(oPtr->chainCache); } @@ -889,6 +899,14 @@ ObjectNamespaceDeleted( Tcl_DeleteHashTable(&clsPtr->classMethods); TclOODelMethodRef(clsPtr->constructorPtr); TclOODelMethodRef(clsPtr->destructorPtr); + + FOREACH(variableObj, clsPtr->variables) { + Tcl_DecrRefCount(variableObj); + } + if (i) { + ckfree((char *) clsPtr->variables.list); + } + DelRef(clsPtr); } |