• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CSharp.Unary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Mono.CSharp.Unary的典型用法代码示例。如果您正苦于以下问题:C# Unary类的具体用法?C# Unary怎么用?C# Unary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Unary类属于Mono.CSharp命名空间,在下文中一共展示了Unary类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FallbackUnaryOperation

		public override DynamicMetaObject FallbackUnaryOperation (DynamicMetaObject target, DynamicMetaObject errorSuggestion)
		{
			Compiler.Expression expr = CSharpBinder.CreateCompilerExpression (argumentInfo [0], target);

			if (Operation == ExpressionType.IsTrue) {
				expr = new Compiler.BooleanExpression (expr);
			} else {
				if (Operation == ExpressionType.Increment)
					expr = new Compiler.UnaryMutator (Compiler.UnaryMutator.Mode.PreIncrement, expr, Compiler.Location.Null);
				else if (Operation == ExpressionType.Decrement)
					expr = new Compiler.UnaryMutator (Compiler.UnaryMutator.Mode.PreDecrement, expr, Compiler.Location.Null);
				else
					expr = new Compiler.Unary (GetOperator (), expr, Compiler.Location.Null);

				expr = new Compiler.Cast (new Compiler.TypeExpression (TypeImporter.Import (ReturnType), Compiler.Location.Null), expr, Compiler.Location.Null);

				if ((flags & CSharpBinderFlags.CheckedContext) != 0)
					expr = new Compiler.CheckedExpr (expr, Compiler.Location.Null);
			}

			var binder = new CSharpBinder (this, expr, errorSuggestion);
			binder.AddRestrictions (target);

			return binder.Bind (context);
		}
开发者ID:afaerber,项目名称:mono,代码行数:25,代码来源:CSharpUnaryOperationBinder.cs


示例2: Visit

			public override object Visit (Unary unaryExpression)
			{
				var result = new UnaryOperatorExpression ();
				switch (unaryExpression.Oper) {
				case Unary.Operator.UnaryPlus:
					result.UnaryOperatorType = UnaryOperatorType.Plus;
					break;
				case Unary.Operator.UnaryNegation:
					result.UnaryOperatorType = UnaryOperatorType.Minus;
					break;
				case Unary.Operator.LogicalNot:
					result.UnaryOperatorType = UnaryOperatorType.Not;
					break;
				case Unary.Operator.OnesComplement:
					result.UnaryOperatorType = UnaryOperatorType.BitNot;
					break;
				case Unary.Operator.AddressOf:
					result.UnaryOperatorType = UnaryOperatorType.AddressOf;
					break;
				}
				result.AddChild (new CSharpTokenNode (Convert (unaryExpression.Location), 1), UnaryOperatorExpression.Operator);
				result.AddChild ((INode)unaryExpression.Expr.Accept (this), UnaryOperatorExpression.Roles.Expression);
				return result;
			}
开发者ID:pgoron,项目名称:monodevelop,代码行数:24,代码来源:CSharpParser.cs


示例3: Visit

				public override object Visit (Unary unaryExpression)
				{
					var exprResult = (CodeExpression)unaryExpression.Expr.Accept (this);
					
					switch (unaryExpression.Oper) {
					case Unary.Operator.UnaryPlus:
						return exprResult;
					case Unary.Operator.UnaryNegation: // -a => 0 - a
						return new CodeBinaryOperatorExpression (new CodePrimitiveExpression (0), CodeBinaryOperatorType.Subtract, exprResult);
					case Unary.Operator.LogicalNot: // !a => a == false
						return new CodeBinaryOperatorExpression (exprResult, CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression (false));
					}
					return exprResult;
				}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:14,代码来源:McsParser.cs


示例4: case_578

void case_578()
#line 4159 "cs-parser.jay"
{
		Error_SyntaxError (yyToken);

		yyVal = new Unary (Unary.Operator.AddressOf, null, GetLocation (yyVals[-1+yyTop]));
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:7,代码来源:cs-parser.cs


示例5: case_574

void case_574()
#line 4135 "cs-parser.jay"
{ 
		Error_SyntaxError (yyToken);

		yyVal = new Unary (Unary.Operator.UnaryNegation, null, GetLocation (yyVals[-1+yyTop]));
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:7,代码来源:cs-parser.cs


示例6: case_563

void case_563()
#line 4078 "cs-parser.jay"
{
		Error_SyntaxError (yyToken);

		yyVal = new Unary (Unary.Operator.OnesComplement, null, GetLocation (yyVals[-1+yyTop]));
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:7,代码来源:cs-parser.cs


示例7: case_562

void case_562()
#line 4072 "cs-parser.jay"
{
		Error_SyntaxError (yyToken);

		yyVal = new Unary (Unary.Operator.LogicalNot, null, GetLocation (yyVals[-1+yyTop]));
	  }
开发者ID:segaman,项目名称:NRefactory,代码行数:7,代码来源:cs-parser.cs


示例8: yyparse


//.........这里部分代码省略.........
case 484:
  case_484();
  break;
case 485:
  case_485();
  break;
case 486:
  case_486();
  break;
case 487:
  case_487();
  break;
case 488:
#line 3569 "cs-parser.jay"
  {
	  	yyVal = new Argument ((Expression) yyVals[0+yyTop]);
	  }
  break;
case 490:
#line 3577 "cs-parser.jay"
  {
		yyVal = new This (GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 491:
  case_491();
  break;
case 492:
  case_492();
  break;
case 493:
#line 3597 "cs-parser.jay"
  {
		yyVal = new UnaryMutator (UnaryMutator.Mode.PostIncrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 494:
#line 3604 "cs-parser.jay"
  {
		yyVal = new UnaryMutator (UnaryMutator.Mode.PostDecrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 495:
  case_495();
  break;
case 496:
  case_496();
  break;
case 497:
  case_497();
  break;
case 498:
  case_498();
  break;
case 499:
  case_499();
  break;
case 500:
  case_500();
  break;
case 501:
  case_501();
  break;
case 502:
#line 3671 "cs-parser.jay"
  {
开发者ID:segaman,项目名称:NRefactory,代码行数:67,代码来源:cs-parser.cs


示例9: Visit

		public virtual object Visit (Unary unaryExpression)
		{
			return null;
		}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:4,代码来源:visit.cs


示例10: case_566

void case_566()
#line 4074 "cs-parser.jay"
{ 
		Error_SyntaxError (yyToken);

	  	yyVal = new Unary (Unary.Operator.UnaryPlus, null, GetLocation (yyVals[-1+yyTop]));
	  }
开发者ID:kaagati,项目名称:NRefactory,代码行数:7,代码来源:cs-parser.cs


示例11: yyparse


//.........这里部分代码省略.........
case 484:
  case_484();
  break;
case 485:
  case_485();
  break;
case 486:
  case_486();
  break;
case 487:
  case_487();
  break;
case 488:
#line 3371 "cs-parser.jay"
  {
	  	yyVal = new Argument ((Expression) yyVals[0+yyTop]);
	  }
  break;
case 490:
#line 3379 "cs-parser.jay"
  {
		yyVal = new This (GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 491:
  case_491();
  break;
case 492:
  case_492();
  break;
case 493:
#line 3399 "cs-parser.jay"
  {
		yyVal = new UnaryMutator (UnaryMutator.Mode.PostIncrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 494:
#line 3406 "cs-parser.jay"
  {
		yyVal = new UnaryMutator (UnaryMutator.Mode.PostDecrement, (Expression) yyVals[-1+yyTop], GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 495:
  case_495();
  break;
case 496:
  case_496();
  break;
case 497:
  case_497();
  break;
case 498:
  case_498();
  break;
case 499:
  case_499();
  break;
case 500:
  case_500();
  break;
case 501:
  case_501();
  break;
case 502:
#line 3472 "cs-parser.jay"
  {
开发者ID:Ein,项目名称:monodevelop,代码行数:67,代码来源:cs-parser.cs


示例12: yyparse


//.........这里部分代码省略.........

		current_local_parameters = null;
	  }
  break;
case 242:
#line 1970 "cs-parser.jay"
  { yyVal = null; }
  break;
case 244:
#line 1976 "cs-parser.jay"
  {
		Report.Error (590, GetLocation (yyVals[0+yyTop]), "User-defined operators cannot return void");
		yyVal = TypeManager.system_void_expr;		
	  }
  break;
case 245:
#line 1984 "cs-parser.jay"
  {
		valid_param_mod = ParameterModifierType.DefaultValue;
	  }
  break;
case 246:
#line 1988 "cs-parser.jay"
  {
		valid_param_mod = 0;

		Location loc = GetLocation (yyVals[-5+yyTop]);
		Operator.OpType op = (Operator.OpType) yyVals[-4+yyTop];
		current_local_parameters = (ParametersCompiled)yyVals[-1+yyTop];
		
		int p_count = current_local_parameters.Count;
		if (p_count == 1) {
			if (op == Operator.OpType.Addition)
				op = Operator.OpType.UnaryPlus;
			else if (op == Operator.OpType.Subtraction)
				op = Operator.OpType.UnaryNegation;
		}
		
		if (IsUnaryOperator (op)) {
			if (p_count == 2) {
				Report.Error (1020, loc, "Overloadable binary operator expected");
			} else if (p_count != 1) {
				Report.Error (1535, loc, "Overloaded unary operator `{0}' takes one parameter",
					Operator.GetName (op));
			}
		} else {
			if (p_count > 2) {
				Report.Error (1534, loc, "Overloaded binary operator `{0}' takes two parameters",
					Operator.GetName (op));
			} else if (p_count != 2) {
				Report.Error (1019, loc, "Overloadable unary operator expected");
			}
		}
		
		if (RootContext.Documentation != null) {
			tmpComment = Lexer.consume_doc_comment ();
			Lexer.doc_state = XmlCommentState.NotAllowed;
		}

		yyVal = new OperatorDeclaration (op, (FullNamedExpression) yyVals[-6+yyTop], loc);
	  }
  break;
case 248:
#line 2031 "cs-parser.jay"
  { yyVal = Operator.OpType.LogicalNot; }
  break;
开发者ID:speier,项目名称:shake,代码行数:67,代码来源:cs-parser.cs


示例13: yyparse


//.........这里部分代码省略.........
		
		current_local_parameters = null;
	  }
  break;
case 258:
#line 2354 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  { yyVal = null; }
  break;
case 260:
#line 2360 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		report.Error (590, GetLocation (yyVals[0+yyTop]), "User-defined operators cannot return void");
		yyVal = new TypeExpression (compiler.BuiltinTypes.Void, GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 261:
#line 2368 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		valid_param_mod = ParameterModifierType.DefaultValue;
	  }
  break;
case 262:
#line 2372 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  {
		valid_param_mod = 0;

		Location loc = GetLocation (yyVals[-5+yyTop]);
		Operator.OpType op = (Operator.OpType) yyVals[-4+yyTop];
		current_local_parameters = (ParametersCompiled)yyVals[-1+yyTop];
		
		int p_count = current_local_parameters.Count;
		if (p_count == 1) {
			if (op == Operator.OpType.Addition)
				op = Operator.OpType.UnaryPlus;
			else if (op == Operator.OpType.Subtraction)
				op = Operator.OpType.UnaryNegation;
		}
		
		if (IsUnaryOperator (op)) {
			if (p_count == 2) {
				report.Error (1020, loc, "Overloadable binary operator expected");
			} else if (p_count != 1) {
				report.Error (1535, loc, "Overloaded unary operator `{0}' takes one parameter",
					Operator.GetName (op));
			}
		} else {
			if (p_count > 2) {
				report.Error (1534, loc, "Overloaded binary operator `{0}' takes two parameters",
					Operator.GetName (op));
			} else if (p_count != 2) {
				report.Error (1019, loc, "Overloadable unary operator expected");
			}
		}
		
		if (doc_support) {
			tmpComment = Lexer.consume_doc_comment ();
			Lexer.doc_state = XmlCommentState.NotAllowed;
		}

		yyVal = new OperatorDeclaration (op, (FullNamedExpression) yyVals[-6+yyTop], loc);
		lbag.AddLocation (yyVal, GetLocation (yyVals[-5+yyTop]), GetLocation (yyVals[-4+yyTop]), GetLocation (yyVals[-3+yyTop]), GetLocation (yyVals[0+yyTop]));
	  }
  break;
case 264:
#line 2416 "D:\GitHub\M\Marvin\mcs\cs-parser.jay"
  { yyVal = Operator.OpType.LogicalNot; }
开发者ID:runefs,项目名称:Marvin,代码行数:67,代码来源:cs-parser.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CSharp.UnaryMutator类代码示例发布时间:2022-05-26
下一篇:
C# CSharp.UnCheckedExpr类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap