• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ArrayCreateExpression类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ArrayCreateExpression的典型用法代码示例。如果您正苦于以下问题:C# ArrayCreateExpression类的具体用法?C# ArrayCreateExpression怎么用?C# ArrayCreateExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ArrayCreateExpression类属于命名空间,在下文中一共展示了ArrayCreateExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VisitArrayCreateExpression

 public virtual void VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression)
 {
     if (this.ThrowException)
     {
         throw (Exception)this.CreateException(arrayCreateExpression);
     }
 }
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs


示例2: VisitArrayCreateExpression

 public override void VisitArrayCreateExpression(ArrayCreateExpression node)
 {
     node.Initializer.Elements.ToList().ForEach
     (
         item => item.AcceptVisitor(this)
     );
 }
开发者ID:GavinHwa,项目名称:Bridge,代码行数:7,代码来源:ArrayInitializerVisitor.cs


示例3: VisitArrayCreateExpression

            public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
            {
                if (arrayCreateExpression.Arguments.Count >= 10)
                {
                    UnlockWith(arrayCreateExpression);
                }

                return base.VisitArrayCreateExpression(arrayCreateExpression, data);
            }
开发者ID:cohenw,项目名称:strokes,代码行数:9,代码来源:TooManyDimensionArrayDeclarationAchievement.cs


示例4: VisitArrayCreateExpression

		public virtual object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
			Debug.Assert((arrayCreateExpression != null));
			Debug.Assert((arrayCreateExpression.CreateType != null));
			Debug.Assert((arrayCreateExpression.Arguments != null));
			Debug.Assert((arrayCreateExpression.ArrayInitializer != null));
			arrayCreateExpression.CreateType.AcceptVisitor(this, data);
			foreach (Expression o in arrayCreateExpression.Arguments) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return arrayCreateExpression.ArrayInitializer.AcceptVisitor(this, data);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:12,代码来源:AbstractASTVisitor.cs


示例5: VisitArrayCreateExpression

		public void VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression)
		{
			StartNode(arrayCreateExpression);
//			WriteKeyword(ArrayCreateExpression.NewKeywordRole);
//			arrayCreateExpression.Type.AcceptVisitor(this);

			if (arrayCreateExpression.Arguments.Count > 0) {
				WriteKeyword ("new");
				WriteIdentifier ("Array");
				WriteToken (Roles.LChevron);
				arrayCreateExpression.Type.AcceptVisitor(this);
				WriteToken (Roles.RChevron);
				LPar ();
				WriteCommaSeparatedList(arrayCreateExpression.Arguments);
				RPar ();
			}
//			foreach (var specifier in arrayCreateExpression.AdditionalArraySpecifiers) {
//				specifier.AcceptVisitor(this);
//			}
			arrayCreateExpression.Initializer.AcceptVisitor(this);

			EndNode(arrayCreateExpression);
		}
开发者ID:cbsistem,项目名称:Netjs,代码行数:23,代码来源:TsOutputVisitor.cs


示例6: VisitArrayCreateExpression

 public abstract StringBuilder VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, int data);
开发者ID:hach-que,项目名称:SLSharp,代码行数:1,代码来源:VisitorBase.Abstract.cs


示例7: VisitArrayCreateExpression

		public virtual object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
			throw new global::System.NotImplementedException("ArrayCreateExpression");
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:3,代码来源:NotImplementedAstVisitor.cs


示例8: VisitArrayCreateExpression

		public virtual void VisitArrayCreateExpression (ArrayCreateExpression arrayCreateExpression)
		{
			VisitChildren (arrayCreateExpression);
		}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:4,代码来源:DepthFirstAstVisitor.cs


示例9: ConvertNewArrayBounds

        Expression ConvertNewArrayBounds(InvocationExpression invocation)
        {
            if (invocation.Arguments.Count != 2)
                return NotSupported(invocation);

            AstType elementType = ConvertTypeReference(invocation.Arguments.ElementAt(0));
            IList<Expression> arguments = ConvertExpressionsArray(invocation.Arguments.ElementAt(1));
            if (elementType != null && arguments != null) {
                if (ContainsAnonymousType(elementType)) {
                    elementType = null;
                }
                ArrayCreateExpression ace = new ArrayCreateExpression();
                ace.Type = elementType;
                ace.Arguments.AddRange(arguments);
                return ace;
            }
            return null;
        }
开发者ID:ropean,项目名称:Usable,代码行数:18,代码来源:ExpressionTreeConverter.cs


示例10: VisitArrayCreateExpression

			public override void VisitArrayCreateExpression (ArrayCreateExpression arrayCreateExpression)
			{
				base.VisitArrayCreateExpression (arrayCreateExpression);

				if (arrayCreateExpression.Arguments.Count != 1 || !arrayCreateExpression.Initializer.IsNull)
					return;

				var count = arrayCreateExpression.Arguments.First ();
				if (count is PrimitiveExpression && Convert.ToInt32 (((PrimitiveExpression)count).Value) == 0)
					return;

				var s = arrayCreateExpression.GetParent<Statement> ();
				if (s == null)
					return;

				var find = new FindFirstUseOfArray ();

				var variableDeclarationStatement = s as VariableDeclarationStatement;
				if (variableDeclarationStatement != null) {
					var v = arrayCreateExpression.GetParent <VariableInitializer> ();
					find.Variable = new IdentifierExpression (v.Name);

				} else {
					var es = s as ExpressionStatement;
					if (es != null && es.Expression is AssignmentExpression) {
						find.Variable = ((AssignmentExpression)es.Expression).Left;
					} else {
						return; // Don't know what's going on
					}
				}

				if (find.Variable == null)
					return;

				arrayCreateExpression.GetParent<EntityDeclaration> ().AcceptVisitor (find);
				if ((find.First is AssignmentExpression))
					return;

				var i = new IdentifierExpression ("_ai");
				var def = GetDefaultValue (arrayCreateExpression.Type);

				var init = new ForStatement {
					Condition = new BinaryOperatorExpression (
						i,
						BinaryOperatorType.LessThan,
						new MemberReferenceExpression ((Expression)find.Variable.Clone (), "length")),
					EmbeddedStatement = new ExpressionStatement (
						new AssignmentExpression (
							new IndexerExpression ((Expression)find.Variable.Clone (), i.Clone ()),
							def.Clone ())),
				};
				init.Initializers.Add (new VariableDeclarationStatement (new PrimitiveType ("number"), i.Identifier, new PrimitiveExpression (0)));
				init.Iterators.Add (new ExpressionStatement (new UnaryOperatorExpression (UnaryOperatorType.Increment, (Expression)i.Clone ())));

				s.Parent.InsertChildAfter (s, init, (Role<Statement>)s.Role);
			}
开发者ID:RReverser,项目名称:Netjs,代码行数:56,代码来源:CsToTs.cs


示例11: TransformByteCode

		AstNode TransformByteCode(ILExpression byteCode)
		{
			object operand = byteCode.Operand;
			AstType operandAsTypeRef = AstBuilder.ConvertType(operand as ITypeDefOrRef);

			List<Expression> args = new List<Expression>();
			foreach(ILExpression arg in byteCode.Arguments) {
				args.Add((Expression)TransformExpression(arg));
			}
			Expression arg1 = args.Count >= 1 ? args[0] : null;
			Expression arg2 = args.Count >= 2 ? args[1] : null;
			Expression arg3 = args.Count >= 3 ? args[2] : null;
			
			switch (byteCode.Code) {
					#region Arithmetic
				case ILCode.Add:
				case ILCode.Add_Ovf:
				case ILCode.Add_Ovf_Un:
					{
						BinaryOperatorExpression boe;
						if (byteCode.InferredType is PtrSig) {
							boe = new BinaryOperatorExpression(arg1, BinaryOperatorType.Add, arg2);
							if (byteCode.Arguments[0].ExpectedType is PtrSig ||
								byteCode.Arguments[1].ExpectedType is PtrSig) {
								boe.AddAnnotation(IntroduceUnsafeModifier.PointerArithmeticAnnotation);
							}
						} else {
							boe = new BinaryOperatorExpression(arg1, BinaryOperatorType.Add, arg2);
						}
						boe.AddAnnotation(byteCode.Code == ILCode.Add ? AddCheckedBlocks.UncheckedAnnotation : AddCheckedBlocks.CheckedAnnotation);
						return boe;
					}
				case ILCode.Sub:
				case ILCode.Sub_Ovf:
				case ILCode.Sub_Ovf_Un:
					{
						BinaryOperatorExpression boe;
						if (byteCode.InferredType is PtrSig) {
							boe = new BinaryOperatorExpression(arg1, BinaryOperatorType.Subtract, arg2);
							if (byteCode.Arguments[0].ExpectedType is PtrSig) {
								boe.WithAnnotation(IntroduceUnsafeModifier.PointerArithmeticAnnotation);
							}
						} else {
							boe = new BinaryOperatorExpression(arg1, BinaryOperatorType.Subtract, arg2);
						}
						boe.AddAnnotation(byteCode.Code == ILCode.Sub ? AddCheckedBlocks.UncheckedAnnotation : AddCheckedBlocks.CheckedAnnotation);
						return boe;
					}
					case ILCode.Div:        return new BinaryOperatorExpression(arg1, BinaryOperatorType.Divide, arg2);
					case ILCode.Div_Un:     return new BinaryOperatorExpression(arg1, BinaryOperatorType.Divide, arg2);
					case ILCode.Mul:        return new BinaryOperatorExpression(arg1, BinaryOperatorType.Multiply, arg2).WithAnnotation(AddCheckedBlocks.UncheckedAnnotation);
					case ILCode.Mul_Ovf:    return new BinaryOperatorExpression(arg1, BinaryOperatorType.Multiply, arg2).WithAnnotation(AddCheckedBlocks.CheckedAnnotation);
					case ILCode.Mul_Ovf_Un: return new BinaryOperatorExpression(arg1, BinaryOperatorType.Multiply, arg2).WithAnnotation(AddCheckedBlocks.CheckedAnnotation);
					case ILCode.Rem:        return new BinaryOperatorExpression(arg1, BinaryOperatorType.Modulus, arg2);
					case ILCode.Rem_Un:     return new BinaryOperatorExpression(arg1, BinaryOperatorType.Modulus, arg2);
					case ILCode.And:        return new BinaryOperatorExpression(arg1, BinaryOperatorType.BitwiseAnd, arg2);
					case ILCode.Or:         return new BinaryOperatorExpression(arg1, BinaryOperatorType.BitwiseOr, arg2);
					case ILCode.Xor:        return new BinaryOperatorExpression(arg1, BinaryOperatorType.ExclusiveOr, arg2);
					case ILCode.Shl:        return new BinaryOperatorExpression(arg1, BinaryOperatorType.ShiftLeft, arg2);
					case ILCode.Shr:        return new BinaryOperatorExpression(arg1, BinaryOperatorType.ShiftRight, arg2);
					case ILCode.Shr_Un:     return new BinaryOperatorExpression(arg1, BinaryOperatorType.ShiftRight, arg2);
					case ILCode.Neg:        return new UnaryOperatorExpression(UnaryOperatorType.Minus, arg1).WithAnnotation(AddCheckedBlocks.UncheckedAnnotation);
					case ILCode.Not:        return new UnaryOperatorExpression(UnaryOperatorType.BitNot, arg1);
				case ILCode.PostIncrement:
				case ILCode.PostIncrement_Ovf:
				case ILCode.PostIncrement_Ovf_Un:
					{
						if (arg1 is DirectionExpression)
							arg1 = ((DirectionExpression)arg1).Expression.Detach();
						var uoe = new UnaryOperatorExpression(
							(int)byteCode.Operand > 0 ? UnaryOperatorType.PostIncrement : UnaryOperatorType.PostDecrement, arg1);
						uoe.AddAnnotation((byteCode.Code == ILCode.PostIncrement) ? AddCheckedBlocks.UncheckedAnnotation : AddCheckedBlocks.CheckedAnnotation);
						return uoe;
					}
					#endregion
					#region Arrays
					case ILCode.Newarr: {
						var ace = new ArrayCreateExpression();
						ace.Type = operandAsTypeRef;
						ComposedType ct = operandAsTypeRef as ComposedType;
						if (ct != null) {
							// change "new (int[,])[10] to new int[10][,]"
							ct.ArraySpecifiers.MoveTo(ace.AdditionalArraySpecifiers);
						}
						if (byteCode.Code == ILCode.InitArray) {
							ace.Initializer = new ArrayInitializerExpression();
							ace.Initializer.Elements.AddRange(args);
						} else {
							ace.Arguments.Add(arg1);
						}
						return ace;
					}
					case ILCode.InitArray: {
						var ace = new ArrayCreateExpression();
						ace.Type = operandAsTypeRef;
						ComposedType ct = operandAsTypeRef as ComposedType;
						var arrayType = (ArraySigBase)((ITypeDefOrRef)operand).ToTypeSig(); ;
						if (ct != null)
						{
							// change "new (int[,])[10] to new int[10][,]"
//.........这里部分代码省略.........
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:101,代码来源:AstMethodBodyBuilder.cs


示例12: VisitArrayCreateExpression

		public virtual void VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression)
		{
			DebugExpression(arrayCreateExpression);
			StartNode(arrayCreateExpression);
			WriteKeyword(ArrayCreateExpression.NewKeywordRole);
			arrayCreateExpression.Type.AcceptVisitor(this);
			if (arrayCreateExpression.Arguments.Count > 0) {
				WriteCommaSeparatedListInBrackets(arrayCreateExpression.Arguments, CodeBracesRangeFlags.SquareBrackets);
			}
			int count = 0;
			foreach (var specifier in arrayCreateExpression.AdditionalArraySpecifiers) {
				if (count-- <= 0) {
					cancellationToken.ThrowIfCancellationRequested();
					count = CANCEL_CHECK_LOOP_COUNT;
				}
				specifier.AcceptVisitor(this);
			}
			arrayCreateExpression.Initializer.AcceptVisitor(this);
			EndNode(arrayCreateExpression);
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:20,代码来源:CSharpOutputVisitor.cs


示例13: NewExpression

	void NewExpression(
#line  2014 "cs.ATG" 
out Expression pexpr) {

#line  2015 "cs.ATG" 
		pexpr = null;
		List<Expression> parameters = new List<Expression>();
		TypeReference type = null;
		Expression expr;
		
		Expect(89);
		if (StartOf(10)) {
			NonArrayType(
#line  2022 "cs.ATG" 
out type);
		}
		if (la.kind == 16 || la.kind == 20) {
			if (la.kind == 20) {

#line  2028 "cs.ATG" 
				ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); 
				lexer.NextToken();

#line  2029 "cs.ATG" 
				if (type == null) Error("Cannot use an anonymous type with arguments for the constructor"); 
				if (StartOf(26)) {
					Argument(
#line  2030 "cs.ATG" 
out expr);

#line  2030 "cs.ATG" 
					SafeAdd(oce, parameters, expr); 
					while (la.kind == 14) {
						lexer.NextToken();
						Argument(
#line  2031 "cs.ATG" 
out expr);

#line  2031 "cs.ATG" 
						SafeAdd(oce, parameters, expr); 
					}
				}
				Expect(21);

#line  2033 "cs.ATG" 
				pexpr = oce; 
				if (la.kind == 16) {
					CollectionOrObjectInitializer(
#line  2034 "cs.ATG" 
out expr);

#line  2034 "cs.ATG" 
					oce.ObjectInitializer = (CollectionInitializerExpression)expr; 
				}
			} else {

#line  2035 "cs.ATG" 
				ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); 
				CollectionOrObjectInitializer(
#line  2036 "cs.ATG" 
out expr);

#line  2036 "cs.ATG" 
				oce.ObjectInitializer = (CollectionInitializerExpression)expr; 

#line  2037 "cs.ATG" 
				pexpr = oce; 
			}
		} else if (la.kind == 18) {
			lexer.NextToken();

#line  2042 "cs.ATG" 
			ArrayCreateExpression ace = new ArrayCreateExpression(type);
			/* we must not change RankSpecifier on the null type reference*/
			if (ace.CreateType.IsNull) { ace.CreateType = new TypeReference(""); }
			pexpr = ace;
			int dims = 0; List<int> ranks = new List<int>();
			
			if (la.kind == 14 || la.kind == 19) {
				while (la.kind == 14) {
					lexer.NextToken();

#line  2049 "cs.ATG" 
					dims += 1; 
				}
				Expect(19);

#line  2050 "cs.ATG" 
				ranks.Add(dims); dims = 0; 
				while (la.kind == 18) {
					lexer.NextToken();
					while (la.kind == 14) {
						lexer.NextToken();

#line  2051 "cs.ATG" 
						++dims; 
					}
					Expect(19);

#line  2051 "cs.ATG" 
//.........这里部分代码省略.........
开发者ID:mgagne-atman,项目名称:Projects,代码行数:101,代码来源:Parser.cs


示例14: ArrayCreateBlock

 public ArrayCreateBlock(IEmitter emitter, ArrayCreateExpression arrayCreateExpression)
     : base(emitter, arrayCreateExpression)
 {
     this.Emitter = emitter;
     this.ArrayCreateExpression = arrayCreateExpression;
 }
开发者ID:GavinHwa,项目名称:Bridge,代码行数:6,代码来源:ArrayCreateBlock.cs


示例15: VisitArrayCreateExpression

		public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
		{
			for (int i = 0; i < arrayCreateExpression.Arguments.Count; i++) {
				arrayCreateExpression.Arguments[i] = Expression.AddInteger(arrayCreateExpression.Arguments[i], -1);
			}
			return base.VisitArrayCreateExpression(arrayCreateExpression, data);
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:7,代码来源:ToVBNetConvertVisitor.cs


示例16: VisitArrayCreateExpression

 public void VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression)
 {
     JsonObject expression = CreateJsonExpression(arrayCreateExpression);
     AddKeyword(expression, ArrayCreateExpression.NewKeywordRole);
     expression.AddJsonValue("array-type", GenTypeInfo(arrayCreateExpression.Type));
     if (arrayCreateExpression.Arguments.Count > 0)
     {
         expression.AddJsonValue("arguments", GetCommaSeparatedList(arrayCreateExpression.Arguments));
     }
     JsonArray specifierArr = new JsonArray();
     foreach (var specifier in arrayCreateExpression.AdditionalArraySpecifiers)
     {
         specifier.AcceptVisitor(this);
         var pop = Pop();
         if (pop != null)
         {
             specifierArr.AddJsonValue(pop);
         }
     }
     if (specifierArr.Count == 0)
     {
         specifierArr = null;
     }
     expression.AddJsonValue("specifier", specifierArr);
     expression.AddJsonValue("initializer", GenExpression(arrayCreateExpression.Initializer));
     Push(expression);
 }
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:27,代码来源:AstCsToJson.cs


示例17: Visit

 public override object Visit(ArrayCreateExpression arrayCreateExpression, object data)
 {
     ReturnType type = new ReturnType(arrayCreateExpression.CreateType);
     if (arrayCreateExpression.Parameters != null && arrayCreateExpression.Parameters.Count > 0) {
         int[] newRank = new int[arrayCreateExpression.Rank.Length + 1];
         newRank[0] = arrayCreateExpression.Parameters.Count - 1;
         Array.Copy(type.ArrayDimensions, 0, newRank, 1, type.ArrayDimensions.Length);
         type.ArrayDimensions = newRank;
     }
     return type;
 }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:11,代码来源:TypeVisitor.cs


示例18: Visit

			public override object Visit (ArrayCreation arrayCreationExpression)
			{
				var result = new ArrayCreateExpression ();
				
				var location = LocationsBag.GetLocations (arrayCreationExpression);
				if (arrayCreationExpression.NewType != null)
					result.AddChild (ConvertToType (arrayCreationExpression.NewType), ArrayCreateExpression.Roles.Type);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), ArrayCreateExpression.Roles.LBracket);
				if (arrayCreationExpression.Arguments != null) {
					var commaLocations = LocationsBag.GetLocations (arrayCreationExpression.Arguments);
					for (int i = 0 ;i < arrayCreationExpression.Arguments.Count; i++) {
						result.AddChild ((Expression)arrayCreationExpression.Arguments[i].Accept (this), ArrayCreateExpression.Roles.Argument);
						if (commaLocations != null && i > 0)
							result.AddChild (new CSharpTokenNode (Convert (commaLocations [commaLocations.Count - i]), 1), ArrayCreateExpression.Roles.Comma);
					}
				}
				var next = arrayCreationExpression.Rank.Next;
				while (next != null) {
					ArraySpecifier spec = new ArraySpecifier (next.Dimension);
					var loc = LocationsBag.GetLocations (next);
					spec.AddChild (new CSharpTokenNode (Convert (next.Location), 1), ArraySpecifier.Roles.LBracket);
					if (loc != null)
						result.AddChild (new CSharpTokenNode (Convert (loc[0]), 1), ArraySpecifier.Roles.RBracket);
					result.AddChild (spec, ArrayCreateExpression.AdditionalArraySpecifierRole);
					next = next.Next;
				}
				
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), ArrayCreateExpression.Roles.RBracket);
				
				if (arrayCreationExpression.Initializers != null && arrayCreationExpression.Initializers.Count != 0) {
					var initLocation = LocationsBag.GetLocations (arrayCreationExpression.Initializers);
					ArrayInitializerExpression initializer = new ArrayInitializerExpression();
					
					initializer.AddChild (new CSharpTokenNode (Convert (arrayCreationExpression.Initializers.Location), 1), ArrayCreateExpression.Roles.LBrace);
					var commaLocations = LocationsBag.GetLocations (arrayCreationExpression.Initializers.Elements);
					for (int i = 0; i < arrayCreationExpression.Initializers.Count; i++) {
						initializer.AddChild ((Expression)arrayCreationExpression.Initializers[i].Accept (this), ArrayInitializerExpression.Roles.Expression);
						if (commaLocations != null && i > 0) {
							initializer.AddChild (new CSharpTokenNode (Convert (commaLocations [commaLocations.Count - i]), 1), IndexerExpression.Roles.Comma);
						}
					}
					
					if (initLocation != null)
						initializer.AddChild (new CSharpTokenNode (Convert (initLocation[initLocation.Count - 1]), 1), ArrayCreateExpression.Roles.RBrace);
					result.AddChild (initializer, ArrayCreateExpression.InitializerRole);
				}
				
				return result;
			}
开发者ID:aleksandersumowski,项目名称:monodevelop,代码行数:51,代码来源:CSharpParser.cs


示例19: Visit

			public override object Visit (ArrayCreation arrayCreationExpression)
			{
				var result = new ArrayCreateExpression ();
				
				var location = LocationsBag.GetLocations (arrayCreationExpression);
				result.AddChild (new CSharpTokenNode (Convert (arrayCreationExpression.Location), "new".Length), ArrayCreateExpression.Roles.Keyword);
				
				if (arrayCreationExpression.NewType != null)
					result.AddChild ((AstNode)arrayCreationExpression.NewType.Accept (this), ArrayCreateExpression.Roles.ReturnType);
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[0]), 1), ArrayCreateExpression.Roles.LBracket);
				if (arrayCreationExpression.Arguments != null) {
					var commaLocations = LocationsBag.GetLocations (arrayCreationExpression.Arguments);
					for (int i = 0 ;i < arrayCreationExpression.Arguments.Count; i++) {
						result.AddChild ((AstNode)arrayCreationExpression.Arguments[i].Accept (this), ObjectCreateExpression.Roles.Initializer);
						if (commaLocations != null && i > 0)
							result.AddChild (new CSharpTokenNode (Convert (commaLocations [commaLocations.Count - i]), 1), IndexerExpression.Roles.Comma);
					}
				}
				if (location != null)
					result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), ArrayCreateExpression.Roles.RBracket);
				
				if (arrayCreationExpression.Initializers != null && arrayCreationExpression.Initializers.Count != 0) {
					var initLocation = LocationsBag.GetLocations (arrayCreationExpression.Initializers);
					result.AddChild (new CSharpTokenNode (Convert (arrayCreationExpression.Initializers.Location), 1), ArrayCreateExpression.Roles.LBrace);
					var commaLocations = LocationsBag.GetLocations (arrayCreationExpression.Initializers.Elements);
					for (int i = 0; i < arrayCreationExpression.Initializers.Count; i++) {
						result.AddChild ((AstNode)arrayCreationExpression.Initializers[i].Accept (this), ObjectCreateExpression.Roles.Initializer);
						if (commaLocations != null && i > 0) {
							result.AddChild (new CSharpTokenNode (Convert (commaLocations [commaLocations.Count - i]), 1), IndexerExpression.Roles.Comma);
						}
					}
					
					if (initLocation != null)
						result.AddChild (new CSharpTokenNode (Convert (initLocation[initLocation.Count - 1]), 1), ArrayCreateExpression.Roles.RBrace);
				}
				
				return result;
			}
开发者ID:tech-uday-mca,项目名称:monodevelop,代码行数:39,代码来源:CSharpParser.cs


示例20: VisitArrayCreateExpression

 public void VisitArrayCreateExpression(ArrayCreateExpression node)
 {
     NotSupported(node);
 }
开发者ID:evanw,项目名称:minisharp,代码行数:4,代码来源:Lower.cs



注:本文中的ArrayCreateExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ArrayInitializer类代码示例发布时间:2022-05-24
下一篇:
C# ArrayContainer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap