本文整理汇总了C#中Type.Desugar方法的典型用法代码示例。如果您正苦于以下问题:C# Type.Desugar方法的具体用法?C# Type.Desugar怎么用?C# Type.Desugar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type.Desugar方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintExpression
private bool? PrintExpression(Type type, Expression expression, ref string result)
{
var desugared = type.Desugar();
// constants are obtained through dynamic calls at present so they are not compile-time values in target languages
if (expression.Declaration is Variable ||
(!Options.MarshalCharAsManagedChar &&
desugared.IsPrimitiveType(PrimitiveType.UChar)) ||
type.IsPrimitiveTypeConvertibleToRef())
return null;
if (CheckForDefaultPointer(desugared, ref result))
return true;
if (expression.Class == StatementClass.Call)
{
if (expression.Declaration.Ignore)
{
result = null;
return false;
}
return null;
}
var defaultConstruct = CheckForDefaultConstruct(desugared, expression, ref result);
if (defaultConstruct != false)
return defaultConstruct;
return CheckForSimpleExpressions(expression, ref result, desugared);
}
示例2: GetEnumType
private static Type GetEnumType(Type mappedType)
{
var type = mappedType.Desugar();
ClassTemplateSpecialization classTemplateSpecialization;
var templateSpecializationType = type as TemplateSpecializationType;
if (templateSpecializationType != null)
classTemplateSpecialization = templateSpecializationType.GetClassTemplateSpecialization();
else
classTemplateSpecialization = (ClassTemplateSpecialization) ((TagType) type).Declaration;
return classTemplateSpecialization.Arguments[0].Type.Type;
}
示例3: PrintExpression
private bool? PrintExpression(Type type, Expression expression, ref string result)
{
var desugared = type.Desugar();
if ((!Driver.Options.MarshalCharAsManagedChar &&
desugared.IsPrimitiveType(PrimitiveType.UChar)) ||
type.IsPrimitiveTypeConvertibleToRef())
return null;
if (CheckForDefaultPointer(desugared, ref result))
return true;
if (expression.Class == StatementClass.Call)
return expression.Declaration.Ignore ? false : (bool?) null;
var defaultConstruct = CheckForDefaultConstruct(desugared, expression, ref result);
if (defaultConstruct != false)
return defaultConstruct;
return CheckForSimpleExpressions(expression, ref result, desugared);
}
示例4: IsTypeComplete
private static bool IsTypeComplete(Type type)
{
var desugared = type.Desugar();
var finalType = (desugared.GetFinalPointee() ?? desugared).Desugar();
var templateSpecializationType = finalType as TemplateSpecializationType;
if (templateSpecializationType != null)
finalType = templateSpecializationType.Desugared;
Declaration decl;
if (!finalType.TryGetDeclaration(out decl)) return true;
return !decl.IsIncomplete;
}
示例5: GetBasicString
private static ClassTemplateSpecialization GetBasicString(Type type)
{
var desugared = type.Desugar();
var template = (desugared.GetFinalPointee() ?? desugared).Desugar();
var templateSpecializationType = template as TemplateSpecializationType;
if (templateSpecializationType != null)
return templateSpecializationType.GetClassTemplateSpecialization();
return (ClassTemplateSpecialization) ((TagType) template).Declaration;
}
示例6: PrintExpression
private bool? PrintExpression(Type type, Expression expression, ref string result)
{
var desugared = type.Desugar();
if ((!Driver.Options.MarshalCharAsManagedChar &&
desugared.IsPrimitiveType(PrimitiveType.UChar)) ||
type.IsPrimitiveTypeConvertibleToRef())
return null;
if (CheckForDefaultPointer(desugared, ref result))
return true;
var defaultConstruct = CheckForDefaultConstruct(desugared, expression, ref result);
if (defaultConstruct != false)
return defaultConstruct;
return CheckFloatSyntax(desugared, expression, ref result) ||
CheckForBinaryOperator(desugared, expression, ref result) ||
CheckForEnumValue(desugared, expression, ref result) ||
CheckForDefaultEmptyChar(desugared, expression, ref result);
}
示例7: IsTypeComplete
private bool IsTypeComplete(Type type)
{
TypeMap typeMap;
if (TypeMaps.FindTypeMap(type, out typeMap) && !typeMap.IsIgnored)
return true;
var desugared = type.Desugar();
var finalType = (desugared.GetFinalPointee() ?? desugared).Desugar();
var templateSpecializationType = finalType as TemplateSpecializationType;
if (templateSpecializationType != null)
finalType = templateSpecializationType.Desugared.Type;
Declaration decl;
if (!finalType.TryGetDeclaration(out decl)) return true;
return !decl.IsIncomplete;
}