Microsoft.JScript.NumericBinaryAssign.InferType C# (CSharp) Method

InferType() private method

private InferType ( JSField inference_target ) : IReflect
inference_target JSField
return IReflect
      internal override IReflect InferType(JSField inference_target){
        Debug.Assert(Globals.TypeRefs.InReferenceContext(this.type1));
        Debug.Assert(Globals.TypeRefs.InReferenceContext(this.type2));
        MethodInfo oper;
        if (this.type1 == null || inference_target != null){
          oper = this.GetOperator(this.operand1.InferType(inference_target), this.operand2.InferType(inference_target));
        }else
          oper = this.GetOperator(this.type1, this.type2);
        if (oper != null){
          this.metaData = oper;
          return oper.ReturnType;
        }
        if (this.type1 == Typeob.Char && this.operatorTok == JSToken.Minus){
          TypeCode t2 = Type.GetTypeCode(this.type2);
          if (Convert.IsPrimitiveNumericTypeCode(t2) || t2 == TypeCode.Boolean)
            return Typeob.Char;
          else if (t2 == TypeCode.Char)
            return Typeob.Int32;
        }
        if (Convert.IsPrimitiveNumericType(this.type1))
          if (Convert.IsPromotableTo(this.type2, this.type1) || ((this.operand2 is ConstantWrapper) && ((ConstantWrapper)this.operand2).IsAssignableTo(this.type1)))
            return this.type1;
          else if (Convert.IsPrimitiveNumericType(this.type1) && Convert.IsPrimitiveNumericTypeFitForDouble(this.type2))
            return Typeob.Double;
        return Typeob.Object;
      }