Microsoft.JScript.NumericBinary.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.IsPrimitiveNumericTypeFitForDouble(this.type1) || Typeob.JSObject.IsAssignableFrom(this.type1)) 
        &&  (Convert.IsPrimitiveNumericTypeFitForDouble(this.type2) || Typeob.JSObject.IsAssignableFrom(this.type2)))
          return Typeob.Double;
        else
          return Typeob.Object;
      }