+ FieldDescriptor recurseSurroundingClasses( ClassDescriptor icd, String varname ) {
+ if( null == icd || false == icd.isInnerClass() )
+ return null;
+
+ ClassDescriptor surroundingDesc = icd.getSurroundingDesc();
+ if( null == surroundingDesc )
+ return null;
+
+ SymbolTable fieldTable = surroundingDesc.getFieldTable();
+ FieldDescriptor fd = ( FieldDescriptor ) fieldTable.get( varname );
+ if( null != fd )
+ return fd;
+ return recurseSurroundingClasses( surroundingDesc, varname );
+ }
+
+ FieldAccessNode fieldAccessExpression( ClassDescriptor icd, String varname, NameNode nn ) {
+ FieldDescriptor fd = recurseSurroundingClasses( icd, varname );
+ if( null == fd )
+ return null;
+
+ ClassDescriptor cd = fd.getClassDescriptor();
+ int depth = 0;
+ int startingDepth = icd.getInnerDepth();
+
+ if( true == cd.isInnerClass() )
+ depth = cd.getInnerDepth();
+
+ String composed = "this";
+ NameDescriptor runningDesc = new NameDescriptor( "this" );;
+
+ for ( int index = startingDepth; index >= depth; --index ) {
+ composed = "this$" + String.valueOf( index );
+ runningDesc = new NameDescriptor( runningDesc, composed );
+ }
+
+ NameDescriptor idDesc = new NameDescriptor( runningDesc, varname );
+
+
+ FieldAccessNode theFieldNode = ( FieldAccessNode )translateNameDescriptorintoExpression( idDesc, nn.getNumLine() );
+ return theFieldNode;
+ }
+