public virtual void Visit(IMetadataTypeOf typeOf) { if (typeOf.TypeToGet != null) { this.Visit(typeOf.TypeToGet); } }
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)); }
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"); }
public override void Visit(IMetadataTypeOf typeOf) { if (Process(typeOf)) { visitor.Visit(typeOf); } base.Visit(typeOf); }
/// <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); }
public virtual void onMetadataElement(IMetadataTypeOf typeOf) { }
public void Visit(IMetadataTypeOf typeOf) { this.traverser.Traverse(typeOf); }
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; }
public override void Visit(IMetadataTypeOf typeOf) { this.value = this.loader.mapper.GetType(typeOf.TypeToGet); }
public override void Visit(IMetadataTypeOf typeOf) { allElements.Add(new InvokInfo(Traverser, "IMetadataTypeOf", typeOf)); }
/// <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); }
/// <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); }
//^ 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(); }
public override void TraverseChildren(IMetadataTypeOf typeOf) { MethodEnter(typeOf); base.TraverseChildren(typeOf); MethodExit(); }
/// <summary> /// Performs some computation with the given metadata typeof expression. /// </summary> public void Visit(IMetadataTypeOf typeOf) { this.Visit((IMetadataExpression)typeOf); }
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); }
/// <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); }