예제 #1
0
파일: BoxInfo.cs 프로젝트: Xtremrules/dot42
 /// <summary>
 /// Gets the box information for the given type.
 /// </summary>
 private static BoxInfo Get(XTypeReference type)
 {
     var info = Infos.FirstOrDefault(x => type.Is(x.metadataType));
     if (info != null)
         return info;
     throw new ArgumentException(string.Format("No box information for for type {0}", type.FullName));
 }
예제 #2
0
        private static bool CanPullComparisonUp(AstCode code, XTypeReference arg1, XTypeReference arg2, PullTarget target)
        {
            if (arg1 == null || arg2 == null)
                return false;

            bool isReference = arg1.IsDexObject() && arg1.IsDexObject();

            if (!isReference && !arg1.IsSame(arg2))
                return false;

            if (target == PullTarget.Comparison)
                return true;

            if (arg1.Is(XTypeReferenceKind.Float))
                return false;
            if (arg1.IsDexWide())
                return false;

            bool isEq = IsEqualsBranchOrComparison(code);

            if (isEq)
                return true;

            
            bool isUnsigned = arg1.IsUInt16() || arg1.IsUInt32(); // TODO: check if we really have to exclude unsigned.

            if (isReference || isUnsigned)
                return false;

            return true;
        }