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("}");
        }
Beispiel #4
0
 /// <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);
 }
Beispiel #5
0
 /// <summary>
 /// Performs some computation with the given metadata array creation expression.
 /// </summary>
 public virtual void Visit(IMetadataCreateArray createArray)
 {
 }
Beispiel #6
0
 public override void TraverseChildren(IMetadataCreateArray createArray)
 {
     //The type should already be filled in
 }
 public virtual void onMetadataElement(IMetadataCreateArray createArray) { }
Beispiel #8
0
 public virtual void Visit(IMetadataCreateArray createArray)
 {
     this.Visit(createArray.ElementType);
     this.Visit(createArray.Elements);
 }
Beispiel #9
0
 //^ 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>
 /// 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
 }
 /// <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;
 }
Beispiel #14
0
 public override void Visit(IMetadataCreateArray createArray)
 {
     allElements.Add(new InvokInfo(Traverser, "IMetadataCreateArray", createArray));
 }
Beispiel #15
0
 /// <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);
 }
Beispiel #16
0
 public void Visit(IMetadataCreateArray createArray)
 {
     this.traverser.Traverse(createArray);
 }
Beispiel #17
0
 public virtual void onMetadataElement(IMetadataCreateArray createArray)
 {
 }
        public override void TraverseChildren(IMetadataCreateArray createArray)
{ MethodEnter(createArray);
            base.TraverseChildren(createArray);
     MethodExit();   }
Beispiel #19
0
 public void Visit(IMetadataCreateArray createArray)
 {
     throw new NotImplementedException();
 }
Beispiel #20
0
 /// <summary>
 /// Performs some computation with the given metadata array creation expression.
 /// </summary>
 public void Visit(IMetadataCreateArray createArray)
 {
     this.Visit((IMetadataExpression)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("}");
        }
 public override void TraverseChildren(IMetadataCreateArray createArray) {
   base.TraverseChildren(createArray);
 }
Beispiel #23
0
 public virtual void Visit(IMetadataCreateArray createArray)
 {
     this.Visit(createArray.ElementType);
     this.Visit(createArray.Elements);
 }
Beispiel #24
0
 public override void TraverseChildren(IMetadataCreateArray createArray)
 {
     MethodEnter(createArray);
     base.TraverseChildren(createArray);
     MethodExit();
 }
 public override void Visit(IMetadataCreateArray createArray)
 {
     if(Process(createArray)){visitor.Visit(createArray);}
     base.Visit(createArray);
 }