Beispiel #1
0
 public CDimensionCollection(IExpressionCollection c) : base(c.Count)
 {
     for (int i = 0, iM = c.Count; i < iM; i++)
     {
         this[i] = new CDimension();                       // 今のところは全て 0
     }
 }
Beispiel #2
0
 public override void TranslateExpressionGroup(IExpressionCollection expressions)
 {
     foreach (CodeExpression cexp in expressions.GenerateCodeDom(this.Options))
     {
         this.Provider.GenerateCodeFromExpression(cexp, base.Target, this.Options.Options);
     }
 }
Beispiel #3
0
 public void AddRange(IExpressionCollection expressions)
 {
     foreach (var item in expressions)
     {
         this.Add(item);
     }
 }
Beispiel #4
0
        public ISwitchStatementCase AddNew(bool lastIsDefaultCase, IExpressionCollection caseTargets)
        {
            ISwitchStatementCase @case = new SwitchStatementCase(this.sourceBlock, caseTargets, lastIsDefaultCase);

            this.baseList.Add(@case);
            return(@case);
        }
Beispiel #5
0
 /// <summary>
 /// Creates a new instnace of <see cref="ArrayIndexerExpression"/> with the
 /// <paramref name="target"/> and <parmaref name="indices"/> provided
 /// </summary>
 /// <param name="target">The array expression that needs accessed because it is an
 /// array.</param>
 /// <param name="indices">The Indices that are needed to access the member of the
 /// array.</param>
 public ArrayIndexerExpression(IExpression target, IExpressionCollection indices)
 {
     this.target = target;
     foreach (IExpression ie in indices)
     {
         this.Indices.Add(ie);
     }
 }
Beispiel #6
0
 public void AddRange <T>(IExpressionCollection <T> expressions)
     where T :
 IExpression
 {
     foreach (var item in expressions)
     {
         this.Add(item);
     }
 }
Beispiel #7
0
 public IndexerReferenceExpression(IMemberParentExpression reference, IExpressionCollection indices)
     : base(Resources.IndexerName, reference)
 {
     if (indices != null)
     {
         foreach (IExpression exp in indices)
         {
             this.Indices.Add(exp);
         }
     }
 }
Beispiel #8
0
 public SwitchStatementCase(IStatementBlock parentBlock, IExpressionCollection cases, bool lastIsDefault)
 {
     if (parentBlock == null)
     {
         throw new ArgumentNullException("parentBlock");
     }
     if (cases == null)
     {
         throw new ArgumentNullException("cases");
     }
     this.parentBlock   = parentBlock;
     this.lastIsDefault = lastIsDefault;
     foreach (IExpression expression in cases)
     {
         this.Cases.Add(expression);
     }
 }
Beispiel #9
0
        public IConstructorMember AddNew(IExpressionCollection cascadeMembers, ConstructorCascadeTarget cascadeExpressionsTarget, params TypedName[] parameters)
        {
            IConstructorMember result = new ConstructorMember(this.TargetDeclaration);

            foreach (TypedName param in parameters)
            {
                result.Parameters.AddNew(param);
            }
            if ((cascadeExpressionsTarget != ConstructorCascadeTarget.Undefined) && (cascadeMembers != null))
            {
                foreach (IExpression cascParam in cascadeMembers)
                {
                    result.CascadeMembers.Add(cascParam);
                }
            }
            result.CascadeExpressionsTarget = cascadeExpressionsTarget;
            this._Add(result.GetUniqueIdentifier(), result);
            return(result);
        }
Beispiel #10
0
        protected CreateArrayExpression(SerializationInfo info, StreamingContext context)
        {
            SerializationType method = (SerializationType)info.GetValue("SerializationMeans", typeof(SerializationType));
            bool sizeExp             = ((method & SerializationType.SizeExpression) == SerializationType.SizeExpression);
            bool sizePrim            = ((method & SerializationType.SizePrimitive) == SerializationType.SizePrimitive) && !sizeExp;
            bool initializers        = ((method & SerializationType.Initializers) == SerializationType.Initializers);

            if (sizeExp)
            {
                this.sizeExpression = _SerializationMethods.DeserializeExpression("SizeExpression", info);
            }
            else if (sizePrim)
            {
                this.size = info.GetInt32("Size");
            }
            if (initializers)
            {
                this.initializers = _SerializationMethods.DeserializeExpressionCollection("Initializers", info);
            }
            this.arrayType = _SerializationMethods.DeserializeTypeReference("ArrayType", info);
        }
            private void WriteExpressionList(IExpressionCollection expressions, IFormatter formatter)
            {
                // Indent++;
                for (int i = 0; i < expressions.Count; i++)
                {
                    if (i != 0)
                    {
                        formatter.Write(", ");
                    }

                    this.WriteExpression(expressions[i], formatter);
                }
                // Indent--;
            }
        public virtual IExpressionCollection TransformExpressionCollection(IExpressionCollection expressions)
        {
            IExpression[] array = new IExpression[expressions.Count];
            for (int i = 0; i < expressions.Count; i++)
            {
                array[i] = this.TransformExpression(expressions[i]);
            }

            IExpressionCollection target = new ExpressionCollection();
            target.AddRange(array);
            return target;
        }
Beispiel #13
0
 public MethodInvokeExpression(IMethodReferenceExpression reference, IExpressionCollection argumentExpressions)
 {
     this.reference           = reference;
     this.argumentExpressions = argumentExpressions;
 }
Beispiel #14
0
 public static bool Compare(this IExpressionCollection source, IExpressionCollection n, Func <IExpression, IExpression, bool> checkitem)
 {
     return(Compare <IExpression>(source, n, checkitem));
 }
        //============================================================
        //	初期化
        //============================================================
        public AttributeCollection(LanguageWriter writer, ICustomAttributeProvider provider, IType type)
        {
            this.writer   = writer;
            this.provider = provider;
            this.type     = type;

            // 属性の対象
            if (provider is IAssembly)
            {
                attr_class    = "assembly";
                isAsmOrModule = true;
            }
            else if (provider is IModule)
            {
                attr_class    = "module";
                isAsmOrModule = true;
            }
            else if (provider is IMethodReturnType)
            {
                attr_class = "returnvalue";
            }

            // 個々の属性に対して走査
            foreach (ICustomAttribute attr in provider.Attributes)
            {
                if (attr == null)
                {
                    continue;
                }

                string attrname = GetCustomAttributeName(attr);
                switch (attrname)
                {
                case "ParamArray":
                case "System::ParamArray":
                    containsParams = true;
                    continue;

                case "MarshalAs":
                case "System::Runtime::InteropServices::MarshalAs":
                    IExpressionCollection arguments = attr.Arguments;
                    if (arguments == null)
                    {
                        break;
                    }
                    IFieldReferenceExpression exp_fld = arguments[0] as IFieldReferenceExpression;
                    if (exp_fld == null)
                    {
                        break;
                    }
                    ITypeReferenceExpression target = exp_fld.Target as ITypeReferenceExpression;
                    if (target == null || target.Type.Name != "UnmanagedType")
                    {
                        break;
                    }
                    IFieldReference field = exp_fld.Field;
                    if (field.Name == "U1")
                    {
                        if (LanguageWriter.Type(type, "System", "Boolean"))
                        {
                            continue;
                        }
                    }
                    else if (field.Name == "U2" && LanguageWriter.Type(type, "System", "Char"))
                    {
                        continue;
                    }
                    break;
                }

                attrs.Add(new AttrPair(attrname, attr));
            }

            // 名前空間順に並び替え
            attrs.Sort(delegate(AttrPair l, AttrPair r){
                string l_name = ((ITypeReference)l.Value.Constructor.DeclaringType).Namespace;
                string r_name = ((ITypeReference)r.Value.Constructor.DeclaringType).Namespace;
                return(l_name.CompareTo(r_name));
            });
        }
 /// <summary>
 /// Obtains a <see cref="IConstructorInvokeExpression"/>
 /// by evaluating the <paramref name="parameters"/>
 /// provided.
 /// </summary>
 /// <param name="parameters">A series of
 /// <see cref="IExpression"/> elements
 /// which relate to the data of the
 /// parameters of the invoke, and the
 /// types of the parameters.</param>
 /// <returns>A new <see cref="IConstructorInvokeExpression"/>
 /// relative to the signature and data of
 /// the <paramref name="parameters"/>
 /// provided.</returns>
 public IConstructorInvokeExpression Invoke(IExpressionCollection parameters)
 {
     return(new ConstructorInvokeExpression(new ConstructorPointerReferenceExpression(this), parameters));
 }
Beispiel #17
0
 protected CreateNewObjectExpression(SerializationInfo info, StreamingContext context)
 {
     this.newType   = _SerializationMethods.DeserializeTypeReference("NewType", info);
     this.arguments = _SerializationMethods.DeserializeExpressionCollection("Arguments", info);
 }
Beispiel #18
0
 public CreateNewObjectExpression(ITypeReference newType, IEnumerable <IExpression> arguments)
 {
     this.newType   = newType;
     this.arguments = new ExpressionCollection(arguments);
 }
Beispiel #19
0
 public CreateNewObjectExpression(ITypeReference newType, IExpressionCollection arguments)
     : this(newType, (IEnumerable <IExpression>)(arguments))
 {
 }
Beispiel #20
0
 /// <summary>
 /// Obtains a <see cref="IConstructorInvokeExpression"/>
 /// by evaluating the <paramref name="parameters"/>
 /// provided.
 /// </summary>
 /// <param name="parameters">A series of
 /// <see cref="IExpression"/> elements
 /// which relate to the data of the
 /// parameters of the invoke, and the
 /// types of the parameters.</param>
 /// <returns>A new <see cref="IConstructorInvokeExpression"/>
 /// relative to the signature and data of
 /// the <paramref name="parameters"/>
 /// provided.</returns>
 public IConstructorInvokeExpression Invoke(IExpressionCollection parameters)
 {
     return(new ConstructorInvokeExpression(this, parameters));
 }
Beispiel #21
0
 public static bool Compare(this IExpressionCollection source, IExpressionCollection n, Func <IExpression, IExpression, Action <string, string>, bool> checkitem, Action <string, string> errAct)
 {
     return(Compare <IExpression>(source, n, checkitem, errAct));
 }
Beispiel #22
0
 public CreateArrayExpression(ITypeReference arrayType, IExpression[] initializers)
 {
     this.initializers = new ExpressionCollection(initializers);
     this.ArrayType    = arrayType;
 }
 /// <summary>
 /// Creates a new <see cref="MethodInvokeExpression{TSignatureParameter, TSignature, TParent}"/> with
 /// the <paramref name="parameters"/>, and <paramref name="reference"/>
 /// provided.
 /// </summary>
 /// <param name="reference">A <see cref="IMethodReferenceStub"/>
 /// which created the <see cref="MethodInvokeExpression{TSignatureParameter, TSignature, TParent}"/> and designates
 /// the method target whose signature is inferred by the framework
 /// if needed.</param>
 /// <param name="parameters">The series of <see cref="IExpression"/>
 /// elements which relate to the values to send
 /// the method when calling it.</param>
 /// <exception cref="System.ArgumentNullException">thrown when <paramref name="reference"/>
 /// or <paramref name="parameters"/> is null.</exception>
 public MethodInvokeExpression(IMethodReferenceStub <TSignatureParameter, TSignature, TParent> reference, IExpressionCollection <IExpression> parameters)
     : base(reference, parameters)
 {
 }
 public virtual void VisitExpressionCollection(IExpressionCollection value)
 {
     for (int i = 0; i < value.Count; i++)
     {
         this.VisitExpression(value[i]);
     }
 }
 public CreateInstanceExpression(IConstructorPointerReferenceExpression reference, IExpressionCollection parameters)
     : base(reference, parameters)
 {
 }
 /// <summary>
 /// Obtains a <see cref="IMethodInvokeExpression"/>
 /// by evaluating the <paramref name="parameters"/>
 /// provided.
 /// </summary>
 /// <param name="parameters">A series of
 /// <see cref="IExpression"/> elements
 /// which relate to the data of the
 /// parameters of the invoke, and the
 /// types of the parameters.</param>
 /// <returns>A new <see cref="IMethodInvokeExpression"/>
 /// relative to the signature and data of
 /// the <paramref name="parameters"/>
 /// provided.</returns>
 public IMethodInvokeExpression Invoke(IExpressionCollection <IExpression> parameters)
 {
     return(GetPointerReference().Invoke(parameters));
 }
Beispiel #27
0
 public static bool Compare(this IExpressionCollection source, IExpressionCollection n)
 {
     return(Compare <IExpression>(source, n));
 }
Beispiel #28
0
 public abstract void TranslateExpressionGroup(IExpressionCollection expressions);
Beispiel #29
0
 public static bool Compare(this IExpressionCollection source, IExpressionCollection n)
 {
     return Compare<IExpression>(source,n);
 }
 public ConstructorInvokeExpression(IConstructorPointerReferenceExpression reference, IExpressionCollection parameters)
     : this(reference)
 {
     this.Arguments.AddRange(parameters);
 }
Beispiel #31
0
 public static bool Compare(this IExpressionCollection source, IExpressionCollection n, Func<IExpression, IExpression, bool> checkitem)
 {
     return Compare<IExpression>(source,n,checkitem);
 }
Beispiel #32
0
 internal static void SerializeExpressionCollection(string baseName, SerializationInfo info, IExpressionCollection collection)
 {
     if (collection == null)
     {
         info.AddValue(baseName, -1);
         return;
     }
     info.AddValue(baseName, collection.Count);
     for (int i = 0; i < collection.Count; i++)
     {
         string itemBaseName = string.Format("{0}.[{1}]", baseName, i);
         SerializeExpression(itemBaseName, info, collection[i]);
     }
 }
Beispiel #33
0
 public static bool Compare(this IExpressionCollection source, IExpressionCollection n, Func<IExpression, IExpression, Action<string, string>, bool> checkitem, Action<string, string> errAct)
 {
     return Compare<IExpression>(source,n,checkitem,errAct);
 }
        internal static CreateInstanceExpression GetByExpressionCollection <T>(IConstructorPointerReferenceExpression reference, IExpressionCollection <T> parameters)
            where T :
        IExpression
        {
            var result = new CreateInstanceExpression(reference);

            result.Arguments.AddRange(parameters);
            return(result);
        }
Beispiel #35
0
 protected ArrayIndexerExpression(SerializationInfo info, StreamingContext context)
 {
     this.target  = _SerializationMethods.DeserializeExpression("Target", info);
     this.indices = _SerializationMethods.DeserializeExpressionCollection("Indices", info);
 }
Beispiel #36
0
 public ICreateNewObjectExpression GetNewExpression(IExpressionCollection arguments)
 {
     return(new CreateNewObjectExpression(this, arguments));
 }
 private void InsituTransformExpressionCollection(IExpressionCollection value)
 {
     for (int i = 0; i < value.Count; i++)
     {
         value[i] = this.TransformExpression(value[i]);
     }
 }