NameDescriptor nd=new NameDescriptor("this");
NameNode nn=new NameNode(nd);
nn.setNumLine(pn.getLine());
-
- FieldAccessNode fan=new FieldAccessNode(nn,"this$parent");
- fan.setNumLine(pn.getLine());
- return fan;
+ //because inner classes pass right thru......
+ /* FieldAccessNode fan=new FieldAccessNode(nn,"this$0");
+ fan.setNumLine(pn.getLine());*/
+ return nn;
} else if (isNode(pn,"isavailable")) {
NameDescriptor nd=new NameDescriptor(pn.getTerminal());
NameNode nn=new NameNode(nd);
throw new Error("Cast will always fail\n"+cn.printNode(0));
}
+ //FieldDescriptor checkFieldAccessNodeForParentNode( Descriptor md, SymbolTable na )
void checkFieldAccessNode(Descriptor md, SymbolTable nametable, FieldAccessNode fan, TypeDescriptor td) {
ExpressionNode left=fan.getExpression();
checkExpressionNode(md,nametable,left,null);
}
}
+ if (fd==null){
+ if((md instanceof MethodDescriptor) && false == ((MethodDescriptor)md).isStaticBlock()) {
+ ClassDescriptor cd = ((MethodDescriptor)md).getClassDesc();
+ FieldAccessNode theFieldNode = fieldAccessExpression( cd, fieldname, fan.getNumLine() );
+ if( null != theFieldNode ) {
+ //fan = theFieldNode;
+ checkFieldAccessNode( md, nametable, theFieldNode, td );
+ fan.setField( theFieldNode.getField() );
+ fan.setExpression( theFieldNode.getExpression() );
+ //TypeDescriptor td1 = fan.getType();
+ //td1.toString();
+ return;
+ }
+ }
+ throw new Error("Unknown field "+fieldname + " in "+fan.printNode(0)+" in "+md);
+ }
if (fd==null) {
ClassDescriptor surroundingCls=ltd.getClassDesc().getSurroundingDesc();
int numencloses=1;
throw new Error("Unknown field "+fieldname + " in "+fan.printNode(0)+" in "+md);
}
+
if (fd.getType().iswrapper()) {
FieldAccessNode fan2=new FieldAccessNode(left, fieldname);
fan2.setNumLine(left.getNumLine());
return recurseSurroundingClasses( surroundingDesc, varname );
}
- FieldAccessNode fieldAccessExpression( ClassDescriptor icd, String varname, NameNode nn ) {
+ FieldAccessNode fieldAccessExpression( ClassDescriptor icd, String varname, int linenum ) {
FieldDescriptor fd = recurseSurroundingClasses( icd, varname );
if( null == fd )
return null;
NameDescriptor idDesc = new NameDescriptor( runningDesc, varname );
- FieldAccessNode theFieldNode = ( FieldAccessNode )translateNameDescriptorintoExpression( idDesc, nn.getNumLine() );
+ FieldAccessNode theFieldNode = ( FieldAccessNode )translateNameDescriptorintoExpression( idDesc, linenum );
return theFieldNode;
}
//check the inner class case first.
if((md instanceof MethodDescriptor) && false == ((MethodDescriptor)md).isStaticBlock()) {
cd = ((MethodDescriptor)md).getClassDesc();
- FieldAccessNode theFieldNode = fieldAccessExpression( cd, varname, nn );
+ FieldAccessNode theFieldNode = fieldAccessExpression( cd, varname, nn.getNumLine() );
if( null != theFieldNode ) {
nn.setExpression(( ExpressionNode )theFieldNode);
checkExpressionNode(md,nametable,( ExpressionNode )theFieldNode,td);