[BUG][FIX] Incorrect references to auto-declared instance variables

Ben Schroeder bschroeder at procro.com
Tue Aug 10 15:13:15 UTC 2004


The attached changeset fixes a problem with Parser's ability to declare
instance variables during a compilation.  From the preamble:

When parsing methods, Parsers now give the option to declare instance
variables for undeclared variable names.  However, it is possible for
them to assign the wrong offset to later references to those variables.

For example, if you were extending TestCase, and compiled

    MyTestCase>>someTest
    
        newInstVar _ 3.
        self should: [newInstVar = 3].

asking to declare the instance variable during compilation, then
the test would unexpectedly fail when run.  This is because the parser
does not take superclass variables into account when assigning an offset
to the second reference to newInstVar.  (This can be seen by selecting
'decompile' when browsing the method.)

This changeset changes Parser to use #allInstVarNames when correcting
these references so that superclass variables are taken into account.

Regards,
Ben Schroeder

-------------- next part --------------
A non-text attachment was scrubbed...
Name: FixParserCorrectVariableOffset-bvs.1.cs.gz
Type: application/octet-stream
Size: 1653 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040810/c3f1cf55/FixParserCorrectVariableOffset-bvs.1.cs.obj


More information about the Squeak-dev mailing list