Example #1
0
Type typeAddO(Type t1, Type t2) {
  if (auto t = eval_const(t1, t2, cellAddO))    return *t;
  if (t1.subtypeOf(TInt) && t2.subtypeOf(TInt)) return TNum;
  if (auto t = usual_arith_conversions(t1, t2)) return *t;
  if (t1.subtypeOf(TArr) && t2.subtypeOf(TArr)) return TArr;
  return TInitCell;
}
Example #2
0
Type typeAdd(Type t1, Type t2) {
  if (auto t = eval_const(t1, t2, cellAdd))           return *t;
  if (auto t = usual_arith_conversions(t1, t2))       return *t;
  if (t1.subtypeOf(TArr) && t2.subtypeOf(TArr))       return TArr;
  if (t1.subtypeOf(TVec) && t2.subtypeOf(TVec))       return TVec;
  if (t1.subtypeOf(TDict) && t2.subtypeOf(TDict))     return TDict;
  if (t1.subtypeOf(TKeyset) && t2.subtypeOf(TKeyset)) return TKeyset;
  return TInitCell;
}
Example #3
0
Type typeSubMulImplO(Type t1, Type t2, CellOp op) {
  if (auto t = eval_const(t1, t2, op))          return *t;
  if (t1.subtypeOf(TInt) && t2.subtypeOf(TInt)) return TNum;
  if (auto t = usual_arith_conversions(t1, t2)) return *t;
  return TInitPrim;
}
Example #4
0
Type typeSubMulImpl(Type t1, Type t2, CellOp op) {
  if (auto t = eval_const(t1, t2, op))          return *t;
  if (auto t = usual_arith_conversions(t1, t2)) return *t;
  return TInitPrim;
}
Example #5
0
Type typeMul(Type t1, Type t2) {
    if (auto t = eval_const(t1, t2, cellMul))     return *t;
    if (auto t = usual_arith_conversions(t1, t2)) return *t;
    return TInitCell;
}