// ne traite pas les boolean public StreeEQ(Stree left, Stree right, Env currentEnv) throws TypeException { super(EnumTag.EQ, left, right, null); this.currentEnv = currentEnv; if (isIntegerOrFloat(left) || isBoolean(left)) { this.left.type = left.getEnumType(); } else { if (currentEnv.find(String.valueOf(left.getObject())) == null) { throw new TypeException("variable [" + left.getObject() + "] not declared "); } else { this.left.type = currentEnv.find(String.valueOf(left.getObject())).getEnumType(); } } if (isIntegerOrFloat(right) || isBoolean(right)) { this.right.type = right.getEnumType(); } else { if (currentEnv.find(String.valueOf(right.getObject())) == null) { throw new TypeException("variable [" + right.getObject() + "] not declared "); } else { this.right.type = currentEnv.find(String.valueOf(right.getObject())).getEnumType(); } } }
public static ITree toITree(Stree stree) throws TypeException { return stree.toITree(); }