protected override CType __GetCType(IIdentifierTypeResolver Resolver) { return(new CSimpleType() { BasicType = CTypeBasic.Int }); }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { var CFunctionType = Function.GetCachedCType(Resolver).GetSpecifiedCType <CFunctionType>(); return((Function.GetCachedCType(Resolver) as CFunctionType).Return); //return CFunctionType; }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { if (Resolver == null) { return(null); } var LeftCType = Left.GetCachedCType(Resolver); if (LeftCType == null) { Console.Error.WriteLine("ArrayAccessExpression.GetCType : LeftCType is null"); throw (new NullReferenceException("LeftCType is null")); } var CBasePointerType = (LeftCType as CBasePointerType); if (CBasePointerType == null) { Console.Error.WriteLine("ArrayAccessExpression.GetCType : CBasePointerType is null"); Console.Error.WriteLine("LeftCType: {0} : {1}", LeftCType.GetType(), LeftCType); throw (new NullReferenceException("CBasePointerType is null")); } //return (Left.GetCType(Resolver) as CBasePointerType).GetCSimpleType(); return(CBasePointerType.GetChildTypes().First()); }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { return(new CPointerType(new CSimpleType() { BasicType = CTypeBasic.Char })); }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { if (Resolver == null) { return(null); } return(Resolver.ResolveIdentifierType(Identifier)); }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { var CBasePointerType = Expression.GetCachedCType(Resolver) as CBasePointerType; if (CBasePointerType == null) { throw(new Exception("Trying to dereference a non-pointer type")); } return(CBasePointerType.ElementCType); }
public CType GetCachedCType(IIdentifierTypeResolver Resolver) { if (Resolver == null) { return(null); } if (__Cached_IIdentifierTypeResolver != Resolver) { __Cached_IIdentifierTypeResolver = Resolver; __Cached_IIdentifierTypeResolver_CType = __GetCType(Resolver); } return(__Cached_IIdentifierTypeResolver_CType); }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { var LeftCType = LeftExpression.GetCachedCType(Resolver); var CUnionStructType = LeftCType.GetCUnionStructType(); if (CUnionStructType != null) { return(CUnionStructType.GetFieldByName(FieldName).CType); } else { throw (new NotImplementedException(String.Format("Invalid CType '{0}', {1}", LeftCType, LeftCType.GetType()))); } }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { var TrueType = TrueExpression.GetCachedCType(Resolver); var FalseType = FalseExpression.GetCachedCType(Resolver); if (TrueType == FalseType) { return(TrueType); } else { var TrueSize = TrueType.GetSize(null); var FalseSize = FalseType.GetSize(null); if (TrueSize > FalseSize) { return(TrueType); } if (FalseSize > TrueSize) { return(FalseType); } throw (new NotImplementedException()); } }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { var LeftCType = Left.GetCachedCType(Resolver); var RightCType = Right.GetCachedCType(Resolver); if (LeftCType == RightCType) { return(LeftCType); } else { var DoubleCType = new CSimpleType() { BasicType = CTypeBasic.Double }; //var FloatCType = new CSimpleType() { BasicType = CTypeBasic.Float }; if (CType.ContainsOne(LeftCType, RightCType, DoubleCType)) { return(DoubleCType); } //if (CType.ContainsOne(LeftCType, RightCType, FloatCType)) return FloatCType; if (LeftCType is CSimpleType && RightCType is CSimpleType) { var LeftSimpleCType = LeftCType as CSimpleType; var RightSimpleCType = RightCType as CSimpleType; var LeftSize = LeftSimpleCType.GetSize(null); var RightSize = RightSimpleCType.GetSize(null); if (LeftSize > RightSize) { return(LeftSimpleCType); } if (RightSize > LeftSize) { return(RightSimpleCType); } // Same type size but distinct! //if (WarningBinaryNoCast) if (false) { Console.Error.WriteLine("BinaryExpression.Type (II) : Left != Right : {0} != {1}", LeftCType, RightCType); } return(LeftSimpleCType); } if (LeftCType is CPointerType && RightCType is CSimpleType) { return(LeftCType); } if (LeftCType is CPointerType && RightCType is CPointerType) { return(LeftCType); } Console.Error.WriteLine("BinaryExpression.Type (I) : Left != Right : {0} != {1}", LeftCType, RightCType); return(LeftCType); } }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { return(Right.GetCachedCType(Resolver)); }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { return Expression.GetCachedCType(Resolver); }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { return(new CPointerType(Expression.GetCachedCType(Resolver))); }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { throw (new NotImplementedException()); //return new CPointerType(new CSimpleType() { BasicType = CTypeBasic.Char }); }
abstract protected CType __GetCType(IIdentifierTypeResolver Resolver);
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { return(Expressions.Last().GetCachedCType(Resolver)); }
protected override CType __GetCType(IIdentifierTypeResolver Resolver) { return(CType); }