本文整理汇总了C#中ICSharpCode.NRefactory.Ast.ArrayCreateExpression类的典型用法代码示例。如果您正苦于以下问题:C# ArrayCreateExpression类的具体用法?C# ArrayCreateExpression怎么用?C# ArrayCreateExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ArrayCreateExpression类属于ICSharpCode.NRefactory.Ast命名空间,在下文中一共展示了ArrayCreateExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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:SergeTruth,项目名称:OxyChart,代码行数:7,代码来源:ToVBNetConvertVisitor.cs
示例2: VisitArrayCreateExpression
public override object VisitArrayCreateExpression(ArrayCreateExpression array, object data)
{
for(int i = 0; i < array.Arguments.Count; i++) {
array.Arguments[i] = Deparenthesize(array.Arguments[i]);
}
return base.VisitArrayCreateExpression(array, data);
}
开发者ID:almazik,项目名称:ILSpy,代码行数:7,代码来源:RemoveParenthesis.cs
示例3: VisitArrayCreateExpression
public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
{
if (arrayCreateExpression.IsImplicitlyTyped) {
return CreateResolveResult(arrayCreateExpression.ArrayInitializer);
} else {
return CreateTypeResolveResult(TypeVisitor.CreateReturnType(arrayCreateExpression.CreateType, resolver));
}
}
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:8,代码来源:ResolveVisitor.cs
示例4: VisitArrayCreateExpression
public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
{
arrayCreateExpression.CreateType.Parent = arrayCreateExpression;
arrayCreateExpression.ArrayInitializer.Parent = arrayCreateExpression;
foreach (INode argument in arrayCreateExpression.Arguments)
argument.Parent = arrayCreateExpression;
return base.VisitArrayCreateExpression(arrayCreateExpression, data);
}
开发者ID:sourcewarehouse,项目名称:janett,代码行数:9,代码来源:ParentVisitor.cs
示例5: VisitArrayCreateExpression
public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
{
if (arrayCreateExpression.ArrayInitializer == null) {
return new CodeArrayCreateExpression(ConvType(arrayCreateExpression.CreateType),
arrayCreateExpression.Arguments[0].AcceptVisitor(this, data) as CodeExpression);
}
return new CodeArrayCreateExpression(ConvType(arrayCreateExpression.CreateType),
GetExpressionList(arrayCreateExpression.ArrayInitializer.CreateExpressions));
}
开发者ID:almazik,项目名称:ILSpy,代码行数:9,代码来源:CodeDOMOutputVisitor.cs
示例6: 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);
}
if (arrayCreateExpression.ArrayInitializer.CreateExpressions.Count == 0) {
arrayCreateExpression.ArrayInitializer = null;
}
return base.VisitArrayCreateExpression(arrayCreateExpression, data);
}
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:10,代码来源:VBNetConstructsConvertVisitor.cs
示例7: GetArrayInitStatements
private List<Statement> GetArrayInitStatements(ArrayCreateExpression arrayCreateExpression, string variableName, List<Expression> initializerList)
{
List<Statement> list = new List<Statement>();
for (int idx = 0; idx < initializerList.Count; idx++)
{
AssignmentExpression assignment = InitArrayStatement(arrayCreateExpression, variableName, ((CollectionInitializerExpression) initializerList[idx]).CreateExpressions, idx);
ExpressionStatement expressionStatement = new ExpressionStatement(assignment);
list.Add(expressionStatement);
}
return list;
}
开发者ID:sourcewarehouse,项目名称:janett,代码行数:11,代码来源:ArrayInitializerTransformer.cs
示例8: 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:xuchuansheng,项目名称:GenXSource,代码行数:12,代码来源:AbstractASTVisitor.cs
示例9: TrackedVisitArrayCreateExpression
public override object TrackedVisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
{
string variableName = GetVariableName(arrayCreateExpression);
List<Expression> initializerList = arrayCreateExpression.ArrayInitializer.CreateExpressions;
Expression replacedExpression = arrayCreateExpression;
if (initializerList.Count > 0 && initializerList[0] is CollectionInitializerExpression && data is InsertionBlockData)
{
ArrayCreateExpression replacedArrayCreateExpression = arrayCreateExpression;
replacedArrayCreateExpression.ArrayInitializer = null;
replacedArrayCreateExpression.Arguments.Add(new PrimitiveExpression(initializerList.Count, initializerList.Count.ToString()));
string arrayTypeName = arrayCreateExpression.CreateType.Type + "s";
Position position = Position.After;
if (variableName == null)
{
variableName = arrayTypeName;
position = Position.Before;
}
List<Statement> initStatements = GetArrayInitStatements(replacedArrayCreateExpression, variableName, initializerList);
InsertionBlockData insertionBlockData = (InsertionBlockData) data;
insertionBlockData.Block = (BlockStatement) AstUtil.GetParentOfType(replacedArrayCreateExpression, typeof(BlockStatement));
insertionBlockData.BlockChildIndex = GetBlockChildIndex(replacedArrayCreateExpression, position);
insertionBlockData.Statements = initStatements;
if (variableName == arrayTypeName)
{
IdentifierExpression identifierExpression = new IdentifierExpression(variableName);
replacedExpression = identifierExpression;
VariableDeclaration variableDeclaration = new VariableDeclaration(variableName, arrayCreateExpression);
LocalVariableDeclaration localVariable = new LocalVariableDeclaration(variableDeclaration);
localVariable.TypeReference = arrayCreateExpression.CreateType;
initStatements.Insert(0, localVariable);
}
ReplaceCurrentNode(replacedExpression);
}
return base.TrackedVisitArrayCreateExpression(arrayCreateExpression, data);
}
开发者ID:sourcewarehouse,项目名称:janett,代码行数:42,代码来源:ArrayInitializerTransformer.cs
示例10: 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));
nodeStack.Push(arrayCreateExpression.CreateType);
arrayCreateExpression.CreateType.AcceptVisitor(this, data);
arrayCreateExpression.CreateType = ((TypeReference)(nodeStack.Pop()));
for (int i = 0; i < arrayCreateExpression.Arguments.Count; i++) {
Expression o = arrayCreateExpression.Arguments[i];
Debug.Assert(o != null);
nodeStack.Push(o);
o.AcceptVisitor(this, data);
o = (Expression)nodeStack.Pop();
if (o == null)
arrayCreateExpression.Arguments.RemoveAt(i--);
else
arrayCreateExpression.Arguments[i] = o;
}
nodeStack.Push(arrayCreateExpression.ArrayInitializer);
arrayCreateExpression.ArrayInitializer.AcceptVisitor(this, data);
arrayCreateExpression.ArrayInitializer = ((CollectionInitializerExpression)(nodeStack.Pop()));
return null;
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:24,代码来源:AbstractAstTransformer.cs
示例11: 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;
}
}
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:97,代码来源:Parser.cs
示例12: VisitReDimStatement
public override object VisitReDimStatement(ReDimStatement reDimStatement, object data)
{
base.VisitReDimStatement(reDimStatement, data);
if (resolver.CompilationUnit == null)
return null;
if (reDimStatement.ReDimClauses.Count != 1)
return null;
if (reDimStatement.IsPreserve) {
if (reDimStatement.ReDimClauses[0].Arguments.Count > 1) {
// multidimensional Redim Preserve
// replace with:
// MyArray = (int[,])Microsoft.VisualBasic.CompilerServices.Utils.CopyArray(MyArray, new int[dim1+1, dim2+1]);
ResolveResult rr = Resolve(reDimStatement.ReDimClauses[0].TargetObject);
if (rr != null && rr.ResolvedType != null && rr.ResolvedType.IsArrayReturnType) {
ArrayCreateExpression ace = new ArrayCreateExpression(ConvertType(rr.ResolvedType));
foreach (Expression arg in reDimStatement.ReDimClauses[0].Arguments) {
ace.Arguments.Add(Expression.AddInteger(arg, 1));
}
ReplaceCurrentNode(new ExpressionStatement(
new AssignmentExpression(
reDimStatement.ReDimClauses[0].TargetObject,
AssignmentOperatorType.Assign,
new CastExpression(
ace.CreateType,
new InvocationExpression(
MakeFieldReferenceExpression("Microsoft.VisualBasic.CompilerServices.Utils.CopyArray"),
new List<Expression> {
reDimStatement.ReDimClauses[0].TargetObject,
ace
}
),
CastType.Cast
)
)));
}
}
} else {
// replace with array create expression
ResolveResult rr = Resolve(reDimStatement.ReDimClauses[0].TargetObject);
if (rr != null && rr.ResolvedType != null && rr.ResolvedType.IsArrayReturnType) {
ArrayCreateExpression ace = new ArrayCreateExpression(ConvertType(rr.ResolvedType));
foreach (Expression arg in reDimStatement.ReDimClauses[0].Arguments) {
ace.Arguments.Add(Expression.AddInteger(arg, 1));
}
ReplaceCurrentNode(new ExpressionStatement(
new AssignmentExpression(reDimStatement.ReDimClauses[0].TargetObject, AssignmentOperatorType.Assign, ace)));
}
}
return null;
}
开发者ID:SiGhTfOrbACQ,项目名称:O2.Platform.Projects,代码行数:57,代码来源:VBNetToCSharpConvertVisitor.cs
示例13: NewExpression
void NewExpression(
#line 2065 "cs.ATG"
out Expression pexpr) {
#line 2066 "cs.ATG"
pexpr = null;
List<Expression> parameters = new List<Expression>();
TypeReference type = null;
Expression expr;
Expect(89);
if (StartOf(10)) {
NonArrayType(
#line 2073 "cs.ATG"
out type);
}
if (la.kind == 16 || la.kind == 20) {
if (la.kind == 20) {
#line 2079 "cs.ATG"
ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters);
lexer.NextToken();
#line 2080 "cs.ATG"
if (type == null) Error("Cannot use an anonymous type with arguments for the constructor");
if (StartOf(25)) {
Argument(
#line 2081 "cs.ATG"
out expr);
#line 2081 "cs.ATG"
SafeAdd(oce, parameters, expr);
while (la.kind == 14) {
lexer.NextToken();
Argument(
#line 2082 "cs.ATG"
out expr);
#line 2082 "cs.ATG"
SafeAdd(oce, parameters, expr);
}
}
Expect(21);
#line 2084 "cs.ATG"
pexpr = oce;
if (la.kind == 16) {
CollectionOrObjectInitializer(
#line 2085 "cs.ATG"
out expr);
#line 2085 "cs.ATG"
oce.ObjectInitializer = (CollectionInitializerExpression)expr;
}
} else {
#line 2086 "cs.ATG"
ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters);
CollectionOrObjectInitializer(
#line 2087 "cs.ATG"
out expr);
#line 2087 "cs.ATG"
oce.ObjectInitializer = (CollectionInitializerExpression)expr;
#line 2088 "cs.ATG"
pexpr = oce;
}
} else if (la.kind == 18) {
lexer.NextToken();
#line 2093 "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 2100 "cs.ATG"
dims += 1;
}
Expect(19);
#line 2101 "cs.ATG"
ranks.Add(dims); dims = 0;
while (la.kind == 18) {
lexer.NextToken();
while (la.kind == 14) {
lexer.NextToken();
#line 2102 "cs.ATG"
++dims;
}
Expect(19);
#line 2102 "cs.ATG"
//.........这里部分代码省略.........
开发者ID:pluraldj,项目名称:SharpDevelop,代码行数:101,代码来源:Parser.cs
示例14: VisitArrayCreateExpression
public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
{
if (arrayCreateExpression.IsImplicitlyTyped) {
// Console.WriteLine (arrayCreateExpression.ArrayInitializer);
return Resolve (arrayCreateExpression.ArrayInitializer);
}
return CreateResult (arrayCreateExpression.CreateType);
}
开发者ID:Ein,项目名称:monodevelop,代码行数:8,代码来源:ResolveVisitor.cs
示例15: 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;
}
}
开发者ID:almazik,项目名称:ILSpy,代码行数:59,代码来源:Parser.cs
示例16: InitArrayStatement
private AssignmentExpression InitArrayStatement(ArrayCreateExpression arrayCreateExpression, string variableName, List<Expression> creatExpressions, int index)
{
IdentifierExpression identifierExpression = new IdentifierExpression(variableName);
List<Expression> indexes = new List<Expression>();
indexes.Add(new PrimitiveExpression(index, index.ToString()));
IndexerExpression left = new IndexerExpression(identifierExpression, indexes);
string createType = arrayCreateExpression.CreateType.Type;
ArrayCreateExpression right = new ArrayCreateExpression(new TypeReference(createType, new int[1]));
right.ArrayInitializer = new CollectionInitializerExpression(creatExpressions);
return new AssignmentExpression(left, AssignmentOperatorType.Assign, right);
}
开发者ID:sourcewarehouse,项目名称:janett,代码行数:11,代码来源:ArrayInitializerTransformer.cs
示例17: GetVariableName
private string GetVariableName(ArrayCreateExpression arrayCreateExpression)
{
if (arrayCreateExpression.Parent is AssignmentExpression)
{
AssignmentExpression assignmentExpression = (AssignmentExpression) arrayCreateExpression.Parent;
Expression left = assignmentExpression.Left;
if (left is IdentifierExpression)
return ((IdentifierExpression) left).Identifier;
else
return null;
}
else if (arrayCreateExpression.Parent is VariableDeclaration)
{
VariableDeclaration variableDeclaration = (VariableDeclaration) arrayCreateExpression.Parent;
return variableDeclaration.Name;
}
else
return null;
}
开发者ID:sourcewarehouse,项目名称:janett,代码行数:20,代码来源:ArrayInitializerTransformer.cs
示例18: VisitArrayCreateExpression
public virtual bool VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object d)
{
if ((arrayCreateExpression == null)) {
return SetFailure();
}
if ((d == null)) {
return SetFailure();
}
if ((arrayCreateExpression.CreateType == null)) {
return SetFailure();
}
if ((arrayCreateExpression.Arguments == null)) {
return SetFailure();
}
if ((arrayCreateExpression.ArrayInitializer == null)) {
return SetFailure();
}
if(arrayCreateExpression.GetType() != d.GetType()) {return SetFailure();}
var data = (ArrayCreateExpression)d;
if (!IsMatch(arrayCreateExpression, data)) {
return SetFailure();
}
arrayCreateExpression.CreateType.AcceptVisitor(this, data.CreateType);
if (arrayCreateExpression.Arguments.Count == data.Arguments.Count) {
for (int i=0; i<arrayCreateExpression.Arguments.Count;i++) {
Expression o = arrayCreateExpression.Arguments[i];
if(o == null){return SetFailure();}
if((bool)o.AcceptVisitor(this, data.Arguments[i]) == false) return SetFailure();
} } else { return SetFailure(); }
return arrayCreateExpression.ArrayInitializer.AcceptVisitor(this, data.ArrayInitializer);
}
开发者ID:jbuedel,项目名称:AgentRalphPlugin,代码行数:31,代码来源:AstComparisonVisitor.Generated.cs
示例19: VariableDeclaratorPartAfterIdentifier
void VariableDeclaratorPartAfterIdentifier(
#line 1341 "VBNET.ATG"
List<VariableDeclaration> fieldDeclaration, string name) {
#line 1343 "VBNET.ATG"
Expression expr = null;
TypeReference type = null;
ArrayList rank = null;
List<Expression> dimension = null;
if (
#line 1348 "VBNET.ATG"
IsSize() && !IsDims()) {
ArrayInitializationModifier(
#line 1348 "VBNET.ATG"
out dimension);
}
if (
#line 1349 "VBNET.ATG"
IsDims()) {
ArrayNameModifier(
#line 1349 "VBNET.ATG"
out rank);
}
if (
#line 1351 "VBNET.ATG"
IsObjectCreation()) {
Expect(48);
ObjectCreateExpression(
#line 1351 "VBNET.ATG"
out expr);
#line 1353 "VBNET.ATG"
if (expr is ObjectCreateExpression) {
type = ((ObjectCreateExpression)expr).CreateType;
} else {
type = ((ArrayCreateExpression)expr).CreateType;
}
} else if (StartOf(21)) {
if (la.kind == 48) {
lexer.NextToken();
TypeName(
#line 1360 "VBNET.ATG"
out type);
#line 1362 "VBNET.ATG"
if (type != null) {
for (int i = fieldDeclaration.Count - 1; i >= 0; i--) {
VariableDeclaration vd = fieldDeclaration[i];
if (vd.TypeReference.Type.Length > 0) break;
TypeReference newType = type.Clone();
newType.RankSpecifier = vd.TypeReference.RankSpecifier;
vd.TypeReference = newType;
}
}
}
#line 1374 "VBNET.ATG"
if (type == null && (dimension != null || rank != null)) {
type = new TypeReference("");
}
if (dimension != null) {
if(type.RankSpecifier != null) {
Error("array rank only allowed one time");
} else {
if (rank == null) {
type.RankSpecifier = new int[] { dimension.Count - 1 };
} else {
rank.Insert(0, dimension.Count - 1);
type.RankSpecifier = (int[])rank.ToArray(typeof(int));
}
expr = new ArrayCreateExpression(type, dimension);
}
} else if (rank != null) {
if(type.RankSpecifier != null) {
Error("array rank only allowed one time");
} else {
type.RankSpecifier = (int[])rank.ToArray(typeof(int));
}
}
if (la.kind == 11) {
lexer.NextToken();
VariableInitializer(
#line 1397 "VBNET.ATG"
out expr);
}
} else SynErr(232);
#line 1399 "VBNET.ATG"
fieldDeclaration.Add(new VariableDeclaration(name, expr, type));
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:94,代码来源:Parser.cs
示例20: VariableDeclaratorPartAfterIdentifier
void VariableDeclaratorPartAfterIdentifier(
//#line 1463 "VBNET.ATG"
List<VariableDeclaration> fieldDeclaration, string name) {
//#line 1465 "VBNET.ATG"
Expression expr = null;
TypeReference type = null;
ArrayList rank = null;
List<Expression> dimension = null;
Location startLocation = t.Location;
if (
//#line 1471 "VBNET.ATG"
IsSize() && !IsDims()) {
ArrayInitializationModifier(
//#line 1471 "VBNET.ATG"
out dimension);
}
if (
//#line 1472 "VBNET.ATG"
IsDims()) {
ArrayNameModifier(
//#line 1472 "VBNET.ATG"
out rank);
}
if (
//#line 1474 "VBNET.ATG"
IsObjectCreation()) {
Expect(63);
ObjectCreateExpression(
//#line 1474 "VBNET.ATG"
out expr);
//#line 1476 "VBNET.ATG"
if (expr is ObjectCreateExpression) {
type = ((ObjectCreateExpression)expr).CreateType.Clone();
} else {
type = ((ArrayCreateExpression)expr).CreateType.Clone();
}
} else if (StartOf(23)) {
if (la.kind == 63) {
lexer.NextToken();
TypeName(
//#line 1483 "VBNET.ATG"
out type);
//#line 1485 "VBNET.ATG"
if (type != null) {
for (int i = fieldDeclaration.Count - 1; i >= 0; i--) {
VariableDeclaration vd = fieldDeclaration[i];
if (vd.TypeReference.Type.Length > 0) break;
TypeReference newType = type.Clone();
newType.RankSpecifier = vd.TypeReference.RankSpecifier;
vd.TypeReference = newType;
}
}
}
//#line 1497 "VBNET.ATG"
if (type == null && (dimension != null || rank != null)) {
type = new TypeReference("");
}
if (dimension != null) {
if(type.RankSpecifier != null) {
Error("array rank only allowed one time");
} else {
if (rank == null) {
type.RankSpecifier = new int[] { dimension.Count - 1 };
} else {
rank.Insert(0, dimension.Count - 1);
type.RankSpecifier = (int[])rank.ToArray(typeof(int));
}
expr = new ArrayCreateExpression(type.Clone(), dimension);
}
} else if (rank != null) {
if(type.RankSpecifier != null) {
Error("array rank only allowed one time");
} else {
type.RankSpecifier = (int[])rank.ToArray(typeof(int));
}
}
if (la.kind == 20) {
lexer.NextToken();
Expr(
//#line 1520 "VBNET.ATG"
out expr);
}
} else SynErr(269);
//#line 1523 "VBNET.ATG"
VariableDeclaration varDecl = new VariableDeclaration(name, expr, type);
varDecl.StartLocation = startLocation;
varDecl.EndLocation = t.Location;
fieldDeclaration.Add(varDecl);
}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:99,代码来源:Parser.cs
注:本文中的ICSharpCode.NRefactory.Ast.ArrayCreateExpression类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论