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


C# Compiler.TypeNode类代码示例

本文整理汇总了C#中System.Compiler.TypeNode的典型用法代码示例。如果您正苦于以下问题:C# TypeNode类的具体用法?C# TypeNode怎么用?C# TypeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypeNode类属于System.Compiler命名空间,在下文中一共展示了TypeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InferTypeOfBinaryExpression

        public override TypeNode InferTypeOfBinaryExpression(TypeNode t1, TypeNode t2, BinaryExpression binaryExpression)
        {
            //
            // For addition or subtraction operations involving a set (as either operand)
            // the result will be a set of the same type. Later, in the Checker, we'll
            // verify that the combination of operands is valid. Here, we can quickly infer
            // the type of the result.
            //
            switch (binaryExpression.NodeType)
            {
                case NodeType.Add:
                case NodeType.Sub:
                    if (t1 is Set)
                        return t1;
                    else if (t2 is Set)
                        return t2;
                    break;

                case (NodeType)ZingNodeType.In:
                    return SystemTypes.Boolean;

                default:
                    break;
            }
            return base.InferTypeOfBinaryExpression(t1, t2, binaryExpression);
        }
开发者ID:ZingModelChecker,项目名称:Zing,代码行数:26,代码来源:ZResolver.cs

示例2: IsExposedType

        /**
         * <summary>IsExposedType compares the given type to itself. If this filter
         * contains a '.' designating it as for a nested class it will skip
         * non-nested classes. Classes with no declaring types will not be compared to 
         * filters with a '.'
         * </summary>
         */
        public bool? IsExposedType(TypeNode type)
        {
            bool? typeIsExposed = null;

            //check if the type was nested
            if (type.DeclaringType == null)
            {
                if (type.Name.Name == name)
                    typeIsExposed = exposed;
            }
                //if we are nested then check if this filter is for a nested class
                //check that nothing used is null also. 
                //if the name attribute is not there in the config name can be null here.
            else if (name != null && name.Contains("."))
            {
                //Get a stack of declaring type names
                Stack < string > parentNames = new Stack < string >();
                parentNames.Push(type.Name.Name); //start with this one

                TypeNode parent = type.DeclaringType;
                while (parent != null)
                {
                    parentNames.Push(parent.Name.Name);
                    parent = parent.DeclaringType;
                }

                //put them back in the correct order and check the name
                if (name.Equals(String.Join(".", parentNames.ToArray())))
                    typeIsExposed = exposed;
            }

            return typeIsExposed;
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:40,代码来源:TypeFilter.cs

示例3: CollectOldExpressions

 public CollectOldExpressions(Module module, Method method, ContractNodes contractNodes, Dictionary<TypeNode, Local> closureLocals, 
     int localCounterStart, Class initialClosureClass)
     : this(module, method, contractNodes, closureLocals, localCounterStart)
 {
     this.topLevelClosureClass = initialClosureClass;
     this.currentClosureClass = initialClosureClass;
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:CollectOldExpressions.cs

示例4: CurrentState

 private CurrentState(TypeNode type, Dictionary<string, object> typeSuppressed, Method method)
 {
     this.Type = type;
     this.typeSuppressed = typeSuppressed;
     this.Method = method;
     this.methodSuppressed = null;
 }
开发者ID:Yatajga,项目名称:CodeContracts,代码行数:7,代码来源:Rewriter.cs

示例5: GetTypeName

 public override string GetTypeName(TypeNode type) {
     using (TextWriter writer = new StringWriter()) {
         writer.Write("T:");
         WriteType(type, writer);
         return (writer.ToString());
     }
 }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:7,代码来源:OrcasNamer.cs

示例6: GetNamespace

 public static Namespace GetNamespace(TypeNode type) {
     if (type.DeclaringType != null) {
         return (GetNamespace(type.DeclaringType));
     } else {
         return (new Namespace(type.Namespace));
     }
 }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:7,代码来源:Reflection.cs

示例7: HandlersMatching

    /// <summary>
    /// Returns a list of CfgBlock that are handlers of the current block, handling an exception
    /// of the given type, or a subtype thereof.
    /// </summary>
    /// <param name="exception">Type of exception thrown. It is assumed that any actual subtype could be thrown</param>
    /// <returns>All handlers that could apply directly to this exception.
    ///  In addition, if the method might not handle it, then the ExceptionExit block is
    /// part of this list.</returns>
    public System.Collections.IEnumerable/*CfgBlock*/ HandlersMatching(TypeNode exception) {
      ArrayList handlers = new ArrayList();

      CfgBlock currentBlock = this;

      while (currentBlock != null) {
        CfgBlock handler = this.cfg.ExceptionHandler(currentBlock);

        if (handler == null || handler.Statements == null || handler.Statements.Count < 1) break;

        Catch stat = handler.Statements[0] as Catch;

        if (stat != null) {
          if (exception.IsAssignableTo(stat.Type)) {
            // handles exceptions completely
            handlers.Add(handler);
            break;
          }
          if (stat.Type.IsAssignableTo(exception)) {
            // handles part of it
            handlers.Add(handler);
          }
          currentBlock = handler;
        }
        else {
          // must be the Unwind block
          handlers.Add(handler);
          break;
        }
      }
      return handlers;
    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:40,代码来源:ControlFlow.cs

示例8: ImplicitCoercionFromTo

        //
        // We add an implicit conversion from "object" to any of our heap-allocated
        // types.
        //
        // We also permit implicit conversions between "int" and "byte".
        //
        // TODO: We may need to construct a more elaborate expression here for the
        // conversion to permit the runtime to make the appropriate checks.
        //
        public override bool ImplicitCoercionFromTo(Expression source, TypeNode t1, TypeNode t2)
        {
            if (t1 == SystemTypes.Object)
            {
                if (t2 is Chan || t2 is Set || t2 is ZArray || t2 is Class)
                    return true;
                else
                    return false;
            }

            if (t2 == SystemTypes.Object)
            {
                if (t1 is Chan || t1 is Set || t1 is ZArray || t1 is Class)
                    return true;
                else
                    return false;
            }

            if (t1 == SystemTypes.Int32 && t2 == SystemTypes.UInt8)
                return true;

            if (t1 == SystemTypes.UInt8 && t2 == SystemTypes.Int32)
                return true;

            return base.ImplicitCoercionFromTo(source, t1, t2);
        }
开发者ID:ZingModelChecker,项目名称:Zing,代码行数:35,代码来源:TypeSystem.cs

示例9: CoerceAnonymousNestedFunction

 public override Expression CoerceAnonymousNestedFunction(AnonymousNestedFunction func, TypeNode targetType, bool explicitCoercion, TypeViewer typeViewer) {
   if (func is AnonymousNestedDelegate && !(targetType is DelegateNode)) {
     this.HandleError(func, Error.AnonMethToNonDel, this.GetTypeName(targetType));
     return null;
   }
   return base.CoerceAnonymousNestedFunction(func, targetType, explicitCoercion, typeViewer);
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:7,代码来源:TypeSystem.cs

示例10: Duplicator

 /// <param name="module">The module into which the duplicate IR will be grafted.</param>
 /// <param name="type">The type into which the duplicate Member will be grafted. Ignored if entire type, or larger unit is duplicated.</param>
 public Duplicator(Module/*!*/ module, TypeNode type)
 {
     this.TargetModule = module;
     this.TargetType = this.OriginalTargetType = type;
     this.DuplicateFor = new TrivialHashtable();
     this.TypesToBeDuplicated = new TrivialHashtable();
     //^ base();
 }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:10,代码来源:Duplicator.cs

示例11: GetTypeName

        /// <inheritdoc />
        public override string GetTypeName(TypeNode type)
        {
            StringBuilder sb = new StringBuilder("T:");

            WriteType(type, sb);

            return sb.ToString();
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:9,代码来源:OrcasNamer.cs

示例12: VisitTypeNode

        public override void VisitTypeNode(TypeNode typeNode)
        {
            if (typeNode == null) return;

            ScrubAttributeList(typeNode.Attributes);

            this.VisitMemberList(typeNode.Members);
        }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:8,代码来源:RemoveContractClasses.cs

示例13: HasExposedMembers

        //Find out if any are exposed incase this class is not exposed
        public bool HasExposedMembers(TypeNode type)
        {
            foreach (Member member in type.Members)
                foreach (MemberFilter memberFilter in memberFilters)
                    if (memberFilter.IsExposedMember(member) == true)
                        return true;

            return false;
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:10,代码来源:TypeFilter.cs

示例14: IsRuntimeIgnored

        public static bool IsRuntimeIgnored(Node node, ContractNodes contractNodes, TypeNode referencingType, bool skipQuantifiers)
        {
            CodeInspector ifrv = new CodeInspector(
                ContractNodes.RuntimeIgnoredAttributeName, contractNodes, referencingType, skipQuantifiers);
            
            ifrv.Visit(node);

            return ifrv.foundAttribute;
        }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:9,代码来源:CodeInspector.cs

示例15: ScrubContractClass

        public ScrubContractClass(ExtractorVisitor parent, Class contractClass, TypeNode originalType)
        {
            Contract.Requires(TypeNode.IsCompleteTemplate(contractClass));
            Contract.Requires(TypeNode.IsCompleteTemplate(originalType));

            this.parent = parent;
            this.contractClass = contractClass;
            this.abstractClass = originalType;
        }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:9,代码来源:ScrubContractClass.cs


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