当前位置: 首页>>代码示例>>C#>>正文


C# Type.Desugar方法代码示例

本文整理汇总了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);
        }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:30,代码来源:HandleDefaultParamValuesPass.cs

示例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;
 }
开发者ID:grbd,项目名称:QtSharp,代码行数:11,代码来源:QFlags.cs

示例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);
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:21,代码来源:HandleDefaultParamValuesPass.cs

示例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;
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:13,代码来源:CheckIgnoredDecls.cs

示例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;
 }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:9,代码来源:Stdlib.cs

示例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);
        }
开发者ID:farawayzheng,项目名称:CppSharp,代码行数:21,代码来源:HandleDefaultParamValuesPass.cs

示例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;
        }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:17,代码来源:CheckIgnoredDecls.cs


注:本文中的Type.Desugar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。