本文整理汇总了C#中Mono.CSharp.CompoundAssign类的典型用法代码示例。如果您正苦于以下问题:C# CompoundAssign类的具体用法?C# CompoundAssign怎么用?C# CompoundAssign使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompoundAssign类属于Mono.CSharp命名空间,在下文中一共展示了CompoundAssign类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override object Visit(CompoundAssign compoundAssign)
{
var result = new AssignmentExpression();
switch (compoundAssign.Op) {
case Binary.Operator.Multiply:
result.Operator = AssignmentOperatorType.Multiply;
break;
case Binary.Operator.Division:
result.Operator = AssignmentOperatorType.Divide;
break;
case Binary.Operator.Modulus:
result.Operator = AssignmentOperatorType.Modulus;
break;
case Binary.Operator.Addition:
result.Operator = AssignmentOperatorType.Add;
break;
case Binary.Operator.Subtraction:
result.Operator = AssignmentOperatorType.Subtract;
break;
case Binary.Operator.LeftShift:
result.Operator = AssignmentOperatorType.ShiftLeft;
break;
case Binary.Operator.RightShift:
result.Operator = AssignmentOperatorType.ShiftRight;
break;
case Binary.Operator.BitwiseAnd:
result.Operator = AssignmentOperatorType.BitwiseAnd;
break;
case Binary.Operator.BitwiseOr:
result.Operator = AssignmentOperatorType.BitwiseOr;
break;
case Binary.Operator.ExclusiveOr:
result.Operator = AssignmentOperatorType.ExclusiveOr;
break;
}
if (compoundAssign.Target != null)
result.AddChild((Expression)compoundAssign.Target.Accept(this), AssignmentExpression.LeftRole);
var location = LocationsBag.GetLocations(compoundAssign);
if (location != null) {
var r = AssignmentExpression.GetOperatorRole(result.Operator);
result.AddChild(new CSharpTokenNode(Convert(location [0]), r), r);
}
if (compoundAssign.Source != null)
result.AddChild((Expression)compoundAssign.Source.Accept(this), AssignmentExpression.RightRole);
return result;
}
示例2: case_607
void case_607()
#line 4022 "C:\Projects\Junk\mono\mcs\class\Mono.CSharp\..\..\mcs\cs-parser.jay"
{
yyVal = new CompoundAssign (
Binary.Operator.ExclusiveOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
示例3: case_641
void case_641()
#line 4511 "cs-parser.jay"
{
yyVal = new CompoundAssign (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
示例4: case_644
void case_644()
#line 4526 "cs-parser.jay"
{
yyVal = new CompoundAssign (Binary.Operator.BitwiseAnd, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
示例5: case_629
void case_629()
#line 4428 "cs-parser.jay"
{
yyVal = new CompoundAssign (Binary.Operator.Multiply, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
示例6: case_638
void case_638()
#line 4496 "cs-parser.jay"
{
yyVal = new CompoundAssign (Binary.Operator.Division, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
示例7: case_601
void case_601()
{
yyVal = new CompoundAssign (Binary.Operator.BitwiseAnd, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
示例8: case_608
void case_608()
#line 4050 "cs-parser.jay"
{
yyVal = new CompoundAssign (
Binary.Operator.BitwiseOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
示例9: case_598
void case_598()
{
yyVal = new CompoundAssign (Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
示例10: case_600
void case_600()
{
yyVal = new CompoundAssign (Binary.Operator.RightShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
示例11: case_589
void case_589()
#line 4103 "cs-parser.jay"
{
yyVal = new CompoundAssign (
Binary.Operator.LeftShift, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
示例12: FallbackBinaryOperation
public override DynamicMetaObject FallbackBinaryOperation (DynamicMetaObject target, DynamicMetaObject arg, DynamicMetaObject errorSuggestion)
{
var left = CSharpBinder.CreateCompilerExpression (argumentInfo [0], target, true);
var right = CSharpBinder.CreateCompilerExpression (argumentInfo [1], arg, true);
bool is_compound;
var oper = GetOperator (out is_compound);
Compiler.Expression expr;
if (is_compound) {
var target_expr = CSharpBinder.CreateCompilerExpression (argumentInfo[0], target, false);
expr = new Compiler.CompoundAssign (oper, target_expr, right, left);
} else {
expr = new Compiler.Binary (oper, left, right);
expr = new Compiler.Cast (new Compiler.TypeExpression (typeof (object), Compiler.Location.Null), expr);
}
if (is_checked)
expr = new Compiler.CheckedExpr (expr, Compiler.Location.Null);
var restrictions = CreateRestrictionsOnTarget (target).Merge (CreateRestrictionsOnTarget (arg));
return CSharpBinder.Bind (target, expr, restrictions, errorSuggestion);
}
示例13: yyparse
//.........这里部分代码省略.........
break;
case 614:
#line 4363 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new Conditional (new BooleanExpression ((Expression) yyVals[-4+yyTop]), (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-3+yyTop]));
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}
break;
case 615:
#line 4371 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
var potentialRolePlayer = yyVals[0+yyTop] as Expression;
var memberExpression = yyVals[-2+yyTop] as MemberAccess;
var simpleNameForRole = memberExpression != null ? memberExpression.LeftExpression as SimpleName : yyVals[-2+yyTop] as SimpleName;
if(simpleNameForRole != null){
var role = FindField(simpleNameForRole.Name, GetLocation(yyVals[-2+yyTop]));
var isRole = role != null && role.IsRole;
if(current_method as Constructor != null){
/*might be assigning to a role*/
yyVal = new RoleAssign ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
} else if(isRole) {
report.Error (10000, GetLocation(potentialRolePlayer), "Roles can only be assigned to players in constructor");
} else{
yyVal = new SimpleAssign ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
} else {
yyVal = new SimpleAssign ((Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
}
break;
case 616:
#line 4391 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new CompoundAssign (
Binary.Operator.Multiply, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 617:
#line 4396 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new CompoundAssign (
Binary.Operator.Division, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 618:
#line 4401 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new CompoundAssign (
Binary.Operator.Modulus, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 619:
#line 4406 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new CompoundAssign (
Binary.Operator.Addition, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 620:
#line 4411 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
{
yyVal = new CompoundAssign (
Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
break;
case 621:
示例14: case_604
void case_604()
#line 4030 "cs-parser.jay"
{
yyVal = new CompoundAssign (
Binary.Operator.Subtraction, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop], GetLocation (yyVals[-1+yyTop]));
}
示例15: case_603
void case_603()
{
yyVal = new CompoundAssign (Binary.Operator.ExclusiveOr, (Expression) yyVals[-2+yyTop], (Expression) yyVals[0+yyTop]);
lbag.AddLocation (yyVal, GetLocation (yyVals[-1+yyTop]));
}