[ENH] DeclareInstVar (declares fine, but compiles as a temp var)

Lukas Renggli renggli at hotmail.com
Wed Jul 16 07:16:16 UTC 2003


> However, it seems to compile the variable incorrectly.  It declares an
> instance variable, but it compiles it as a temporary variable.  Here's
> the relevant code:
> 
> !Parser methodsFor: 'error correction' stamp: 'lr 7/15/2003 20:06'!
> declareInstVar: name
> 	encoder classEncoding addInstVarName: name.
> 	^encoder bindArg: name! !

That is true, I was quite unsure about this part of the code and I did 
not have a closer look at the parsing stuff yet. But when decompiling to 
byte-code I agree that you are right:

	a
		^a

gives using auto i-var declaration

	5 <10> pushTemp: 0
	6 <7C> returnTop

else

	Quick return field 4 (0-based)

However from the user point of view there seems to be no difference and 
both work perfectly in my 3.5 image.

Cheers
Lukas

-- 
Lukas Renggli
http://renggli.freezope.org



More information about the Squeak-dev mailing list