help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] [PATCH 08/15] stinst: Avoid running into recursion


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] [PATCH 08/15] stinst: Avoid running into recursion in ProxyNamespace
Date: Sun, 14 Apr 2013 15:44:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

Il 08/04/2013 11:30, Holger Hans Peter Freyther ha scritto:
> (STInST.STClassLoaderObjects.ProxyNamespace
>       on: Smalltalk for: STInST.STClassLoader new) displayString
> 
> triggered a DNU and after fixing that it ended with an infinite
> recursion as the value is self. Avoid the recursion but this is
> probably not the right fix.

Actually it's ok, but please add a comment.

Paolo

> 2013-03-31  Holger Hans Peter Freyther  <address@hidden>
> 
>       * tests/stcompiler.ok: Update the test result.
>       * tests/stcompiler.st: Add a testcase for ProxyNamespace>>#printOn:.
> 
> 2013-03-31  Holger Hans Peter Freyther  <address@hidden>
> 
>       * STLoaderObjs.st: Change ProxyNamespace>>#printOn to avoid
>       recursion into self.
> ---
>  ChangeLog                              |    5 +++++
>  packages/stinst/parser/ChangeLog       |    5 +++++
>  packages/stinst/parser/STLoaderObjs.st |   15 +++++++++------
>  tests/stcompiler.ok                    |    5 +++++
>  tests/stcompiler.st                    |    7 +++++++
>  5 files changed, 31 insertions(+), 6 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 8a3085d..277302a 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2013-03-31  Holger Hans Peter Freyther  <address@hidden>
> +
> +     * tests/stcompiler.ok: Update the test result.
> +     * tests/stcompiler.st: Add a testcase for ProxyNamespace>>#printOn:.
> +
>  2013-03-24  Holger Hans Peter Freyther  <address@hidden>
>  
>       * libgst/files.c: Add DirPackage.st to the bootstrap.
> diff --git a/packages/stinst/parser/ChangeLog 
> b/packages/stinst/parser/ChangeLog
> index 24bf131..0bc8d23 100644
> --- a/packages/stinst/parser/ChangeLog
> +++ b/packages/stinst/parser/ChangeLog
> @@ -1,3 +1,8 @@
> +2013-03-31  Holger Hans Peter Freyther  <address@hidden>
> +
> +     * STLoaderObjs.st: Change ProxyNamespace>>#printOn to avoid
> +     recursion into self.
> +
>  2013-02-23  Holger Hans Peter Freyther  <address@hidden>
>  
>       * RBParser.st: Fix RBParser>>#parsedNegatedNumber.
> diff --git a/packages/stinst/parser/STLoaderObjs.st 
> b/packages/stinst/parser/STLoaderObjs.st
> index 195ceef..076b1ef 100644
> --- a/packages/stinst/parser/STLoaderObjs.st
> +++ b/packages/stinst/parser/STLoaderObjs.st
> @@ -1507,13 +1507,16 @@ name
>  
>  printOn: aStream
>      "Print a representation of the receiver on aStream"
> -    aStream nextPutAll: self classNameString , '[', proxy name, '] (' ; nl.
> +    aStream nextPutAll: self class storeString , '[', proxy name, '] (' ; nl.
>      self myKeysAndValuesDo:
> -     [ :key :value | aStream tab;
> -                print: key;
> -                nextPutAll: '->';
> -                print: value;
> -                nl ].
> +        [ :key :value |
> +            value == self ifFalse: [
> +                aStream tab;
> +                    print: key;
> +                    nextPutAll: '->';
> +                    print: value;
> +                    nl ].
> +        ].
>      aStream nextPut: $)
>  !
>  
> diff --git a/tests/stcompiler.ok b/tests/stcompiler.ok
> index 4222e50..a0cebf4 100644
> --- a/tests/stcompiler.ok
> +++ b/tests/stcompiler.ok
> @@ -52,6 +52,11 @@ Execution begins...
>  returned value is 'an'
>  
>  Execution begins...
> +STInST.STClassLoaderObjects.ProxyNamespace[Smalltalk] (
> +)
> +returned value is ProxyNamespace new: 32 "<0>"
> +
> +Execution begins...
>  true
>  true
>  returned value is true
> diff --git a/tests/stcompiler.st b/tests/stcompiler.st
> index 36b48a7..5605a6e 100644
> --- a/tests/stcompiler.st
> +++ b/tests/stcompiler.st
> @@ -118,6 +118,13 @@ Eval [
>  ]
>  
>  Eval [
> +    | proxy |
> +    proxy := STInST.STClassLoaderObjects.ProxyNamespace
> +                    on: Smalltalk for: STInST.STClassLoader new.
> +    proxy printNl.
> +]
> +
> +Eval [
>      | classes bla |
>      "Check class variable parsing.."
>  
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]