本文整理汇总了C#中ICSharpCode.NRefactory.Ast.CollectionInitializerExpression类的典型用法代码示例。如果您正苦于以下问题:C# CollectionInitializerExpression类的具体用法?C# CollectionInitializerExpression怎么用?C# CollectionInitializerExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CollectionInitializerExpression类属于ICSharpCode.NRefactory.Ast命名空间,在下文中一共展示了CollectionInitializerExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitCollectionInitializerExpression
public override object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data)
{
WriteLine("VisitCollectionInitializerExpression");
return base.VisitCollectionInitializerExpression(collectionInitializerExpression, data);
}
示例2: TrackedVisitCollectionInitializerExpression
public virtual object TrackedVisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
return base.VisitCollectionInitializerExpression(collectionInitializerExpression, data);
}
示例3: ObjectCreateExpression
void ObjectCreateExpression(
//#line 2123 "VBNET.ATG"
out Expression oce) {
//#line 2125 "VBNET.ATG"
TypeReference type = null;
CollectionInitializerExpression initializer = null;
List<Expression> arguments = null;
ArrayList dimensions = null;
oce = null;
Location startLocation = la.Location;
bool canBeNormal; bool canBeReDim;
Expect(162);
if (StartOf(8)) {
NonArrayTypeName(
//#line 2134 "VBNET.ATG"
out type, false);
if (la.kind == 37) {
lexer.NextToken();
NormalOrReDimArgumentList(
//#line 2135 "VBNET.ATG"
out arguments, out canBeNormal, out canBeReDim);
Expect(38);
if (la.kind == 35 ||
//#line 2136 "VBNET.ATG"
la.kind == Tokens.OpenParenthesis) {
if (
//#line 2136 "VBNET.ATG"
la.kind == Tokens.OpenParenthesis) {
ArrayTypeModifiers(
//#line 2137 "VBNET.ATG"
out dimensions);
CollectionInitializer(
//#line 2138 "VBNET.ATG"
out initializer);
} else {
CollectionInitializer(
//#line 2139 "VBNET.ATG"
out initializer);
}
}
//#line 2141 "VBNET.ATG"
if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression();
}
}
//#line 2145 "VBNET.ATG"
if (initializer == null) {
oce = new ObjectCreateExpression(type, arguments);
} else {
if (dimensions == null) dimensions = new ArrayList();
dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0));
type.RankSpecifier = (int[])dimensions.ToArray(typeof(int));
ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer);
ace.Arguments = arguments;
oce = ace;
}
if (la.kind == 126 || la.kind == 233) {
if (la.kind == 233) {
//#line 2160 "VBNET.ATG"
MemberInitializerExpression memberInitializer = null;
Expression anonymousMember = null;
lexer.NextToken();
//#line 2165 "VBNET.ATG"
CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression();
memberInitializers.StartLocation = la.Location;
Expect(35);
if (la.kind == 26 || la.kind == 147) {
MemberInitializer(
//#line 2170 "VBNET.ATG"
out memberInitializer);
//#line 2171 "VBNET.ATG"
memberInitializers.CreateExpressions.Add(memberInitializer);
} else if (StartOf(24)) {
Expr(
//#line 2172 "VBNET.ATG"
out anonymousMember);
//#line 2173 "VBNET.ATG"
memberInitializers.CreateExpressions.Add(anonymousMember);
} else SynErr(270);
while (la.kind == 22) {
lexer.NextToken();
if (la.kind == 26 || la.kind == 147) {
MemberInitializer(
//#line 2177 "VBNET.ATG"
out memberInitializer);
//#line 2178 "VBNET.ATG"
memberInitializers.CreateExpressions.Add(memberInitializer);
} else if (StartOf(24)) {
Expr(
//.........这里部分代码省略.........
示例4: ObjectCreateExpression
void ObjectCreateExpression(
#line 1935 "VBNET.ATG"
out Expression oce) {
#line 1937 "VBNET.ATG"
TypeReference type = null;
Expression initializer = null;
List<Expression> arguments = null;
ArrayList dimensions = null;
oce = null;
bool canBeNormal; bool canBeReDim;
Expect(148);
if (StartOf(7)) {
NonArrayTypeName(
#line 1945 "VBNET.ATG"
out type, false);
if (la.kind == 25) {
lexer.NextToken();
NormalOrReDimArgumentList(
#line 1946 "VBNET.ATG"
out arguments, out canBeNormal, out canBeReDim);
Expect(26);
if (la.kind == 23 ||
#line 1947 "VBNET.ATG"
la.kind == Tokens.OpenParenthesis) {
if (
#line 1947 "VBNET.ATG"
la.kind == Tokens.OpenParenthesis) {
ArrayTypeModifiers(
#line 1948 "VBNET.ATG"
out dimensions);
CollectionInitializer(
#line 1949 "VBNET.ATG"
out initializer);
} else {
CollectionInitializer(
#line 1950 "VBNET.ATG"
out initializer);
}
}
#line 1952 "VBNET.ATG"
if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression();
}
}
#line 1956 "VBNET.ATG"
if (initializer == null) {
oce = new ObjectCreateExpression(type, arguments);
} else {
if (dimensions == null) dimensions = new ArrayList();
dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0));
type.RankSpecifier = (int[])dimensions.ToArray(typeof(int));
ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer as CollectionInitializerExpression);
ace.Arguments = arguments;
oce = ace;
}
if (la.kind == 218) {
#line 1970 "VBNET.ATG"
NamedArgumentExpression memberInitializer = null;
lexer.NextToken();
#line 1974 "VBNET.ATG"
CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression();
memberInitializers.StartLocation = la.Location;
Expect(23);
MemberInitializer(
#line 1978 "VBNET.ATG"
out memberInitializer);
#line 1979 "VBNET.ATG"
memberInitializers.CreateExpressions.Add(memberInitializer);
while (la.kind == 12) {
lexer.NextToken();
MemberInitializer(
#line 1981 "VBNET.ATG"
out memberInitializer);
#line 1982 "VBNET.ATG"
memberInitializers.CreateExpressions.Add(memberInitializer);
}
Expect(24);
#line 1986 "VBNET.ATG"
memberInitializers.EndLocation = t.Location;
if(oce is ObjectCreateExpression)
{
((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers;
}
}
}
示例5: VisitCollectionInitializerExpression
public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
throw new global::System.NotImplementedException("CollectionInitializerExpression");
}
示例6: ObjectCreateExpression
void ObjectCreateExpression(
#line 1860 "VBNET.ATG"
out Expression oce) {
#line 1862 "VBNET.ATG"
TypeReference type = null;
Expression initializer = null;
List<Expression> arguments = null;
ArrayList dimensions = null;
oce = null;
bool canBeNormal; bool canBeReDim;
Expect(127);
NonArrayTypeName(
#line 1869 "VBNET.ATG"
out type, false);
if (la.kind == 24) {
lexer.NextToken();
NormalOrReDimArgumentList(
#line 1870 "VBNET.ATG"
out arguments, out canBeNormal, out canBeReDim);
Expect(25);
if (la.kind == 22 ||
#line 1871 "VBNET.ATG"
la.kind == Tokens.OpenParenthesis) {
if (
#line 1871 "VBNET.ATG"
la.kind == Tokens.OpenParenthesis) {
ArrayTypeModifiers(
#line 1872 "VBNET.ATG"
out dimensions);
CollectionInitializer(
#line 1873 "VBNET.ATG"
out initializer);
} else {
CollectionInitializer(
#line 1874 "VBNET.ATG"
out initializer);
}
}
#line 1876 "VBNET.ATG"
if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression();
}
#line 1879 "VBNET.ATG"
if (type == null) type = new TypeReference("Object"); // fallback type on parser errors
if (initializer == null) {
oce = new ObjectCreateExpression(type, arguments);
} else {
if (dimensions == null) dimensions = new ArrayList();
dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0));
type.RankSpecifier = (int[])dimensions.ToArray(typeof(int));
ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer as CollectionInitializerExpression);
ace.Arguments = arguments;
oce = ace;
}
}
示例7: CollectionInitializer
void CollectionInitializer(
#line 1447 "cs.ATG"
out Expression outExpr) {
#line 1449 "cs.ATG"
Expression expr = null;
CollectionInitializerExpression initializer = new CollectionInitializerExpression();
Expect(16);
#line 1453 "cs.ATG"
initializer.StartLocation = t.Location;
if (StartOf(30)) {
VariableInitializer(
#line 1454 "cs.ATG"
out expr);
#line 1455 "cs.ATG"
SafeAdd(initializer, initializer.CreateExpressions, expr);
while (
#line 1456 "cs.ATG"
NotFinalComma()) {
Expect(14);
VariableInitializer(
#line 1457 "cs.ATG"
out expr);
#line 1458 "cs.ATG"
SafeAdd(initializer, initializer.CreateExpressions, expr);
}
if (la.kind == 14) {
lexer.NextToken();
}
}
Expect(17);
#line 1462 "cs.ATG"
initializer.EndLocation = t.Location; outExpr = initializer;
}
示例8: ArrayCreateExpression
public ArrayCreateExpression(TypeReference createType, CollectionInitializerExpression arrayInitializer) {
CreateType = createType;
ArrayInitializer = arrayInitializer;
arguments = new List<Expression>();
}
示例9: ObjectCreateExpression
public ObjectCreateExpression(TypeReference createType, List<Expression> parameters) {
CreateType = createType;
Parameters = parameters;
objectInitializer = CollectionInitializerExpression.Null;
}
示例10: VisitCollectionInitializerExpression
public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data)
{
Debug.Assert((collectionInitializerExpression != null));
Debug.Assert((collectionInitializerExpression.CreateExpressions != null));
foreach (Expression o in collectionInitializerExpression.CreateExpressions) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
}
return null;
}
示例11: VisitCollectionInitializerExpression
public object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data)
{
throw new NotImplementedException ();
}
示例12: VisitCollectionInitializerExpression
public virtual bool VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object d)
{
if ((collectionInitializerExpression == null)) {
return SetFailure();
}
if ((d == null)) {
return SetFailure();
}
if ((collectionInitializerExpression.CreateExpressions == null)) {
return SetFailure();
}
if(collectionInitializerExpression.GetType() != d.GetType()) {return SetFailure();}
var data = (CollectionInitializerExpression)d;
if (!IsMatch(collectionInitializerExpression, data)) {
return SetFailure();
}
if (collectionInitializerExpression.CreateExpressions.Count == data.CreateExpressions.Count) {
for (int i=0; i<collectionInitializerExpression.CreateExpressions.Count;i++) {
Expression o = collectionInitializerExpression.CreateExpressions[i];
if(o == null){return SetFailure();}
if((bool)o.AcceptVisitor(this, data.CreateExpressions[i]) == false) return SetFailure();
} } else { return SetFailure(); }
return true;
}
示例13: VisitCollectionInitializerExpression
public override object VisitCollectionInitializerExpression (CollectionInitializerExpression collectionInitializerExpression, object data)
{
if (collectionInitializerExpression.CreateExpressions.Count == 0)
return null;
DomReturnType type = null;
IType typeObject = null;
for (int i = 0; i < collectionInitializerExpression.CreateExpressions.Count; i++) {
DomReturnType curType = (DomReturnType)ResolveType (collectionInitializerExpression.CreateExpressions[i]);
// if we found object or we have only one create expression we can stop
if (curType.DecoratedFullName == DomReturnType.Object.DecoratedFullName || collectionInitializerExpression.CreateExpressions.Count == 1) {
type = curType;
break;
}
IType curTypeObject = resolver.Dom.GetType (curType);
if (curTypeObject == null)
continue;
if (type == null || resolver.Dom.GetInheritanceTree (typeObject).Any (t => t.DecoratedFullName == curTypeObject.DecoratedFullName)) {
type = curType;
typeObject = curTypeObject;
}
}
if (type != null)
type.ArrayDimensions++;
return CreateResult (type);
}
示例14: VisitCollectionInitializerExpression
public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
Debug.Assert((collectionInitializerExpression != null));
Debug.Assert((collectionInitializerExpression.CreateExpressions != null));
for (int i = 0; i < collectionInitializerExpression.CreateExpressions.Count; i++) {
Expression o = collectionInitializerExpression.CreateExpressions[i];
Debug.Assert(o != null);
nodeStack.Push(o);
o.AcceptVisitor(this, data);
o = (Expression)nodeStack.Pop();
if (o == null)
collectionInitializerExpression.CreateExpressions.RemoveAt(i--);
else
collectionInitializerExpression.CreateExpressions[i] = o;
}
return null;
}
示例15: CreateAnonymousClass
IType CreateAnonymousClass (CollectionInitializerExpression initializer)
{
DomType result;
if (!anonymousTypes.TryGetValue (initializer, out result)) {
result = new AnonymousType ();
result.SourceProjectDom = resolver.Dom;
foreach (Expression expr in initializer.CreateExpressions) {
var oldPos = resolver.ResolvePosition;
if (!expr.StartLocation.IsEmpty)
resolver.resolvePosition = new DomLocation (expr.StartLocation.Line + resolver.CallingMember.Location.Line, expr.StartLocation.Column);
DomProperty newProperty = new DomProperty (GetAnonymousTypeFieldName (expr), MonoDevelop.Projects.Dom.Modifiers.Public, DomLocation.Empty, DomRegion.Empty, ResolveType (expr));
newProperty.DeclaringType = result;
result.Add (newProperty);
resolver.resolvePosition = oldPos;
}
anonymousTypes[initializer] = result;
}
return result;
}