Ejemplo n.º 1
0
 public virtual void Visit(IMetadataTypeOf typeOf)
 {
     if (typeOf.TypeToGet != null)
     {
         this.Visit(typeOf.TypeToGet);
     }
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
        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");
        }
Ejemplo n.º 5
0
 public override void Visit(IMetadataTypeOf typeOf)
 {
     if (Process(typeOf))
     {
         visitor.Visit(typeOf);
     }
     base.Visit(typeOf);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Performs some computation with the given metadata typeof expression.
 /// </summary>
 public virtual void Visit(IMetadataTypeOf typeOf)
 {
 }
 public override void Visit(IMetadataTypeOf typeOf)
 {
     if(Process(typeOf)){visitor.Visit(typeOf);}
     base.Visit(typeOf);
 }
Ejemplo n.º 8
0
 public virtual void onMetadataElement(IMetadataTypeOf typeOf) { }
Ejemplo n.º 9
0
 public void Visit(IMetadataTypeOf typeOf)
 {
     this.traverser.Traverse(typeOf);
 }
 /// <summary>
 /// Performs some computation with the given metadata typeof expression.
 /// </summary>
 public virtual void Visit(IMetadataTypeOf typeOf)
 {
 }
Ejemplo n.º 11
0
 public override void TraverseChildren(IMetadataTypeOf typeOf) {
   //The type should already be filled in
 }
 /// <summary>
 /// Rewrites the given metadata typeof expression.
 /// </summary>
 public virtual IMetadataTypeOf Rewrite(IMetadataTypeOf metadataTypeOf)
 {
     return metadataTypeOf;
 }
Ejemplo n.º 13
0
 public override void Visit(IMetadataTypeOf typeOf) {
   this.value = this.loader.mapper.GetType(typeOf.TypeToGet);
 }
Ejemplo n.º 14
0
 public override void Visit(IMetadataTypeOf typeOf)
 {
     allElements.Add(new InvokInfo(Traverser, "IMetadataTypeOf", typeOf));
 }
Ejemplo n.º 15
0
 public override void TraverseChildren(IMetadataTypeOf typeOf)
 {
     //The type should already be filled in
 }
Ejemplo n.º 16
0
 /// <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);
 }
Ejemplo n.º 17
0
 /// <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);
 }
Ejemplo n.º 18
0
 public virtual void onMetadataElement(IMetadataTypeOf typeOf)
 {
 }
Ejemplo n.º 19
0
 //^ 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();
 }
Ejemplo n.º 20
0
        public override void TraverseChildren(IMetadataTypeOf typeOf)
{ MethodEnter(typeOf);
            base.TraverseChildren(typeOf);
     MethodExit();   }
Ejemplo n.º 21
0
 /// <summary>
 /// Performs some computation with the given metadata typeof expression.
 /// </summary>
 public void Visit(IMetadataTypeOf typeOf)
 {
     this.Visit((IMetadataExpression)typeOf);
 }
Ejemplo n.º 22
0
 public void Visit(IMetadataTypeOf typeOf)
 {
     throw new NotImplementedException();
 }
 public override void TraverseChildren(IMetadataTypeOf typeOf) {
   PrintToken(CSharpToken.TypeOf);
   PrintToken(CSharpToken.LeftParenthesis);
   this.PrintTypeReference(typeOf.TypeToGet);
   PrintToken(CSharpToken.RightParenthesis);
 }
Ejemplo n.º 24
0
 public virtual void Visit(IMetadataTypeOf typeOf)
 {
     if (typeOf.TypeToGet != null)
     {
         this.Visit(typeOf.TypeToGet);
     }
 }
Ejemplo n.º 25
0
 public override void TraverseChildren(IMetadataTypeOf typeOf)
 {
     MethodEnter(typeOf);
     base.TraverseChildren(typeOf);
     MethodExit();
 }
Ejemplo n.º 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);
 }