当前位置: 首页>>代码示例>>C#>>正文


C# CSharp.CompoundAssign类代码示例

本文整理汇总了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;
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:47,代码来源:CSharpParser.cs

示例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]));
	  }
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:6,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:kaagati,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:6,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:5,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:Ein,项目名称:monodevelop,代码行数:6,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:5,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:5,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:nylen,项目名称:SharpDevelop,代码行数:6,代码来源:cs-parser.cs

示例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);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:23,代码来源:CSharpBinaryOperationBinder.cs

示例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:
开发者ID:runefs,项目名称:Marvin,代码行数:67,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:Ein,项目名称:monodevelop,代码行数:6,代码来源:cs-parser.cs

示例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]));
	  }
开发者ID:animaonline,项目名称:Portable-Mono.CSharp,代码行数:5,代码来源:cs-parser.cs


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