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

C# Ast.UnaryExpression类代码示例

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

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



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

示例1: LeaveUnaryExpression

		override public void LeaveUnaryExpression(UnaryExpression node)
		{
			if (node.Operator == UnaryOperatorType.SafeAccess)
			{
				// target references should already be resolved, so just evaluate as existential
				var notnull = CodeBuilder.CreateNotNullTest(node.Operand);
				ReplaceCurrentNode(notnull);
			}
		}
开发者ID:Rfvgyhn,项目名称:boo,代码行数:9,代码来源:SafeAccessOperator.cs


示例2: LeaveUnaryExpression

 public override void LeaveUnaryExpression(UnaryExpression node)
 {
     switch (node.Operator)
     {
     case UnaryOperatorType.LogicalNot:
         node.Operand = ExplicitBooleanContext(node.Operand);
         break;
     }
 }
开发者ID:jagt,项目名称:us2cs,代码行数:9,代码来源:InjectExplicitBooleanConversion.cs


示例3: LeaveUnaryExpression

 public override void LeaveUnaryExpression(UnaryExpression node)
 {
     if (IsDuckTyped(node.Operand) &&
        node.Operator == UnaryOperatorType.UnaryNegation)
     {
         BindDuck(node);
     }
     else
     {
         base.LeaveUnaryExpression(node);
     }
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:12,代码来源:ProcessMethodBodiesWithDuckTyping.cs


示例4: LeaveMethodInvocationExpression

 public override void LeaveMethodInvocationExpression(MethodInvocationExpression node)
 {
     IEntityWithParameters parameters = node.get_Target().get_Entity() as IEntityWithParameters;
     if (parameters != null)
     {
         ExpressionCollection args = node.get_Arguments();
         if (parameters.get_AcceptVarArgs() && UnityCallableResolutionServiceModule.IsArrayArgumentExplicitlyProvided(parameters.GetParameters(), args))
         {
             UnaryExpression expression2;
             Expression expression = args.get_Item(-1);
             UnaryExpression expression1 = expression2 = new UnaryExpression();
             expression2.set_Operator(7);
             expression2.set_Operand(expression);
             expression2.set_ExpressionType(this.GetExpressionType(expression));
             args.ReplaceAt(-1, expression2);
         }
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:18,代码来源:AutoExplodeVarArgsInvocations.cs


示例5: ProcessOperatorOverload

 private void ProcessOperatorOverload(UnaryExpression node)
 {
     if (! ResolveOperator(node))
     {
         InvalidOperatorForType(node);
     }
 }
开发者ID:stuman08,项目名称:boo,代码行数:7,代码来源:ProcessMethodBodies.cs


示例6: LeaveUnaryNegation

 private void LeaveUnaryNegation(UnaryExpression node)
 {
     if (IsPrimitiveNumber(node.Operand))
         BindExpressionType(node, GetExpressionType(node.Operand));
     else
         ProcessOperatorOverload(node);
 }
开发者ID:stuman08,项目名称:boo,代码行数:7,代码来源:ProcessMethodBodies.cs


示例7: LeaveLogicalNot

 private void LeaveLogicalNot(UnaryExpression node)
 {
     BindExpressionType(node, TypeSystemServices.BoolType);
 }
开发者ID:stuman08,项目名称:boo,代码行数:4,代码来源:ProcessMethodBodies.cs


示例8: LeaveIncrementDecrement

 void LeaveIncrementDecrement(UnaryExpression node)
 {
     if (AssertLValue(node.Operand))
     {
         if (!IsValidIncrementDecrementOperand(node.Operand))
             InvalidOperatorForType(node);
         else
             ExpandIncrementDecrement(node);
     }
     else
         Error(node);
 }
开发者ID:stuman08,项目名称:boo,代码行数:12,代码来源:ProcessMethodBodies.cs


示例9: InvalidOperatorForType

 void InvalidOperatorForType(UnaryExpression node)
 {
     Error(node, CompilerErrorFactory.InvalidOperatorForType(node,
                                                             GetUnaryOperatorText(node.Operator),
                                                             GetExpressionType(node.Operand)));
 }
开发者ID:stuman08,项目名称:boo,代码行数:6,代码来源:ProcessMethodBodies.cs


示例10: ExpandIncrementDecrementArraySlicing

 Expression ExpandIncrementDecrementArraySlicing(UnaryExpression node)
 {
     SlicingExpression slicing = (SlicingExpression)node.Operand;
     AssertIsNotComplexSlicing(slicing);
     Visit(slicing);
     return CreateSideEffectAwareSlicingOperation(
         node.LexicalInfo,
         GetEquivalentBinaryOperator(node.Operator),
         slicing,
         CodeBuilder.CreateIntegerLiteral(1),
         DeclareOldValueTempIfNeeded(node));
 }
开发者ID:stuman08,项目名称:boo,代码行数:12,代码来源:ProcessMethodBodies.cs


示例11: EmitUnaryNegation

 private void EmitUnaryNegation(UnaryExpression node)
 {
     IType operandType = GetExpressionType(node.Operand);
     if (!_checked || !TypeSystemServices.IsIntegerNumber(operandType))
     {
         //a single/double unary negation never overflow
         node.Operand.Accept(this);
         _il.Emit(OpCodes.Neg);
     }
     else
     {
         _il.Emit(OpCodes.Ldc_I4_0);
         if (operandType == TypeSystemServices.LongType || operandType == TypeSystemServices.ULongType)
             _il.Emit(OpCodes.Conv_I8);
         node.Operand.Accept(this);
         _il.Emit(TypeSystemServices.IsSignedNumber(operandType)
                  ? OpCodes.Sub_Ovf : OpCodes.Sub_Ovf_Un);
         if (operandType != TypeSystemServices.LongType && operandType != TypeSystemServices.ULongType)
             EmitCastIfNeeded(operandType, TypeSystemServices.IntType);
     }
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:21,代码来源:EmitAssembly.cs


示例12: EmitOnesComplement

 private void EmitOnesComplement(UnaryExpression node)
 {
     node.Operand.Accept(this);
     _il.Emit(OpCodes.Not);
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:5,代码来源:EmitAssembly.cs


示例13: EmitLogicalNot

        private void EmitLogicalNot(UnaryExpression node)
        {
            Expression operand = node.Operand;
            operand.Accept(this);
            IType typeOnStack = PopType();
            bool notContext = true;

            if (IsBoolOrInt(typeOnStack))
            {
                EmitIntNot();
            }
            else if (EmitToBoolIfNeeded(operand, ref notContext))
            {
                if (!notContext) //we are in a not context and emit to bool is also in a not context
                    EmitIntNot();//so we do not need any not (false && false => true)
            }
            else
            {
                EmitGenericNot();
            }
            PushBool();
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:22,代码来源:EmitAssembly.cs


示例14: EmitIndirection

        void EmitIndirection(UnaryExpression node)
        {
            node.Operand.Accept(this);

            if (node.Operand.NodeType != NodeType.ReferenceExpression
                && node.ParentNode.NodeType != NodeType.MemberReferenceExpression)
            {
                //pointer arithmetic, need to load the address
                IType et = PeekTypeOnStack().ElementType;
                OpCode code = GetLoadRefParamCode(et);
                if (code == OpCodes.Ldobj)
                    _il.Emit(code, GetSystemType(et));
                else
                    _il.Emit(code);

                PopType();
                PushType(et);
            }
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:19,代码来源:EmitAssembly.cs


示例15: EmitBranch

 void EmitBranch(bool branchOnTrue, UnaryExpression expression, Label label)
 {
     if (UnaryOperatorType.LogicalNot == expression.Operator)
     {
         EmitBranch(!branchOnTrue, expression.Operand, label);
     }
     else
     {
         EmitDefaultBranch(branchOnTrue, expression, label);
     }
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:11,代码来源:EmitAssembly.cs


示例16: DeclareOldValueTempIfNeeded

 InternalLocal DeclareOldValueTempIfNeeded(UnaryExpression node)
 {
     return AstUtil.IsPostUnaryOperator(node.Operator)
         ? DeclareTempLocal(GetExpressionType(node.Operand))
         : null;
 }
开发者ID:stuman08,项目名称:boo,代码行数:6,代码来源:ProcessMethodBodies.cs


示例17: ExpandIncrementDecrement

        void ExpandIncrementDecrement(UnaryExpression node)
        {
            var expansion = IsArraySlicing(node.Operand)
                ? ExpandIncrementDecrementArraySlicing(node)
                : ExpandSimpleIncrementDecrement(node);

            node.ParentNode.Replace(node, expansion);

            Visit(expansion);
        }
开发者ID:stuman08,项目名称:boo,代码行数:10,代码来源:ProcessMethodBodies.cs


示例18: exception_handler


//.........这里部分代码省略.........
				case UNLESS:
				{
					{
						switch ( LA(1) )
						{
						case IF:
						{
							match(IF);
							break;
						}
						case UNLESS:
						{
							u = LT(1);
							match(UNLESS);
							break;
						}
						default:
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						 }
					}
					e=boolean_expression();
					break;
				}
				case COLON:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			if (0==inputState.guessing)
			{
				
						eh = new ExceptionHandler(ToLexicalInfo(c));
						
						eh.Declaration = new Declaration();
						eh.Declaration.Type = tr;
						
						if (x != null)
						{
							eh.Declaration.LexicalInfo = ToLexicalInfo(x);
							eh.Declaration.Name = x.getText();		
						}
						else
						{
							eh.Declaration.Name = null;
							eh.Flags |= ExceptionHandlerFlags.Anonymous;
						}
						if (tr != null)
						{
							eh.Declaration.LexicalInfo = tr.LexicalInfo;
						}
						else if (x != null)
						{
							eh.Declaration.LexicalInfo = eh.LexicalInfo;
						}
						if(tr == null)
						{
							eh.Flags |= ExceptionHandlerFlags.Untyped;
						}
						if (e != null)
						{
							if(u != null)
							{
								UnaryExpression not = new UnaryExpression(ToLexicalInfo(u));
								not.Operator = UnaryOperatorType.LogicalNot;
								not.Operand = e;
								e = not;
							}
							eh.FilterCondition = e;
							eh.Flags |= ExceptionHandlerFlags.Filter;
						}
					
			}
			compound_stmt(eh.Block);
			if (0==inputState.guessing)
			{
				
						t.ExceptionHandlers.Add(eh);
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "exception_handler");
				recover(ex,tokenSet_106_);
			}
			else
			{
				throw ex;
			}
		}
	}
开发者ID:hlizard,项目名称:boo,代码行数:101,代码来源:BooParserBase.cs


示例19: ExpandSimpleIncrementDecrement

        Expression ExpandSimpleIncrementDecrement(UnaryExpression node)
        {
            var oldValue = DeclareOldValueTempIfNeeded(node);
            var type = GetExpressionType(node.Operand);

            var addition = CodeBuilder.CreateBoundBinaryExpression(
                type,
                GetEquivalentBinaryOperator(node.Operator),
                CloneOrAssignToTemp(oldValue, node.Operand),
                CodeBuilder.CreateIntegerLiteral(1));

            var assign = CodeBuilder.CreateAssignment(
                node.LexicalInfo,
                node.Operand,
                addition);

            // Resolve operator overloads if any
            BindArithmeticOperator(addition);

            return oldValue == null
                ? (Expression) assign
                : CodeBuilder.CreateEvalInvocation(
                    node.LexicalInfo,
                    assign,
                    CodeBuilder.CreateReference(oldValue));
        }
开发者ID:stuman08,项目名称:boo,代码行数:26,代码来源:ProcessMethodBodies.cs


示例20: not_expression

	protected Expression  not_expression() //throws RecognitionException, TokenStreamException
{
		Expression e;
		
		IToken  nt = null;
		
				e = null;
			
		
		try {      // for error handling
			{
				switch ( LA(1) )
				{
				case NOT:
				{
					{
						nt = LT(1);
						match(NOT);
						e=not_expression();
					}
					break;
				}
				case ESEPARATOR:
				case CAST:
				case CHAR:
				case FALSE:
				case NULL:
				case SELF:
				case SUPER:
				case THEN:
				case TRUE:
				case TYPEOF:
				case TRIPLE_QUOTED_STRING:
				case LPAREN:
				case DOUBLE_QUOTED_STRING:
				case SINGLE_QUOTED_STRING:
				case ID:
				case MULTIPLY:
				case LBRACK:
				case SPLICE_BEGIN:
				case DOT:
				case LBRACE:
				case QQ_BEGIN:
				case SUBTRACT:
				case LONG:
				case INCREMENT:
				case DECREMENT:
				case ONES_COMPLEMENT:
				case INT:
				case BACKTICK_QUOTED_STRING:
				case RE_LITERAL:
				case DOUBLE:
				case FLOAT:
				case TIMESPAN:
				{
					e=assignment_expression();
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			if (0==inputState.guessing)
			{
				
						if (nt != null)
						{
							UnaryExpression ue = new UnaryExpression(ToLexicalInfo(nt));
							ue.Operator = UnaryOperatorType.LogicalNot;
							ue.Operand = e;
							e = ue;
						}
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "not_expression");
				recover(ex,tokenSet_107_);
			}
			else
			{
				throw ex;
			}
		}
		return e;
	}
开发者ID:hlizard,项目名称:boo,代码行数:91,代码来源:BooParserBase.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TypeSystem.Ambiguous类代码示例发布时间:2022-05-24
下一篇:
C# Ast.TypeReference类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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