Exemple #1
0
 public static IR cast <T>(IR from, DataType to, StaticExec exec) where T : IR_Cast, new()
 {
     if (exec != null &&
         @from.dKind == ValueKind.STATIC_VALUE)
     {
         return(new IR_Literal {
             dType = to, data = exec(((IR_Literal)@from).data, 0)
         });
     }
     return(new T {
         @from = @from, dType = to
     });
 }
Exemple #2
0
 public static IR operation <T>(IR a, IR b, StaticExec exec) where T : IR_Operation, new()
 {
     if (exec != null &&
         a.dKind == ValueKind.STATIC_VALUE &&
         b.dKind == ValueKind.STATIC_VALUE)
     {
         return(new IR_Literal {
             dType = a.dType, data = exec(((IR_Literal)a).data, ((IR_Literal)a).data)
         });
     }
     return(new T {
         a = a, b = b, dType = a.dType
     });
 }