001    package escjava.vcGeneration;
002    
003    // TBoolOp = return a boolean and sons are boolean : list(boolean) -> boolean
004    public class TAsField extends TFunction {
005    
006        public void typeTree(){
007            
008            if(sons.size()!=2)
009                TDisplay.err(this, "typeTree()", "Node with "+sons.size()+" instead of 2, that's strange...");
010            else {
011                TNode n1 = getChildAt(0);
012                TNode n2 = getChildAt(1);
013    
014                /* we are sure about the type of the sons
015                 * The types of the second son is set first, thus
016                 * we can use it for the first one.
017                 */
018                n2.setType(_Type,true);
019                n2.typeTree();
020                
021                // we say this is a field
022                n1.setType(_Field,true);
023                // we add his own type too
024                VariableInfo vi = n1.getVariableInfo();
025    
026                vi.setSecondType(n2.getTypeInfo());
027    
028                n1.typeTree();
029            }
030    
031        }
032    
033        public void accept(/*@ non_null @*/ TVisitor v) throws java.io.IOException{
034            v.visitTAsField(this);
035        }
036    
037    }
038