>From 2732fe58d25db710fe648010e187efc52fb026e4 Mon Sep 17 00:00:00 2001 From: Gwenael Casaccio
Date: Tue, 3 Sep 2013 14:58:42 +0200 Subject: [PATCH] Fix an inifinite recursion while printing ProxyNamespace --- packages/stinst/parser/ChangeLog | 5 +++ packages/stinst/parser/STLoaderObjs.st | 25 +++++++------ packages/stinst/parser/STLoaderObjsTests.st | 55 +++++++++++++++++++++++++++++ packages/stinst/parser/package.xml | 2 ++ tests/stcompiler.ok | 3 +- 5 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 packages/stinst/parser/STLoaderObjsTests.st diff --git a/packages/stinst/parser/ChangeLog b/packages/stinst/parser/ChangeLog index 9c73d6f..072a89c 100644 --- a/packages/stinst/parser/ChangeLog +++ b/packages/stinst/parser/ChangeLog @@ -1,5 +1,10 @@ 2013-08-10 Gwenael Casaccio + * STLoaderObjs.st: Fix ProxyNamespace>>#printOn: and add ProxyNamespace>>#examineOn:. + * STLoaderObjsTests.st: Add testcase for ProxyNamespace>>#printOn:. + +2013-08-10 Gwenael Casaccio + * RBParser.st: Fix RBScanner>>#scanNumberValue. * RewriteTests.st: Add testcase for number and array literal parsing. diff --git a/packages/stinst/parser/STLoaderObjs.st b/packages/stinst/parser/STLoaderObjs.st index 9bbb0ea..1bbf91d 100644 --- a/packages/stinst/parser/STLoaderObjs.st +++ b/packages/stinst/parser/STLoaderObjs.st @@ -1507,19 +1507,22 @@ name printOn: aStream "Print a representation of the receiver on aStream" - aStream nextPutAll: self class storeString , '[', proxy name, '] (' ; nl. + aStream nextPutAll: self class storeString , '[', proxy name, ']'. +! + +examineOn: aStream + "Print a representation of the receiver on aStream" + aStream + print: self; + nextPutAll: ' ('. self myKeysAndValuesDo: [ :key :value | - "The ProxyNamespace is linked to itself in - ProxyNamespace class>>#on:for: so we need to skip ourself - here or we will loop forever." - value == self ifFalse: [ - aStream tab; - print: key; - nextPutAll: '->'; - print: value; - nl ]. - ]. + aStream + tab; + print: key; + nextPutAll: '->'; + print: value; + nl ]. aStream nextPut: $) ! diff --git a/packages/stinst/parser/STLoaderObjsTests.st b/packages/stinst/parser/STLoaderObjsTests.st new file mode 100644 index 0000000..5a10e0a --- /dev/null +++ b/packages/stinst/parser/STLoaderObjsTests.st @@ -0,0 +1,55 @@ +"====================================================================== +| +| STLoaderObjsTests tests +| +| + ======================================================================" + +"====================================================================== +| +| Copyright (C) 2007,2013 Free Software Foundation, Inc. +| Written by Stephen Compall. +| +| This file is part of the GNU Smalltalk class library. +| +| The GNU Smalltalk class library is free software; you can redistribute it +| and/or modify it under the terms of the GNU Lesser General Public License +| as published by the Free Software Foundation; either version 2.1, or (at +| your option) any later version. +| +| The GNU Smalltalk class library is distributed in the hope that it will be +| useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser +| General Public License for more details. +| +| You should have received a copy of the GNU Lesser General Public License +| along with the GNU Smalltalk class library; see the file COPYING.LIB. +| If not, write to the Free Software Foundation, 59 Temple Place - Suite +| 330, Boston, MA 02110-1301, USA. +| + ======================================================================" + + + +Namespace current: STInST.Tests [ + + TestCase subclass: TestSTLoaderObjects [ + + testProxyNamespacePrinting [ +