本文整理汇总了C#中ICSharpCode.NRefactory.Ast.AssignmentExpression类的典型用法代码示例。如果您正苦于以下问题:C# AssignmentExpression类的具体用法?C# AssignmentExpression怎么用?C# AssignmentExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssignmentExpression类属于ICSharpCode.NRefactory.Ast命名空间,在下文中一共展示了AssignmentExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VisitAssignmentExpression
public virtual object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
Debug.Assert((assignmentExpression != null));
Debug.Assert((assignmentExpression.Left != null));
Debug.Assert((assignmentExpression.Right != null));
assignmentExpression.Left.AcceptVisitor(this, data);
return assignmentExpression.Right.AcceptVisitor(this, data);
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:AbstractASTVisitor.cs
示例2: VisitAssignmentExpression
public override object VisitAssignmentExpression(AssignmentExpression assignment, object data)
{
IdentifierExpression ident = assignment.Left as IdentifierExpression;
BinaryOperatorExpression binary = assignment.Right as BinaryOperatorExpression;
if (ident != null && binary != null) {
IdentifierExpression binaryLeft = binary.Left as IdentifierExpression;
if (binaryLeft != null &&
binaryLeft.Identifier == ident.Identifier) {
if (binary.Right is PrimitiveExpression &&
1.Equals((binary.Right as PrimitiveExpression).Value)) {
if (binary.Op == BinaryOperatorType.Add) {
ReplaceCurrentNode(new UnaryOperatorExpression(ident, UnaryOperatorType.PostIncrement));
}
if (binary.Op == BinaryOperatorType.Subtract) {
ReplaceCurrentNode(new UnaryOperatorExpression(ident, UnaryOperatorType.PostDecrement));
}
} else {
if (binary.Op == BinaryOperatorType.Add) {
ReplaceCurrentNode(new AssignmentExpression(ident, AssignmentOperatorType.Add, binary.Right));
}
if (binary.Op == BinaryOperatorType.Subtract) {
ReplaceCurrentNode(new AssignmentExpression(ident, AssignmentOperatorType.Subtract, binary.Right));
}
}
return null;
}
}
return null;
}
开发者ID:almazik,项目名称:ILSpy,代码行数:29,代码来源:Idioms.cs
示例3: VisitAssignmentExpression
public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
{
tw.WriteStartElement("AssignmentExpression");
tw.WriteAttributeString("Op", assignmentExpression.Op.ToString());
base.VisitAssignmentExpression(assignmentExpression, data);
tw.WriteEndElement();
return null;
}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:8,代码来源:AstXmlOutputVisitor.cs
示例4: VisitAssignmentExpression
public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
{
var primitiveExpression = assignmentExpression.Right as PrimitiveExpression;
if (primitiveExpression != null)
{
}
return base.VisitAssignmentExpression(assignmentExpression, data);
}
开发者ID:timdams,项目名称:strokes,代码行数:9,代码来源:AchievementVisitor.cs
示例5: VisitAssignmentExpression
public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
{
if (!hasAssignment) {
if (assignmentExpression.Left is IdentifierExpression) {
hasAssignment = (((IdentifierExpression)assignmentExpression.Left).Identifier == name) &&
(assignmentExpression.StartLocation >= startRange && assignmentExpression.EndLocation <= endRange);
}
}
return base.VisitAssignmentExpression(assignmentExpression, data);
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:10,代码来源:HasAssignmentsVisitor.cs
示例6: VisitTypeDeclaration
public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
{
base.VisitTypeDeclaration(typeDeclaration, data); // visit methods
typeDeclaration.Attributes.Clear();
typeDeclaration.BaseTypes.Clear();
// add constructor accepting the wrapped object and the field holding the object
FieldDeclaration fd = new FieldDeclaration(null, // no attributes
new TypeReference(typeDeclaration.Name),
Modifiers.Private);
fd.Fields.Add(new VariableDeclaration("wrappedObject"));
typeDeclaration.AddChild(fd);
typeDeclaration.Name += "Wrapper";
if (typeDeclaration.Type == ClassType.Interface) {
typeDeclaration.Type = ClassType.Class;
typeDeclaration.Name = typeDeclaration.Name.Substring(1);
}
ConstructorDeclaration cd = new ConstructorDeclaration(typeDeclaration.Name,
Modifiers.Public,
new List<ParameterDeclarationExpression>(),
null);
cd.Parameters.Add(new ParameterDeclarationExpression(fd.TypeReference,
"wrappedObject"));
// this.wrappedObject = wrappedObject;
Expression fieldReference = new MemberReferenceExpression(new ThisReferenceExpression(),
"wrappedObject");
Expression assignment = new AssignmentExpression(fieldReference,
AssignmentOperatorType.Assign,
new IdentifierExpression("wrappedObject"));
cd.Body = new BlockStatement();
cd.Body.AddChild(new ExpressionStatement(assignment));
typeDeclaration.AddChild(cd);
for (int i = 0; i < typeDeclaration.Children.Count; i++) {
object child = typeDeclaration.Children[i];
if (child is MethodDeclaration) {
MethodDeclaration method = (MethodDeclaration)child;
if (method.Parameters.Count == 0 &&
(method.Name.StartsWith("Is") || method.Name.StartsWith("Get")))
{
// replace the method with a property
PropertyDeclaration prop = new PropertyDeclaration(method.Modifier,
method.Attributes,
method.Name,
null);
prop.TypeReference = method.TypeReference;
prop.GetRegion = new PropertyGetRegion(method.Body, null);
typeDeclaration.Children[i] = prop;
}
}
}
return null;
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:55,代码来源:WrapperGeneratorVisitor.cs
示例7: VisitAssignmentExpression
public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
{
// Calculate right first so that left does not get invalidated by its calculation
Value right = ((Value)assignmentExpression.Right.AcceptVisitor(this, null)).GetPermanentReference();
Value left = (Value)assignmentExpression.Left.AcceptVisitor(this, null);
if (!left.IsReference && left.Type.FullName != right.Type.FullName) {
throw new GetValueException(string.Format("Type {0} expected, {1} seen", left.Type.FullName, right.Type.FullName));
}
left.SetValue(right);
return right;
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:11,代码来源:EvaluateAstVisitor.cs
示例8: GetVariableNameFromAssignment
string GetVariableNameFromAssignment(AssignmentExpression assignment)
{
if (assignment == null)
return null;
var identifier = assignment.Left as IdentifierExpression;
if (identifier == null)
return null;
if (assignment.Right is ObjectCreateExpression)
// // don't offer action for "a = new Foo()"
return null;
return identifier.Identifier;
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:12,代码来源:CheckAssignmentCache.cs
示例9: GetVariableNameFromAssignment
string GetVariableNameFromAssignment(AssignmentExpression assignment)
{
if (assignment == null)
return null;
var identifier = assignment.Left as IdentifierExpression;
if (identifier == null)
return null;
if ((!ExpressionCanBeNull(assignment.Right)) || ExpressionIsValueType(assignment.Right))
// don't offer action where it makes no sense
return null;
return identifier.Identifier;
}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:12,代码来源:CheckAssignmentCache.cs
示例10: VisitAssignmentExpression
public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
{
base.VisitAssignmentExpression(assignmentExpression, data);
if (assignmentExpression.Op == AssignmentOperatorType.Assign && !(assignmentExpression.Parent is ExpressionStatement)) {
AddInlineAssignHelper();
ReplaceCurrentNode(
new InvocationExpression(
new IdentifierExpression("InlineAssignHelper"),
new List<Expression>().add(assignmentExpression.Left)
.add(assignmentExpression.Right)));
}
return null;
}
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:13,代码来源:ToVBNetConvertVisitor.cs
示例11: GenerateCode
public override void GenerateCode(List<AbstractNode> nodes, IList items)
{
ConstructorDeclaration ctor = new ConstructorDeclaration(currentClass.Name, Modifiers.Public, null, null);
ctor.Body = new BlockStatement();
foreach (FieldWrapper w in items) {
string parameterName = codeGen.GetParameterName(w.Field.Name);
ctor.Parameters.Add(new ParameterDeclarationExpression(ConvertType(w.Field.ReturnType),
parameterName));
Expression left = new MemberReferenceExpression(new ThisReferenceExpression(), w.Field.Name);
Expression right = new IdentifierExpression(parameterName);
Expression expr = new AssignmentExpression(left, AssignmentOperatorType.Assign, right);
ctor.Body.AddChild(new ExpressionStatement(expr));
}
nodes.Add(ctor);
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:15,代码来源:ConstructorCodeGenerator.cs
示例12: VisitAssignmentExpression
public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
{
if(assignmentExpression.Right is PrimitiveExpression)
{
PrimitiveExpression prim = (PrimitiveExpression) assignmentExpression.Right;
int number;
if (int.TryParse(prim.StringValue, out number))
{
if (number == 666)
UnlockWith(assignmentExpression);
}
}
return base.VisitAssignmentExpression(assignmentExpression, data);
}
开发者ID:timdams,项目名称:strokes,代码行数:15,代码来源:BeastNumberAchievement.cs
示例13: TrackedVisitFieldDeclaration
public override object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
{
VariableDeclaration field = (VariableDeclaration) fieldDeclaration.Fields[0];
TypeDeclaration typeDeclaration = (TypeDeclaration) fieldDeclaration.Parent;
NodeTypeExistenceVisitor nodeTypeExistenceVisitor = new NodeTypeExistenceVisitor(typeof(ThisReferenceExpression));
NodeTypeExistenceVisitor indexerNodeExistenceVisitor = new NodeTypeExistenceVisitor(typeof(IndexerExpression));
field.Initializer.AcceptVisitor(nodeTypeExistenceVisitor, null);
field.Initializer.AcceptVisitor(indexerNodeExistenceVisitor, null);
if (field.Initializer != null && (field.Initializer is InvocationExpression || IsArrayCreation(fieldDeclaration) || nodeTypeExistenceVisitor.Contains || indexerNodeExistenceVisitor.Contains)
&& !AstUtil.ContainsModifier(fieldDeclaration, Modifiers.Static))
{
IList constructors = AstUtil.GetChildrenWithType(typeDeclaration, typeof(ConstructorDeclaration));
IdentifierExpression left = new IdentifierExpression(field.Name);
Expression right = field.Initializer;
AssignmentExpression assignmentExpression = new AssignmentExpression(left, AssignmentOperatorType.Assign, right);
ExpressionStatement ExpressionStatement = new ExpressionStatement(assignmentExpression);
field.Initializer = null;
ConstructorDeclaration constructorDeclaration = null;
ExpressionStatement.Parent = constructorDeclaration;
foreach (ConstructorDeclaration consDec in constructors)
{
if (!AstUtil.ContainsModifier(consDec, Modifiers.Static))
{
if (consDec.Parameters.Count == 0)
{
constructorDeclaration = consDec;
constructorDeclaration.Body.Children.Add(ExpressionStatement);
constructorDeclaration.Parent = typeDeclaration;
return base.TrackedVisitFieldDeclaration(fieldDeclaration, data);
}
else
{
consDec.ConstructorInitializer = new ConstructorInitializer();
consDec.ConstructorInitializer.ConstructorInitializerType = ConstructorInitializerType.This;
}
}
}
constructorDeclaration = GetConstructor(ExpressionStatement, typeDeclaration);
constructorDeclaration.Parent = typeDeclaration;
return base.TrackedVisitFieldDeclaration(fieldDeclaration, data);
}
return base.TrackedVisitFieldDeclaration(fieldDeclaration, data);
}
开发者ID:sourcewarehouse,项目名称:janett,代码行数:46,代码来源:FieldInitializerTransformer.cs
示例14: VisitAssignmentExpression
public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
{
base.VisitAssignmentExpression(assignmentExpression, data);
if (vbMyFormsClass != null) {
TypeResolveResult trr = Resolve(assignmentExpression.Right) as TypeResolveResult;
if (trr != null && trr.ResolvedClass != null) {
foreach (IProperty p in vbMyFormsClass.Properties) {
if (p.ReturnType.FullyQualifiedName == trr.ResolvedClass.FullyQualifiedName) {
assignmentExpression.Right = MakeFieldReferenceExpression("My.MyProject.Forms." + p.Name);
break;
}
}
}
}
return null;
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:18,代码来源:VBNetToCSharpConvertVisitorWithMyFormsSupport.cs
示例15: VisitAssignmentExpression
public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
{
if (assignmentExpression.Left is MemberReferenceExpression)
{
MemberReferenceExpression left = (MemberReferenceExpression)assignmentExpression.Left;
if (eventVars.Contains(left.MemberName)) // I don't check against correct type yet
{
if (assignmentExpression.Right is ObjectCreateExpression)
{
ObjectCreateExpression right = (ObjectCreateExpression)assignmentExpression.Right;
if (right.CreateType.Type.Contains("EventHandler") && assignmentExpression.Op == AssignmentOperatorType.Add)
UnlockWith(assignmentExpression); // Only works when using the implicit += new SomeEventHandler() syntax
}
}
}
return base.VisitAssignmentExpression(assignmentExpression, data);
}
开发者ID:timdams,项目名称:strokes,代码行数:18,代码来源:SubscribeToEventAchievement.cs
示例16: TrackedVisitAssignmentExpression
public override object TrackedVisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
{
if (assignmentExpression.Right is PrimitiveExpression)
{
PrimitiveExpression pe = (PrimitiveExpression) assignmentExpression.Right;
if (pe.Value == null)
{
TypeReference leftType = GetExpressionType(assignmentExpression.Left);
if (leftType != null && (leftType.RankSpecifier == null || leftType.RankSpecifier.Length == 0))
{
string fullName = GetFullName(leftType);
if (types.Contains(fullName))
{
Expression minValue = (Expression) values[fullName];
assignmentExpression.Right = minValue;
minValue.Parent = assignmentExpression;
}
}
}
}
return base.TrackedVisitAssignmentExpression(assignmentExpression, data);
}
开发者ID:sourcewarehouse,项目名称:janett,代码行数:22,代码来源:NullableValueTypeTransformer.cs
示例17: TrackedVisitBinaryOperatorExpression
public override object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
{
if (binaryOperatorExpression.Op == BinaryOperatorType.UnsignedShiftRight)
{
binaryOperatorExpression.Op = BinaryOperatorType.ShiftRight;
CastExpression castExpression = GetCastExpression(binaryOperatorExpression);
ReplaceCurrentNode(castExpression);
}
else if (binaryOperatorExpression.Op == BinaryOperatorType.UnsignedShiftRightAssign)
{
Expression left = binaryOperatorExpression.Left;
Expression right = new BinaryOperatorExpression(left, BinaryOperatorType.ShiftRight, binaryOperatorExpression.Right);
right.Parent = binaryOperatorExpression.Parent;
CastExpression castExpression = GetCastExpression((BinaryOperatorExpression) right);
right.Parent = castExpression;
AssignmentExpression assignment = new AssignmentExpression(left, AssignmentOperatorType.Assign, castExpression);
assignment.Parent = binaryOperatorExpression.Parent;
ReplaceCurrentNode(assignment);
}
return base.TrackedVisitBinaryOperatorExpression(binaryOperatorExpression, data);
}
开发者ID:sourcewarehouse,项目名称:janett,代码行数:22,代码来源:UnsignedShiftTransformer.cs
示例18: EmbeddedStatement
//.........这里部分代码省略.........
statement = goToStatement;
} else if (la.kind == 194) {
//#line 3319 "VBNET.ATG"
ResumeStatement resumeStatement = null;
ResumeStatement(
//#line 3320 "VBNET.ATG"
out resumeStatement);
//#line 3320 "VBNET.ATG"
statement = resumeStatement;
} else if (StartOf(44)) {
//#line 3323 "VBNET.ATG"
Expression val = null;
AssignmentOperatorType op;
Location startLoc = la.Location;
bool mustBeAssignment = la.kind == Tokens.Plus || la.kind == Tokens.Minus ||
la.kind == Tokens.Not || la.kind == Tokens.Times;
SimpleExpr(
//#line 3330 "VBNET.ATG"
out expr);
if (StartOf(46)) {
AssignmentOperator(
//#line 3332 "VBNET.ATG"
out op);
Expr(
//#line 3332 "VBNET.ATG"
out val);
//#line 3334 "VBNET.ATG"
expr = new AssignmentExpression(expr, op, val);
expr.StartLocation = startLoc;
expr.EndLocation = t.EndLocation;
} else if (StartOf(47)) {
//#line 3338 "VBNET.ATG"
if (mustBeAssignment) Error("error in assignment.");
} else SynErr(302);
//#line 3341 "VBNET.ATG"
// a field reference expression that stands alone is a
// invocation expression without parantheses and arguments
if(expr is MemberReferenceExpression || expr is IdentifierExpression) {
Location endLocation = expr.EndLocation;
expr = new InvocationExpression(expr);
expr.StartLocation = startLoc;
expr.EndLocation = endLocation;
}
statement = new ExpressionStatement(expr);
} else if (la.kind == 73) {
lexer.NextToken();
SimpleExpr(
//#line 3351 "VBNET.ATG"
out expr);
//#line 3351 "VBNET.ATG"
statement = new ExpressionStatement(expr);
} else if (la.kind == 226) {
lexer.NextToken();
//#line 3353 "VBNET.ATG"
开发者ID:Altaxo,项目名称:Altaxo,代码行数:67,代码来源:Parser.cs
示例19: TrackedVisitAssignmentExpression
public override object TrackedVisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
{
object obj;
switch (assignmentExpression.Op)
{
case AssignmentOperatorType.Assign:
{
obj = this.CreateSimpleAssignment(assignmentExpression, "=", data);
break;
}
case AssignmentOperatorType.Add:
{
if (!NRefactoryToPythonConverter.IsAddEventHandler(assignmentExpression))
{
obj = this.CreateSimpleAssignment(assignmentExpression, "+=", data);
break;
}
else
{
obj = this.CreateHandlerStatement(assignmentExpression.Left, "+=", assignmentExpression.Right);
break;
}
}
case AssignmentOperatorType.Subtract:
{
if (!NRefactoryToPythonConverter.IsRemoveEventHandler(assignmentExpression))
{
obj = this.CreateSimpleAssignment(assignmentExpression, "-=", data);
break;
}
else
{
obj = this.CreateHandlerStatement(assignmentExpression.Left, "-=", assignmentExpression.Right);
break;
}
}
case AssignmentOperatorType.Multiply:
{
obj = this.CreateSimpleAssignment(assignmentExpression, "*=", data);
break;
}
case AssignmentOperatorType.Divide:
case AssignmentOperatorType.DivideInteger:
{
obj = this.CreateSimpleAssignment(assignmentExpression, "/=", data);
break;
}
case AssignmentOperatorType.Modulus:
{
obj = this.CreateSimpleAssignment(assignmentExpression, "%=", data);
break;
}
case AssignmentOperatorType.Power:
{
obj = this.CreateSimpleAssignment(assignmentExpression, "**=", data);
break;
}
case AssignmentOperatorType.ConcatString:
{
obj = this.CreateSimpleAssignment(assignmentExpression, "+=", data);
break;
}
case AssignmentOperatorType.ShiftLeft:
{
obj = this.CreateSimpleAssignment(assignmentExpression, "<<=", data);
break;
}
case AssignmentOperatorType.ShiftRight:
{
obj = this.CreateSimpleAssignment(assignmentExpression, ">>=", data);
break;
}
case AssignmentOperatorType.BitwiseAnd:
{
obj = this.CreateSimpleAssignment(assignmentExpression, "&=", data);
break;
}
case AssignmentOperatorType.BitwiseOr:
{
obj = this.CreateSimpleAssignment(assignmentExpression, "|=", data);
break;
}
case AssignmentOperatorType.ExclusiveOr:
{
obj = this.CreateSimpleAssignment(assignmentExpression, "^=", data);
break;
}
default:
{
obj = null;
break;
}
}
return obj;
}
开发者ID:L3tum,项目名称:BesiegeScriptingMod,代码行数:95,代码来源:NRefactoryToPythonConverter.cs
示例20: CreateSimpleAssignment
private object CreateSimpleAssignment(AssignmentExpression assignmentExpression, string op, object data)
{
assignmentExpression.Left.AcceptVisitor(this, data);
this.Append(string.Concat(" ", op, " "));
assignmentExpression.Right.AcceptVisitor(this, data);
return null;
}
开发者ID:L3tum,项目名称:BesiegeScriptingMod,代码行数:7,代码来源:NRefactoryToPythonConverter.cs
注:本文中的ICSharpCode.NRefactory.Ast.AssignmentExpression类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论