Package org.renjin.gcc.translate

Source Code of org.renjin.gcc.translate.PrimitiveAssignment

package org.renjin.gcc.translate;

import org.renjin.gcc.gimple.type.*;
import org.renjin.gcc.gimple.type.GimpleIntegerType;
import org.renjin.gcc.jimple.JimpleExpr;
import org.renjin.gcc.jimple.JimpleType;
import org.renjin.gcc.translate.expr.ImExpr;
import org.renjin.gcc.translate.expr.ImLValue;
import org.renjin.gcc.translate.expr.PrimitiveLValue;
import org.renjin.gcc.translate.type.ImPrimitiveType;
import org.renjin.gcc.translate.type.PrimitiveTypes;

public class PrimitiveAssignment {

  public static void assign(FunctionContext context, ImExpr lhs, ImExpr rhs) {
    if(lhs instanceof PrimitiveLValue && rhs.type() instanceof ImPrimitiveType) {
      ImPrimitiveType lhsType = (ImPrimitiveType) lhs.type();
      JimpleExpr jimpleExpr = rhs.translateToPrimitive(context, lhsType);

      ((PrimitiveLValue) lhs).writePrimitiveAssignment(jimpleExpr);
//    } else if(lhs instanceof ImLValue) {
//      ((ImLValue) lhs).writeAssignment(context, rhs);


    } else {

      throw new UnsupportedOperationException(String.format("Unable to assign %s to %s", rhs, lhs));
    }
  }

 
}
TOP

Related Classes of org.renjin.gcc.translate.PrimitiveAssignment

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.