aboutsummaryrefslogtreecommitdiff
path: root/jim.c
diff options
context:
space:
mode:
authorantirez <antirez>2005-03-04 22:04:19 +0000
committerantirez <antirez>2005-03-04 22:04:19 +0000
commitc766216d1f1bbd83be00fdde4d0573a1c2cada5a (patch)
tree8a198c6dba9774a283e4863c900fbae1cc3f245b /jim.c
parent94b068cb5260d8e96c8fb1f8d6be8063edb3a303 (diff)
downloadjimtcl-c766216d1f1bbd83be00fdde4d0573a1c2cada5a.zip
jimtcl-c766216d1f1bbd83be00fdde4d0573a1c2cada5a.tar.gz
jimtcl-c766216d1f1bbd83be00fdde4d0573a1c2cada5a.tar.bz2
Fix for [info local], at top level an empty list is now returned.
Diffstat (limited to 'jim.c')
-rw-r--r--jim.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/jim.c b/jim.c
index c713d5e..ddb504b 100644
--- a/jim.c
+++ b/jim.c
@@ -1,7 +1,7 @@
/* Jim - A small embeddable Tcl interpreter
* Copyright 2005 Salvatore Sanfilippo <antirez@invece.org>
*
- * $Id: jim.c,v 1.57 2005/03/04 21:59:40 antirez Exp $
+ * $Id: jim.c,v 1.58 2005/03/04 22:04:19 antirez Exp $
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -7125,6 +7125,11 @@ static Jim_Obj *JimVariablesList(Jim_Interp *interp, Jim_Obj *patternObjPtr,
if (mode == JIM_VARLIST_GLOBALS) {
htiter = Jim_GetHashTableIterator(&interp->topFramePtr->vars);
} else {
+ /* For [info locals], if we are at top level an emtpy list
+ * is returned. I don't agree, but we aim at compatibility (SS) */
+ if (mode == JIM_VARLIST_LOCALS &&
+ interp->framePtr == interp->topFramePtr)
+ return listObjPtr;
htiter = Jim_GetHashTableIterator(&interp->framePtr->vars);
}
while ((he = Jim_NextHashEntry(htiter)) != NULL) {