Changeset 3007


Ignore:
Timestamp:
07/12/05 02:14:24 (8 years ago)
Author:
moschny
Message:
  • Merge changes from trunk to hotfix (i.e. stable) branch:
Error: Failed to load processor svn
No macro or processor named 'svn' found

Follow-up for [888], resolution to reopened ticket:63.

  • Only generate fully qualified accesses, if the accessed variable

belongs to an enclosing class. Otherwise generate an access through
this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/jp1_07g-hotfix/gj/src/gjc/v6/jp/TransBody.java

    r2712 r3007  
    398398                        // Find referenced enclosing type the accessed 
    399399                        // variable belongs to. See See: BUG/0063 
     400                        boolean definedInOuterClass = false; 
    400401                        Type vowner = var.owner.type; 
    401402                        Type cclazz = c.clazz.type; 
    402403                        while (! cclazz.subType(vowner)) { 
    403404                            cclazz = cclazz.outer(); 
     405                            definedInOuterClass = true; 
    404406                        } 
    405407 
     
    413415                            c.f.at(Position.NOPOS); 
    414416                            ref = c.f.Ident(Names._this); 
    415                         } else if (tools.isFinal(var)) { 
    416                             // This is another great hack, because 
    417                             // final variables can not be initialized 
    418                             // with a fully qualified name, even with 
    419                             // javac. Is this a bug in javac and gj? 
    420                             c.f.at(Position.NOPOS); 
    421                             ref = c.f.Ident(Names._this); 
    422417                        } else if (! tools.hasRef(cclazz.tsym)) { 
    423418                            // A instance variable of an anonymous 
     
    427422                            ref = null; 
    428423                        } else { 
    429                             c.f.at(Position.NOPOS); 
    430                             ref = c.f.Select(tools.getRef(cclazz.tsym), Names._this); 
     424                            if (definedInOuterClass) { 
     425                                c.f.at(Position.NOPOS); 
     426                                ref = c.f.Select(tools.getRef(cclazz.tsym), Names._this); 
     427                            } else { 
     428                                c.f.at(Position.NOPOS); 
     429                                ref = c.f.Ident(Names._this); 
     430                            } 
    431431                        } 
    432432                        isStaticRef = false; 
Note: See TracChangeset for help on using the changeset viewer.