private bool HandleDynamic(CodeIndexerExpression obj, Context ctx)
        {
            CodeArrayIndexerExpression equivalent = new CodeArrayIndexerExpression(obj.TargetObject);

            equivalent.Indices.AddRange(obj.Indices);
            return(ctx.HandlerProvider.ExpressionHandler.Handle(equivalent, ctx));
        }
Esempio n. 2
0
        private void GenerateObjectCollection(CodeTypeDeclaration rootClass,
                                              JsonObjectCollection jsonObject)
        {
            // find default constructor
            CodeConstructor ctor = null;

            foreach (CodeTypeMember m in rootClass.Members)
            {
                CodeConstructor c = m as CodeConstructor;

                if (c != null)
                {
                    if (c.Parameters.Count == 0)
                    {
                        ctor = c;
                        break;
                    }
                }
            }

            if (ctor == null)
            {
                throw new Exception("Cannot find default constructor");
            }

            // enumerate nested data fields
            foreach (JsonObject obj in jsonObject)
            {
                // generate property
                CodeMemberProperty prop = new CodeMemberProperty();
                prop.Name       = obj.Name;
                prop.Attributes = MemberAttributes.Public;
                PropertyInfo valueInfo = obj.GetType().GetProperty("Value");
                if (valueInfo == null)
                {
                    throw new GeneratorException("Cannot generate nested arrays or objects. Wait for release :)");
                }

                prop.Type = new CodeTypeReference(valueInfo.PropertyType);
                CodeExpression rootItem       = new CodeArrayIndexerExpression(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "RootObject"), new CodePrimitiveExpression(obj.Name));
                CodeExpression castedRootItem = new CodeCastExpression(obj.GetType(), rootItem);
                CodeExpression rootItemValue  = new CodeFieldReferenceExpression(castedRootItem, "Value");
                prop.GetStatements.Add(new CodeMethodReturnStatement(rootItemValue));
                prop.SetStatements.Add(new CodeAssignStatement(rootItemValue, new CodePropertySetValueReferenceExpression()));
                rootClass.Members.Add(prop);


                // generate constructor's part
                CodeVariableDeclarationStatement createVar = new CodeVariableDeclarationStatement(obj.GetType(), obj.Name.ToLower(),
                                                                                                  new CodeObjectCreateExpression(obj.GetType(), new CodePrimitiveExpression(obj.Name)));
                //CodeAssignStatement assignVar = new CodeAssignStatement(codevariable
                ctor.Statements.Add(createVar);

                CodeMethodInvokeExpression invokeAdd = new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "RootObject"), "Add"),
                                                                                      new CodeVariableReferenceExpression(obj.Name.ToLower()));
                ctor.Statements.Add(invokeAdd);
                //JsonStringValue name = new JsonStringValue("Name");
                //RootObject.Add(name);
            }
        }
Esempio n. 3
0
 protected override void GenerateArrayIndexerExpression(CodeArrayIndexerExpression expression)
 {
     GenerateExpression(expression.TargetObject);
     Output.Write('[');
     OutputExpressionList(expression.Indices);
     Output.Write(']');
 }
        /// <summary>
        /// Constructs a single property in the template.
        /// </summary>
        private void CreateProperty(CodeTypeDeclaration ctd,
                                    string propertyName, string contextName, string typeName)
        {
            // Create the property
            CodeMemberProperty property = new CodeMemberProperty();

            property.Name       = propertyName;
            property.Type       = new CodeTypeReference(typeName);
            property.Attributes = MemberAttributes.Public;
            ctd.Members.Add(property);

            // Context variables
            CodeVariableReferenceExpression context =
                new CodeVariableReferenceExpression("Context");
            CodePrimitiveExpression contextEx =
                new CodePrimitiveExpression(contextName);
            CodeArrayIndexerExpression atContext =
                new CodeArrayIndexerExpression(context, contextEx);

            // Create the getter
            CodeCastExpression getCast =
                new CodeCastExpression(typeName, atContext);
            CodeMethodReturnStatement getReturn =
                new CodeMethodReturnStatement(getCast);

            property.GetStatements.Add(getReturn);

            // Create the setter
            CodeVariableReferenceExpression valueExpression =
                new CodeVariableReferenceExpression("value");
            CodeAssignStatement set =
                new CodeAssignStatement(atContext, valueExpression);

            property.SetStatements.Add(set);
        }
        public bool ValidateCodeArrayIndexerExpression(CodeArrayIndexerExpression exp)
        {
            bool result = true;

            PushLocation(exp);

            if (exp.Indices != null && exp.Indices.Count > 0)
            {
                if (exp.Indices.Count > 1)
                {
                    PushError("Can only have one index.");
                    result = false;
                }
                else
                {
                    if (!IsSimpleTarget(exp.Indices[0]))
                    {
                        result = false;
                    }
                }
            }

            if (!IsSimpleTarget(exp.TargetObject))
            {
                result = false;
            }

            PopLocation();
            return(result);
        }
        internal override void Decompile(CodeExpression expression, StringBuilder stringBuilder, CodeExpression parentExpression)
        {
            CodeArrayIndexerExpression expression2  = (CodeArrayIndexerExpression)expression;
            CodeExpression             targetObject = expression2.TargetObject;

            if (targetObject == null)
            {
                RuleEvaluationException exception = new RuleEvaluationException(string.Format(CultureInfo.CurrentCulture, Messages.NullIndexerTarget, new object[0]));
                exception.Data["ErrorObject"] = expression2;
                throw exception;
            }
            if ((expression2.Indices == null) || (expression2.Indices.Count == 0))
            {
                RuleEvaluationException exception2 = new RuleEvaluationException(string.Format(CultureInfo.CurrentCulture, Messages.MissingIndexExpressions, new object[0]));
                exception2.Data["ErrorObject"] = expression2;
                throw exception2;
            }
            RuleExpressionWalker.Decompile(stringBuilder, targetObject, expression2);
            stringBuilder.Append('[');
            RuleExpressionWalker.Decompile(stringBuilder, expression2.Indices[0], null);
            for (int i = 1; i < expression2.Indices.Count; i++)
            {
                stringBuilder.Append(", ");
                RuleExpressionWalker.Decompile(stringBuilder, expression2.Indices[i], null);
            }
            stringBuilder.Append(']');
        }
        private static Rule Rule_with_array_indexer_condition_and_setter_action()
        {
            //this.StringList[1, 1]
            CodeArrayIndexerExpression indexerExpression = new CodeArrayIndexerExpression
                                                           (
                new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "StringList"),
                new CodeExpression[] { new CodePrimitiveExpression(1), new CodePrimitiveExpression(1) }
                                                           );

            //this.StringList[1, 1] == "A"
            CodeBinaryOperatorExpression stringIndexTest = new CodeBinaryOperatorExpression
            {
                Left     = indexerExpression,
                Operator = CodeBinaryOperatorType.ValueEquality,
                Right    = new CodePrimitiveExpression("A")
            };

            //discount action this.Discount = 200
            CodeAssignStatement discountAction = new CodeAssignStatement
                                                 (
                new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "Discount"),
                new CodePrimitiveExpression(200)
                                                 );

            Rule rule2 = new Rule("Rule2")
            {
                Condition = new RuleExpressionCondition(stringIndexTest)
            };

            rule2.ThenActions.Add(new RuleStatementAction(discountAction));

            return(rule2);
        }
 private void GenerateArrayIndexerExpression(CodeArrayIndexerExpression e)
 {
     GenerateExpression(e.TargetObject);
     output.Write("[");
     GenerateExpression(e.Indices[0]);
     output.Write("]");
 }
Esempio n. 9
0
        void EmitArrayIndexer(CodeArrayIndexerExpression array)
        {
            if (array.TargetObject is CodePropertyReferenceExpression &&
                ((CodePropertyReferenceExpression)array.TargetObject).PropertyName == Parser.VarProperty &&
                array.Indices.Count == 1 && array.Indices[0] is CodePrimitiveExpression)
            {
                var name = ((CodePrimitiveExpression)array.Indices[0]).Value as string;

                if (name != null)
                {
                    var sep = name.IndexOf(Parser.ScopeVar);

                    if (sep != -1)
                    {
                        name = name.Substring(sep + 1);
                    }

                    writer.Write(name);
                    return;
                }
            }

            EmitExpression(array.TargetObject);

            foreach (CodeExpression index in array.Indices)
            {
                writer.Write(Parser.ArrayOpen);
                EmitExpression(index);
                writer.Write(Parser.ArrayClose);
            }
        }
Esempio n. 10
0
 /// <inheritdoc />
 protected override bool HandleDynamic(CodeArrayIndexerExpression obj, Context ctx)
 {
     WrapIfNecessaryAndHandle(obj.TargetObject, ctx);
     ctx.Writer.Write("(");
     GeneralUtils.HandleCollectionCommaSeparated(obj.Indices.Cast <CodeExpression>(), ctx.HandlerProvider.ExpressionHandler, ctx);
     ctx.Writer.Write(")");
     return(true);
 }
Esempio n. 11
0
 private void ValidateArrayIndexerExpression(CodeArrayIndexerExpression e)
 {
     this.ValidateExpression(e.TargetObject);
     foreach (CodeExpression expression in e.Indices)
     {
         this.ValidateExpression(expression);
     }
 }
Esempio n. 12
0
        public void Constructor0_Deny_Unrestricted()
        {
            CodeArrayIndexerExpression caie = new CodeArrayIndexerExpression();

            Assert.AreEqual(0, caie.Indices.Count, "Indices");
            Assert.IsNull(caie.TargetObject, "TargetObject");
            caie.TargetObject = new CodeExpression();
        }
Esempio n. 13
0
 protected override void GenerateArrayIndexerExpression
     (CodeArrayIndexerExpression e)
 {
     GenerateExpression(e.TargetObject);
     Output.Write("[");
     OutputExpressionList(e.Indices);
     Output.Write("]");
 }
Esempio n. 14
0
        void EmitArrayIndexerExpression(CodeArrayIndexerExpression Indexer)
        {
            var index = (CodeArrayIndexerExpression)Indexer;

            Generator.Emit(OpCodes.Ldloc, VarsProperty);
            EmitExpression(index.Indices[0]);

            Generator.Emit(OpCodes.Callvirt, GetVariable);
        }
Esempio n. 15
0
 public static void ReplaceType(this CodeArrayIndexerExpression expression, string oldType, string newType)
 {
     if (expression == null)
     {
         return;
     }
     expression.Indices.ReplaceType(oldType, newType);
     expression.TargetObject.ReplaceType(oldType, newType);
 }
 public TypescriptArrayIndexerExpression(
     IExpressionFactory expressionFactory,
     CodeArrayIndexerExpression codeExpression,
     CodeGeneratorOptions options)
 {
     _expressionFactory = expressionFactory;
     _codeExpression    = codeExpression;
     _options           = options;
     System.Diagnostics.Debug.WriteLine("TypescriptArrayIndexerExpression Created");
 }
        internal override void AnalyzeUsage(CodeExpression expression, RuleAnalysis analysis, bool isRead, bool isWritten, RulePathQualifier qualifier)
        {
            CodeArrayIndexerExpression expression2 = (CodeArrayIndexerExpression)expression;

            RuleExpressionWalker.AnalyzeUsage(analysis, expression2.TargetObject, isRead, isWritten, qualifier);
            for (int i = 0; i < expression2.Indices.Count; i++)
            {
                RuleExpressionWalker.AnalyzeUsage(analysis, expression2.Indices[i], true, false, null);
            }
        }
Esempio n. 18
0
        public void TestCodeArrayIndexerExpressionFunky()
        {
            TestCodeExpression(new CodeArrayIndexerExpression(),
                               "");

            var e = new CodeArrayIndexerExpression();

            e.Indices.Add(new CodePrimitiveExpression(8));
            TestCodeExpression(e,
                               "[8]");
        }
Esempio n. 19
0
        // <Snippet2>
        public CodeCompileUnit CreateGraph()
        {
            // Create a compile unit to contain a CodeDOM graph
            CodeCompileUnit cu = new CodeCompileUnit();

            // Create a namespace named "TestSpace"
            CodeNamespace cn = new CodeNamespace("TestSpace");

            // Create a new type named "TestClass"
            CodeTypeDeclaration cd = new CodeTypeDeclaration("TestClass");

            // Create an entry point method
            CodeEntryPointMethod cm = new CodeEntryPointMethod();

            // Create the initialization expression for an array of type Int32 with 10 indices
            CodeArrayCreateExpression ca1 = new CodeArrayCreateExpression("System.Int32", 10);

            // Declare an array of type Int32, using the CodeArrayCreateExpression ca1 as the initialization expression
            CodeVariableDeclarationStatement cv1 = new CodeVariableDeclarationStatement("System.Int32[]", "x", ca1);

            // Add the array declaration and initialization statement to the entry point method class member
            cm.Statements.Add(cv1);

            // <Snippet1>
            // Create an array indexer expression that references index 5 of array "x"
            CodeArrayIndexerExpression ci1 = new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("x"), new CodePrimitiveExpression(5));

            // A C# code generator produces the following source code for the preceeding example code:

            // x[5]
            // </Snippet1>

            // Declare a variable of type Int32 and adds it to the entry point method
            CodeVariableDeclarationStatement cv2 = new CodeVariableDeclarationStatement("System.Int32", "y");

            cm.Statements.Add(cv2);

            // Assign the value of the array indexer ci1 to variable "y"
            CodeAssignStatement as1 = new CodeAssignStatement(new CodeVariableReferenceExpression("y"), ci1);

            // Add the assignment statement to the entry point method
            cm.Statements.Add(as1);

            // Add the entry point method to the "TestClass" type
            cd.Members.Add(cm);

            // Add the "TestClass" type to the namespace
            cn.Types.Add(cd);

            // Add the "TestSpace" namespace to the compile unit
            cu.Namespaces.Add(cn);

            return(cu);
        }
        internal override CodeExpression Clone(CodeExpression expression)
        {
            CodeArrayIndexerExpression expression2  = (CodeArrayIndexerExpression)expression;
            CodeExpression             targetObject = RuleExpressionWalker.Clone(expression2.TargetObject);

            CodeExpression[] indices = new CodeExpression[expression2.Indices.Count];
            for (int i = 0; i < indices.Length; i++)
            {
                indices[i] = RuleExpressionWalker.Clone(expression2.Indices[i]);
            }
            return(new CodeArrayIndexerExpression(targetObject, indices));
        }
Esempio n. 21
0
        public static CodeArrayIndexerExpression Clone(this CodeArrayIndexerExpression expression)
        {
            if (expression == null)
            {
                return(null);
            }
            CodeArrayIndexerExpression e = new CodeArrayIndexerExpression();

            e.Indices.AddRange(expression.Indices.Clone());
            e.TargetObject = expression.TargetObject.Clone();
            e.UserData.AddRange(expression.UserData);
            return(e);
        }
Esempio n. 22
0
        public void Constructor1_Deny_Unrestricted()
        {
            CodeExpression target = new CodeExpression();

            CodeExpression[] parameters = new CodeExpression[1] {
                target
            };
            CodeArrayIndexerExpression caie = new CodeArrayIndexerExpression(target, parameters);

            Assert.AreEqual(1, caie.Indices.Count, "Indices");
            Assert.AreSame(target, caie.TargetObject, "TargetObject");
            caie.TargetObject = new CodeExpression();
        }
        private static void AddArrayWriteCodeStatements(CodeStatementCollection statements, string writerParamName, MessageFieldType type, CodePropertyReferenceExpression propertyExpression)
        {
            for (int i = 0; i < type.ArrayLength; i++)
            {
                CodeArrayIndexerExpression codeArrayIndexerExpression =
                    new CodeArrayIndexerExpression(propertyExpression, new CodePrimitiveExpression(i));

                CodeMethodInvokeExpression writeInvoke =
                    new CodeMethodInvokeExpression(
                        new CodeVariableReferenceExpression(writerParamName), "Write", codeArrayIndexerExpression);

                statements.Add(writeInvoke);
            }
        }
Esempio n. 24
0
 /// <summary>
 /// get a CodeExpression representing T[i]?
 /// </summary>
 /// <param name="methodCompile"></param>
 /// <param name="statements"></param>
 /// <param name="method"></param>
 /// <param name="forValue"></param>
 /// <returns></returns>
 public CodeExpression GetReferenceCode(IMethodCompile methodCompile, CodeStatementCollection statements, MethodPointer method, CodeExpression[] ps, bool forValue)
 {
     if (string.Compare(method.MethodName, "Get", StringComparison.Ordinal) == 0)
     {
         CodeExpression ce = new CodeArrayIndexerExpression(GetReferenceCode(methodCompile, statements, forValue), ps);
         return(ce);
     }
     else if (string.Compare(method.MethodName, "Set", StringComparison.Ordinal) == 0)
     {
         CodeExpression ce = new CodeArrayIndexerExpression(GetReferenceCode(methodCompile, statements, forValue), ps[0]);
         return(ce);
     }
     return(null);
 }
Esempio n. 25
0
            CodeExpression Index(string group, int index, char swizzle)
            {
                CodeExpression variable;

                if (group == "r")                //local temp.
                {
                    variable = new CodeVariableReferenceExpression(group + index);
                }
                else
                {
                    variable = new CodeArrayIndexerExpression(new CodeVariableReferenceExpression(group), new CodePrimitiveExpression(index));
                }

                variable = new CodeFieldReferenceExpression(variable, char.ToUpper(swizzle).ToString());
                return(variable);
            }
        private static void AddArrayReadCodeStatements(CodeStatementCollection codeStatementCollection, string readerParamName, MessageField messageField, CodePropertyReferenceExpression propertyExpression)
        {
            String readMethodName = GetReadMethodName(messageField.Type.DataType);

            for (int i = 0; i < messageField.Type.ArrayLength; i++)
            {
                CodeArrayIndexerExpression codeArrayIndexerExpression =
                    new CodeArrayIndexerExpression(propertyExpression, new CodePrimitiveExpression(i));

                CodeAssignStatement propertyAssignStatement = new CodeAssignStatement(codeArrayIndexerExpression,
                                                                                      new CodeMethodInvokeExpression(
                                                                                          new CodeVariableReferenceExpression(readerParamName), readMethodName));

                codeStatementCollection.Add(propertyAssignStatement);
            }
        }
        static bool WriteCodeArrayIndexerExpression(CodeArrayIndexerExpression arrayIndexerExpression, TextWriter w, CodeGeneratorOptions o)
        {
            if (arrayIndexerExpression == null)
            {
                return(false);
            }

            GenerateCodeFromExpression(arrayIndexerExpression.TargetObject, w, o);
            for (int i = 0; i < arrayIndexerExpression.Indices.Count; i++)
            {
                w.Write("[");
                GenerateCodeFromExpression(arrayIndexerExpression.Indices[i], w, o);
                w.Write("]");
            }

            return(true);
        }
Esempio n. 28
0
        private void ProcessAction(CodeTypeDeclaration action)
        {
            var orgResponse = new CodeTypeReference(typeof(Microsoft.Xrm.Sdk.OrganizationResponse)).BaseType;

            if (MakeResponseActionsEditable && action.BaseTypes.OfType <CodeTypeReference>().Any(r => r.BaseType == orgResponse))
            {
                foreach (var prop in from CodeTypeMember member in action.Members
                         let propDom = member as CodeMemberProperty
                                       where propDom != null && !propDom.HasSet
                                       select propDom)
                {
                    var thisMember = new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "Results");
                    var indexOf    = new CodeArrayIndexerExpression(thisMember, new CodePrimitiveExpression(prop.Name));
                    prop.SetStatements.Add(new CodeAssignStatement(indexOf, new CodePropertySetValueReferenceExpression()));
                }
            }
        }
Esempio n. 29
0
        static CodeMemberProperty CreateProperty(PropertyNameType nameType, string constantsClassName, string defaultValuesClassName)
        {
            CodeMemberProperty publicProp = new CodeMemberProperty();

            publicProp.Name       = nameType.propertyName;
            publicProp.Attributes = CodeDomHelperObjects.PublicFinal;
            publicProp.HasGet     = true;
            publicProp.HasSet     = true;
            publicProp.Type       = new CodeTypeReference(nameType.propertyType);

            CodeAttributeDeclarationCollection attributes = new CodeAttributeDeclarationCollection();
            CodeAttributeArgument arg1 = new CodeAttributeArgument(
                new CodeFieldReferenceExpression(
                    new CodeTypeReferenceExpression(constantsClassName),
                    nameType.propertyName));
            CodeAttributeArgument arg2 = new CodeAttributeArgument(
                PropertyNameConstants.DefaultValueProperty,
                new CodeFieldReferenceExpression(
                    new CodeTypeReferenceExpression(defaultValuesClassName),
                    Constants.DefaultPrefix + nameType.propertyName));

            // Future TODO: Provide a library with attributes that custom channel writes
            // can use to adorn their properties with default values and validators, we can
            // then add it here.
            attributes.Add(new CodeAttributeDeclaration(
                               new CodeTypeReference(TypeNameConstants.ConfigurationProperty),
                               arg1, arg2));
            publicProp.CustomAttributes = new CodeAttributeDeclarationCollection(attributes);
            string nameInConfig = constantsClassName + "." + nameType.propertyName;
            CodeArrayIndexerExpression baseIndexedProperty
                = new CodeArrayIndexerExpression(
                      CodeDomHelperObjects.BaseRef,
                      new CodeFieldReferenceExpression(
                          new CodeTypeReferenceExpression(constantsClassName),
                          nameType.propertyName));

            publicProp.GetStatements.Add(new CodeMethodReturnStatement(
                                             new CodeCastExpression(
                                                 nameType.propertyType,
                                                 baseIndexedProperty)));
            publicProp.SetStatements.Add(new CodeAssignStatement(
                                             baseIndexedProperty,
                                             new CodePropertySetValueReferenceExpression()));
            return(publicProp);
        }
Esempio n. 30
0
        private void DelegateMethods(CodeTypeDeclaration typeDeclaration, Type[] delegatedTypes)
        {
            var initializeMethod = new CodeMemberMethod();

            initializeMethod.Name       = "Initialize";
            initializeMethod.Attributes = MemberAttributes.Public | MemberAttributes.Final;
            var codeParameter = new CodeParameterDeclarationExpression(typeof(object[]), "objs");

            initializeMethod.Parameters.Add(codeParameter);

            for (var i = 0; i < delegatedTypes.Length; i++)
            {
                var delegatedType = delegatedTypes[i];

                string instanceName = GenerateInstanceName(delegatedType);

                var fieldDeclaration = new CodeMemberField(delegatedType, instanceName);
                typeDeclaration.Members.Add(fieldDeclaration);

                foreach (var methodInfo in delegatedType.GetMethods(BindingFlags.Public | BindingFlags.Instance))
                {
                    if (methodInfo.DeclaringType == typeof(object) || methodInfo.Attributes.HasFlag(MethodAttributes.SpecialName))
                    {
                        continue;
                    }

                    var delegateMethod = _methodDelegater.BuildDelegateMethod(methodInfo, instanceName);

                    if (delegateMethod != null)
                    {
                        typeDeclaration.Members.Add(delegateMethod);
                    }
                }

                var argumentReference          = new CodeArgumentReferenceExpression("objs");
                var codeArrayIndexerExpression = new CodeArrayIndexerExpression(argumentReference, new CodeSnippetExpression(i.ToString()));

                var castExpression      = new CodeCastExpression(delegatedType, codeArrayIndexerExpression);
                var assignmentStatement = new CodeAssignStatement(new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), instanceName), castExpression);

                initializeMethod.Statements.Add(assignmentStatement);
            }

            typeDeclaration.Members.Add(initializeMethod);
        }
Esempio n. 31
0
        private void StoreElement(Instruction il)
        {
            var value = Pop();
            var index = Pop();
            var array = Pop();

            var type = this.typeEvaluator.Evaluate(array);
            if (type is ArrayType) {
                type = ((ArrayType)type).ElementType;
            }

            var lhs = new CodeArrayIndexerExpression(array, index);
            RefinePrimitiveExpression(value, type);
            AddAssignment(lhs, value);
        }
Esempio n. 32
0
 private void LoadElement(Instruction il)
 {
     var index = Pop();
     var target = Pop();
     var expr = new CodeArrayIndexerExpression(target, index);
     Push(expr);
 }
Esempio n. 33
0
 protected abstract void GenerateArrayIndexerExpression(CodeArrayIndexerExpression e);
	protected override void GenerateArrayIndexerExpression
				(CodeArrayIndexerExpression e)
			{
				GenerateExpression(e.TargetObject);
				Output.Write("[");
				OutputExpressionList(e.Indices);
				Output.Write("]");
			}
Esempio n. 35
0
 private void GenerateArrayIndexerExpression(CodeArrayIndexerExpression e)
 {
     GenerateExpression(e.TargetObject);
     Output.Write("[");
     bool first = true;
     foreach (CodeExpression exp in e.Indices)
     {
         if (first)
         {
             first = false;
         }
         else
         {
             Output.Write(", ");
         }
         GenerateExpression(exp);
     }
     Output.Write("]");
 }
Esempio n. 36
0
 public void VisitArrayIndexer(CodeArrayIndexerExpression aref)
 {
     Write(aref.TargetObject, PrecPrimary);
     writer.Write("[");
     var sep = "";
     foreach (var sub in aref.Indices)
     {
         writer.Write(sep);
         sep = ",";
         Write(sub, PrecBase);
     }
     writer.Write("]");
 }
Esempio n. 37
0
			public void Visit(CodeArrayIndexerExpression o)
			{
				g.GenerateArrayIndexerExpression(o);
			}
Esempio n. 38
0
 private void ValidateArrayIndexerExpression(CodeArrayIndexerExpression e)
 {
     ValidateExpression(e.TargetObject);
     foreach (CodeExpression exp in e.Indices)
     {
         ValidateExpression(exp);
     }
 }