예제 #1
0
 public Object visitStmtAssign(StmtAssign stmt) {
   Type lt = getType(stmt.getLHS());
   Type rt = getType(stmt.getRHS());
   String lhsn = null;
   Expression lhsExp = stmt.getLHS();
   while (lhsExp instanceof ExprArrayRange) {
     lhsExp = ((ExprArrayRange) lhsExp).getBase();
   }
   if (lhsExp instanceof ExprVar) {
     lhsn = ((ExprVar) lhsExp).getName();
   }
   Type ftype = matchTypes(stmt, lhsn, lt, rt);
   upgradeStarToInt(stmt.getRHS(), ftype);
   upgradeStarToInt(stmt.getLHS(), ftype);
   // recurse:
   Statement result = (Statement) super.visitStmtAssign(stmt);
   return result;
 }