コード例 #1
0
 public virtual void Visit(IMetadataTypeOf typeOf)
 {
     if (typeOf.TypeToGet != null)
     {
         this.Visit(typeOf.TypeToGet);
     }
 }
コード例 #2
0
        public bool Include(ICustomAttribute attribute)
        {
            string typeId       = attribute.DocId();
            string removeUsages = "RemoveUsages:" + typeId;

            // special case: attribute usage can be removed without removing
            //               the attribute itself
            if (_docIds.Contains(removeUsages))
            {
                return(false);
            }

            if (_excludeMembers)
            {
                foreach (var argument in attribute.Arguments)
                {
                    // if the argument is an excluded type
                    if (!IncludeTypeReference(argument.Type))
                    {
                        return(false);
                    }

                    // if the argument is typeof of an excluded type
                    IMetadataTypeOf typeOf = argument as IMetadataTypeOf;
                    if (typeOf != null && !IncludeTypeReference(typeOf.TypeToGet))
                    {
                        return(false);
                    }
                }
            }

            // include so long as it isn't in the exclude list.
            return(!_docIds.Contains(typeId));
        }
コード例 #3
0
        public static ITypeDefinition /*?*/ GetTypeDefinitionFromAttribute(IEnumerable <ICustomAttribute> attributes, string attributeName)
        {
            ICustomAttribute foundAttribute = null;

            foreach (ICustomAttribute attribute in attributes)
            {
                if (TypeHelper.GetTypeName(attribute.Type) == attributeName)
                {
                    foundAttribute = attribute;
                    break;
                }
            }
            if (foundAttribute == null)
            {
                return(null);
            }
            List <IMetadataExpression> args = new List <IMetadataExpression>(foundAttribute.Arguments);

            if (args.Count < 1)
            {
                return(null);
            }
            IMetadataTypeOf abstractTypeMD = args[0] as IMetadataTypeOf;

            if (abstractTypeMD == null)
            {
                return(null);
            }
            ITypeReference  referencedTypeReference  = Microsoft.Cci.MutableContracts.ContractHelper.Unspecialized(abstractTypeMD.TypeToGet);
            ITypeDefinition referencedTypeDefinition = referencedTypeReference.ResolvedType;

            return(referencedTypeDefinition);
        }
コード例 #4
0
        private void WriteMetadataExpression(IMetadataExpression expression)
        {
            IMetadataConstant constant = expression as IMetadataConstant;

            if (constant != null)
            {
                WriteMetadataConstant(constant);
                return;
            }

            IMetadataCreateArray array = expression as IMetadataCreateArray;

            if (array != null)
            {
                WriteMetadataArray(array);
                return;
            }

            IMetadataTypeOf type = expression as IMetadataTypeOf;

            if (type != null)
            {
                WriteKeyword("typeof", noSpace: true);
                WriteSymbol("(");
                WriteTypeName(type.TypeToGet, noSpace: true);
                WriteSymbol(")");
                return;
            }

            throw new NotSupportedException("IMetadataExpression type not supported");
        }
コード例 #5
0
 public override void Visit(IMetadataTypeOf typeOf)
 {
     if (Process(typeOf))
     {
         visitor.Visit(typeOf);
     }
     base.Visit(typeOf);
 }
コード例 #6
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 /// <summary>
 /// Performs some computation with the given metadata typeof expression.
 /// </summary>
 public virtual void Visit(IMetadataTypeOf typeOf)
 {
 }
コード例 #7
0
 public override void Visit(IMetadataTypeOf typeOf)
 {
     if(Process(typeOf)){visitor.Visit(typeOf);}
     base.Visit(typeOf);
 }
コード例 #8
0
 public virtual void onMetadataElement(IMetadataTypeOf typeOf) { }
コード例 #9
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 public void Visit(IMetadataTypeOf typeOf)
 {
     this.traverser.Traverse(typeOf);
 }
コード例 #10
0
 /// <summary>
 /// Performs some computation with the given metadata typeof expression.
 /// </summary>
 public virtual void Visit(IMetadataTypeOf typeOf)
 {
 }
コード例 #11
0
 public override void TraverseChildren(IMetadataTypeOf typeOf) {
   //The type should already be filled in
 }
コード例 #12
0
 /// <summary>
 /// Rewrites the given metadata typeof expression.
 /// </summary>
 public virtual IMetadataTypeOf Rewrite(IMetadataTypeOf metadataTypeOf)
 {
     return metadataTypeOf;
 }
コード例 #13
0
 public override void Visit(IMetadataTypeOf typeOf) {
   this.value = this.loader.mapper.GetType(typeOf.TypeToGet);
 }
コード例 #14
0
 public override void Visit(IMetadataTypeOf typeOf)
 {
     allElements.Add(new InvokInfo(Traverser, "IMetadataTypeOf", typeOf));
 }
コード例 #15
0
ファイル: TypeInferencer.cs プロジェクト: xornand/cci
 public override void TraverseChildren(IMetadataTypeOf typeOf)
 {
     //The type should already be filled in
 }
コード例 #16
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 /// <summary>
 /// Traverses the metadata typeof expression.
 /// </summary>
 public void Traverse(IMetadataTypeOf typeOf)
 {
     Contract.Requires(typeOf != null);
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(typeOf);
       if (this.stopTraversal) return;
       this.TraverseChildren(typeOf);
       if (this.stopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(typeOf);
 }
コード例 #17
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 /// <summary>
 /// Traverses the children of the metadata typeof expression.
 /// </summary>
 public virtual void TraverseChildren(IMetadataTypeOf typeOf)
 {
     Contract.Requires(typeOf != null);
       this.TraverseChildren((IMetadataExpression)typeOf);
       if (this.stopTraversal) return;
       this.Traverse(typeOf.TypeToGet);
 }
コード例 #18
0
 public virtual void onMetadataElement(IMetadataTypeOf typeOf)
 {
 }
コード例 #19
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Performs some computation with the given metadata typeof expression.
 /// </summary>
 /// <param name="typeOf"></param>
 public virtual void Visit(IMetadataTypeOf typeOf)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(typeOf);
       this.Visit(typeOf.TypeToGet);
       //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not to decrease this.path.Count.
       this.path.Pop();
 }
コード例 #20
0
        public override void TraverseChildren(IMetadataTypeOf typeOf)
{ MethodEnter(typeOf);
            base.TraverseChildren(typeOf);
     MethodExit();   }
コード例 #21
0
ファイル: Validator.cs プロジェクト: rasiths/visual-profiler
 /// <summary>
 /// Performs some computation with the given metadata typeof expression.
 /// </summary>
 public void Visit(IMetadataTypeOf typeOf)
 {
     this.Visit((IMetadataExpression)typeOf);
 }
コード例 #22
0
ファイル: Visitors.cs プロジェクト: Refresh06/visualmutator
 public void Visit(IMetadataTypeOf typeOf)
 {
     throw new NotImplementedException();
 }
コード例 #23
0
 public override void TraverseChildren(IMetadataTypeOf typeOf) {
   PrintToken(CSharpToken.TypeOf);
   PrintToken(CSharpToken.LeftParenthesis);
   this.PrintTypeReference(typeOf.TypeToGet);
   PrintToken(CSharpToken.RightParenthesis);
 }
コード例 #24
0
ファイル: MetadataVisitor.cs プロジェクト: elemk0vv/roslyn-1
 public virtual void Visit(IMetadataTypeOf typeOf)
 {
     if (typeOf.TypeToGet != null)
     {
         this.Visit(typeOf.TypeToGet);
     }
 }
コード例 #25
0
 public override void TraverseChildren(IMetadataTypeOf typeOf)
 {
     MethodEnter(typeOf);
     base.TraverseChildren(typeOf);
     MethodExit();
 }
コード例 #26
0
 /// <summary>
 /// Traverses the children of the metadata typeof expression.
 /// </summary>
 public virtual void TraverseChildren(IMetadataTypeOf typeOf)
 {
     this.TraverseChildren((IMetadataExpression)typeOf);
       if (this.stopTraversal) return;
       this.Traverse(typeOf.TypeToGet);
 }