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(IMetadataCreateArray createArray) { if (Process(createArray)) { visitor.Visit(createArray); } base.Visit(createArray); }
private void WriteMetadataArray(IMetadataCreateArray array) { bool first = true; WriteKeyword("new"); WriteTypeName(array.Type, noSpace: true); WriteSymbol("{", addSpace: true); foreach (IMetadataExpression expr in array.Initializers) { if (first) { first = false; } else { WriteSymbol(",", true); } WriteMetadataExpression(expr); } WriteSymbol("}"); }
/// <summary> /// Traverses the metadata array creation expression. /// </summary> public void Traverse(IMetadataCreateArray createArray) { Contract.Requires(createArray != null); if (this.preorderVisitor != null) this.preorderVisitor.Visit(createArray); if (this.stopTraversal) return; this.TraverseChildren(createArray); if (this.stopTraversal) return; if (this.postorderVisitor != null) this.postorderVisitor.Visit(createArray); }
/// <summary> /// Performs some computation with the given metadata array creation expression. /// </summary> public virtual void Visit(IMetadataCreateArray createArray) { }
public override void TraverseChildren(IMetadataCreateArray createArray) { //The type should already be filled in }
public virtual void onMetadataElement(IMetadataCreateArray createArray) { }
public virtual void Visit(IMetadataCreateArray createArray) { this.Visit(createArray.ElementType); this.Visit(createArray.Elements); }
//^ ensures this.path.Count == old(this.path.Count); /// <summary> /// Performs some computation with the given metadata array creation expression. /// </summary> /// <param name="createArray"></param> public virtual void Visit(IMetadataCreateArray createArray) { if (this.stopTraversal) return; //^ int oldCount = this.path.Count; this.path.Push(createArray); this.Visit(createArray.ElementType); this.Visit(createArray.Initializers); //^ 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(); this.path.Pop(); }
/// <summary> /// Rewrites the given metadata array creation expression. /// </summary> public virtual IMetadataCreateArray Rewrite(IMetadataCreateArray metadataCreateArray) { return metadataCreateArray; }
public override void Visit(IMetadataCreateArray createArray) { object[] vector = new object[IteratorHelper.EnumerableCount(createArray.Initializers)]; int i = 0; foreach (var element in createArray.Initializers) { element.Dispatch(this); vector[i++] = this.value; } this.value = vector; }
public override void Visit(IMetadataCreateArray createArray) { allElements.Add(new InvokInfo(Traverser, "IMetadataCreateArray", createArray)); }
/// <summary> /// Traverses the children of the metadata array creation expression. /// </summary> public virtual void TraverseChildren(IMetadataCreateArray createArray) { Contract.Requires(createArray != null); this.TraverseChildren((IMetadataExpression)createArray); if (this.stopTraversal) return; this.Traverse(createArray.ElementType); if (this.stopTraversal) return; this.Traverse(createArray.Initializers); }
public void Visit(IMetadataCreateArray createArray) { this.traverser.Traverse(createArray); }
public override void TraverseChildren(IMetadataCreateArray createArray) { MethodEnter(createArray); base.TraverseChildren(createArray); MethodExit(); }
public void Visit(IMetadataCreateArray createArray) { throw new NotImplementedException(); }
/// <summary> /// Performs some computation with the given metadata array creation expression. /// </summary> public void Visit(IMetadataCreateArray createArray) { this.Visit((IMetadataExpression)createArray); }
public override void TraverseChildren(IMetadataCreateArray createArray) { base.TraverseChildren(createArray); }
public override void Visit(IMetadataCreateArray createArray) { if(Process(createArray)){visitor.Visit(createArray);} base.Visit(createArray); }