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


C# Ast.UnaryExpression类代码示例

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


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


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