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