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

C# Ast.BinaryExpression类代码示例

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

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



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

示例1: LeaveBinaryExpression

 public override void LeaveBinaryExpression(BinaryExpression node)
 {
     if (IsAssignmentToSpecialMember(node))
     {
         ProcessAssignmentToSpecialMember(node);
     }
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:ProcessAssignmentsToSpecialMembers.cs


示例2: ComparisonFor

 public static Expression ComparisonFor(Expression local, IEnumerable<Expression> expressions)
 {
     BinaryExpression expression;
     IEnumerator<Expression> enumerator = expressions.GetEnumerator();
     if (!enumerator.MoveNext())
     {
         throw new AssertionFailedException("e.MoveNext()");
     }
     BinaryExpression expression1 = expression = new BinaryExpression(LexicalInfo.Empty);
     expression.set_Operator(11);
     expression.set_Left(Expression.Lift(local));
     expression.set_Right(Expression.Lift(enumerator.Current));
     Expression expression2 = expression;
     while (enumerator.MoveNext())
     {
         BinaryExpression expression3;
         BinaryExpression expression4;
         BinaryExpression expression11 = expression4 = new BinaryExpression(LexicalInfo.Empty);
         expression4.set_Operator(0x1c);
         expression4.set_Left(Expression.Lift(expression2));
         BinaryExpression expression12 = expression3 = new BinaryExpression(LexicalInfo.Empty);
         expression3.set_Operator(11);
         expression3.set_Left(Expression.Lift(local));
         expression3.set_Right(Expression.Lift(enumerator.Current));
         expression4.set_Right(expression3);
         expression2 = expression4;
     }
     return expression2;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:29,代码来源:SwitchMacroModule.cs


示例3: AddDependency

        protected virtual void AddDependency(ArrayLiteralExpression dependencies, BinaryExpression binaryExpression)
        {
            StringLiteralExpression dependency;

            //HACK: replace with proper AST method invocation
            if (binaryExpression.Left is StringLiteralExpression)
            {
                dependency = new StringLiteralExpression(string.Format("{0}|{1}",
                                                    binaryExpression.Left.ToString().Trim('\''),
                                                    binaryExpression.Right.ToString().Trim('\'')));
            }
            else if(binaryExpression.Left is BinaryExpression)
            {

                var left = (BinaryExpression) binaryExpression.Left;

                var package = left.Left.ToString().Trim('\'');
                var version = left.Right.ToString().Trim('\'');
                var dll = binaryExpression.Right.ToString().Trim('\'');

                dependency = new StringLiteralExpression(string.Format("{0}|{1}|{2}",
                                                    package,
                                                    dll,
                                                    version));
            }
            else
                throw new ArgumentOutOfRangeException(string.Format("Unknown Expression type {0} passed to RightShiftToMethodCompilerStep.AddDependency", binaryExpression.Left.GetType().Name));

            dependencies.Items.Add(dependency);
        }
开发者ID:emmekappa,项目名称:horn_src,代码行数:30,代码来源:RightShiftToMethodCompilerStep.cs


示例4: ExpandImpl

        protected override Statement ExpandImpl(MacroStatement macro){
            var result = new Block();
            foreach (Statement st in macro.Body.Statements){
                var decl = st as DeclarationStatement;
                var refer = st as ExpressionStatement;
                if(null==decl){
                    var ex = refer.Expression;
                    if (ex is MethodInvocationExpression){
                        decl =
                            new DeclarationStatement(
                                new Declaration(((MethodInvocationExpression) refer.Expression).Target.ToCodeString(),
                                                null), null);
                    }
                    if(ex is BinaryExpression){
                        var b = ex as BinaryExpression;
                        decl = new DeclarationStatement(
                            new Declaration(b.Left.ToCodeString(),null),b.Right
                            );
                    }
                }

                var bin = new BinaryExpression(BinaryOperatorType.Assign,
                                               new TryCastExpression(new ReferenceExpression(decl.Declaration.Name),
                                                                     decl.Declaration.Type),
                                               decl.Initializer);
                var def = new MacroStatement("definebrailproperty");
                def.Arguments.Add(bin);
                result.Add(def);
            }
            return result;
        }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:31,代码来源:DefinesMacro.cs


示例5: LeaveBinaryExpression

        public override void LeaveBinaryExpression(BinaryExpression node)
        {
            if (CheckExpressionType(node.Right))
                CheckExpressionType(node.Left);

            if (BinaryOperatorType.ReferenceEquality == node.Operator)
            {
                if (IsTypeReference(node.Right))
                {
                    Warnings.Add(
                        CompilerWarningFactory.IsInsteadOfIsa(node));
                }
            }

            //check that the assignment or comparison is meaningful
            if (BinaryOperatorType.Assign == node.Operator
                || AstUtil.GetBinaryOperatorKind(node) == BinaryOperatorKind.Comparison)
            {
                if (AreSameExpressions(node.Left, node.Right))
                {
                    Warnings.Add(
                        (BinaryOperatorType.Assign == node.Operator)
                        ? CompilerWarningFactory.AssignmentToSameVariable(node)
                        : CompilerWarningFactory.ComparisonWithSameVariable(node)
                    );
                }
                else if (BinaryOperatorType.Assign != node.Operator
                         && AreConstantExpressions(node.Left, node.Right))
                {
                    WarnAboutConstantExpression(node);
                }
            }
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:33,代码来源:StricterErrorChecking.cs


示例6: ProcessAssignment

		override protected void ProcessAssignment(BinaryExpression node)
		{
			if (TypeSystemServices.IsQuackBuiltin(node.Left.Entity))
				BindDuck(node);
			else
				ProcessStaticallyTypedAssignment(node);
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:7,代码来源:ProcessMethodBodiesWithDuckTyping.cs


示例7: LeaveBinaryExpression

 public override void LeaveBinaryExpression(BinaryExpression node)
 {
     if (BinaryOperatorType.Assign == node.Operator
         && (node.Right.NodeType != NodeType.TryCastExpression)
         && (IsTopLevelOfConditional(node)))
     {
         Warnings.Add(CompilerWarningFactory.EqualsInsteadOfAssign(node));
     }
 }
开发者ID:scottstephens,项目名称:boo,代码行数:9,代码来源:PreErrorChecking.cs


示例8: LeaveBinaryExpression

        public override void LeaveBinaryExpression(BinaryExpression node)
        {
            if (BinaryOperatorType.Assign != node.Operator)
                return;

            Expression newRight = Convert(node.Left.ExpressionType, node.Right);
            if (null != newRight)
                node.Right = newRight;
        }
开发者ID:rmartinho,项目名称:boo,代码行数:9,代码来源:InjectCallableConversions.cs


示例9: MethodInvocationForEventSubscription

        private MethodInvocationExpression MethodInvocationForEventSubscription(BinaryExpression node, IMethod method)
        {
            var methodTarget = CodeBuilder.CreateMemberReference(node.Left.LexicalInfo,
                ((MemberReferenceExpression)node.Left).Target, method);

            var mie = new MethodInvocationExpression(methodTarget);
            mie.Arguments.Add(node.Right);
            BindExpressionType(mie, method.ReturnType);
            return mie;
        }
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:10,代码来源:ExpandPropertiesAndEvents.cs


示例10: LeaveBinaryExpression

 public override void LeaveBinaryExpression(BinaryExpression node)
 {
     switch (node.Operator)
     {
     case BinaryOperatorType.And:
     case BinaryOperatorType.Or:
         BindLogicalOperator(node);
         break;
     }
 }
开发者ID:jagt,项目名称:us2cs,代码行数:10,代码来源:InjectExplicitBooleanConversion.cs


示例11: OnBinaryExpression

 public override void OnBinaryExpression(BinaryExpression node)
 {
     var lhs = node.Left.ExpressionType;
     var rhs = node.Right.ExpressionType;
     base.OnBinaryExpression(node);
     var expression = GetLinqExpressionForOperator(node.Operator);
     ReplaceCurrentNode(new MethodInvocationExpression(
         ReferenceExpression.Lift(expression),
         AddOptionalConvert(rhs, lhs, node.Left),
         AddOptionalConvert(lhs, rhs, node.Right)));
 }
开发者ID:BITechnologies,项目名称:boo,代码行数:11,代码来源:GeneratorExpressionTrees.cs


示例12: OnBinaryExpression

 public override void OnBinaryExpression(BinaryExpression node)
 {
     base.OnBinaryExpression(node);
     BinaryOperatorType type = node.get_Operator();
     if (((type == 0x1f) || (type == 30)) && (this.IsBoolean(node.get_Left()) && this.IsBoolean(node.get_Right())))
     {
         string[] strArray = (node.get_Operator() != 0x1f) ? new string[] { "||", "|" } : new string[] { "&&", "&" };
         string expectedOperator = strArray[0];
         string actualOperator = strArray[1];
         this.get_Warnings().Add(UnityScriptWarnings.BitwiseOperatorWithBooleanOperands(node.get_LexicalInfo(), expectedOperator, actualOperator));
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:12,代码来源:Lint.cs


示例13: IsAssignmentToSpecialMember

 protected bool IsAssignmentToSpecialMember(BinaryExpression node)
 {
     if (BinaryOperatorType.Assign == node.Operator &&
         NodeType.MemberReferenceExpression == node.Left.NodeType)
     {
         MemberReferenceExpression memberRef = node.Left as MemberReferenceExpression;
         Expression target = memberRef.Target;
         return !IsTerminalReferenceNode(target)
             && IsSpecialMemberTarget(target);
     }
     return false;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:12,代码来源:ProcessAssignmentsToSpecialMembers.cs


示例14: OnBinaryExpression

		public override void OnBinaryExpression(BinaryExpression node)
		{
			if (acceptImplicit) {
				ReferenceExpression reference = node.Left as ReferenceExpression;
				if (node.Operator == BinaryOperatorType.Assign && reference != null) {
					if (!(reference is MemberReferenceExpression)) {
						DeclarationFound(reference.Name, null, node.Right, reference.LexicalInfo);
					}
				}
			}
			base.OnBinaryExpression(node);
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:12,代码来源:VariableLookupVisitor.cs


示例15: LeaveBinaryExpression

 public override void LeaveBinaryExpression(BinaryExpression node)
 {
     CheckExpressionType(node.Right);
     if (BinaryOperatorType.ReferenceEquality == node.Operator)
     {
         if (IsTypeReference(node.Right))
         {
             Warnings.Add(
                 CompilerWarningFactory.IsInsteadOfIsa(node));
         }
     }
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:12,代码来源:StricterErrorChecking.cs


示例16: ApplyImplicitArrayConversion

 public void ApplyImplicitArrayConversion(BinaryExpression node)
 {
     IType expressionType = this.GetExpressionType(node.get_Left());
     if (expressionType.get_IsArray())
     {
         IType type2 = this.GetExpressionType(node.get_Right());
         if (type2 == this.UnityScriptLangArray())
         {
             node.set_Right(this.get_CodeBuilder().CreateCast(expressionType, this.get_CodeBuilder().CreateMethodInvocation(node.get_Right(), this.ResolveMethod(type2, "ToBuiltin"), this.get_CodeBuilder().CreateTypeofExpression(expressionType.get_ElementType()))));
         }
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:12,代码来源:ProcessUnityScriptMethods.cs


示例17: BindLogicalOperator

 void BindLogicalOperator(BinaryExpression node)
 {
     if (InjectImplicitBooleanConversions.IsLogicalCondition(node))
     {
     BindLogicalOperatorCondition(node);
     }
     else
     {
     node.Left = ExplicitBooleanContext(node.Left);
     node.Right = ExplicitBooleanContext(node.Right);
     }
 }
开发者ID:jagt,项目名称:us2cs,代码行数:12,代码来源:InjectExplicitBooleanConversion.cs


示例18: LeaveBinaryExpression

        public override void LeaveBinaryExpression(BinaryExpression node)
        {
            if (node.Operator != BinaryOperatorType.Assign
                || node.Right.NodeType != NodeType.IntegerLiteralExpression)
                return;

            IType expectedType = GetExpressionType(node.Left);
            if (!TypeSystemServices.IsPrimitiveNumber(expectedType))
                return;

            AssertLiteralInRange((IntegerLiteralExpression) node.Right, expectedType);
        }
开发者ID:neonux,项目名称:boo,代码行数:12,代码来源:CheckLiteralValues.cs


示例19: CheckEventUnsubscribe

 private void CheckEventUnsubscribe(BinaryExpression node, IEvent eventInfo)
 {
     CallableSignature expected = ((ICallableType) eventInfo.Type).GetSignature();
     CallableSignature actual = GetCallableSignature(node.Right);
     if (expected != actual)
     {
         Warnings.Add(
             CompilerWarningFactory.InvalidEventUnsubscribe(
                 node,
                 eventInfo.FullName,
                 expected));
     }
 }
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:13,代码来源:ExpandPropertiesAndEvents.cs


示例20: DoExpand

        /// <summary>
        /// Perform the actual expansion of the macro
        /// </summary>
        /// <param name="macro">The macro.</param>
        /// <returns></returns>
        protected override Statement DoExpand(MacroStatement macro)
        {
            Block body = (Block)macro.GetAncestor(NodeType.Block);
            MacroStatement macroParent = (MacroStatement)macro.GetAncestor(NodeType.MacroStatement);
           
            if (macro.Body.Statements.Count < 1 && parent.Name=="join")
            {
                Errors.Add(CompilerErrorFactory.CustomError(macro.LexicalInfo, "Join " + name + " section must contain at least a single expression statement"));
                return null;
            }

            if (macro.Arguments.Count == 0 && parent.Name!="join")
            {
                Errors.Add(CompilerErrorFactory.CustomError(macro.LexicalInfo, "Join " + name + " section must contain at least one key column"));
                return null;
            }

            if (macro.Arguments.Count > 0)
            {
                ArrayLiteralExpression ale = new ArrayLiteralExpression(macro.LexicalInfo);
                ale.Type = new ArrayTypeReference(CodeBuilder.CreateTypeReference(typeof(string)));
                foreach (Expression argument in macro.Arguments)
                {
                    ReferenceExpression expr = argument as ReferenceExpression;
                    if (expr == null)
                    {
                        Errors.Add(CompilerErrorFactory.CustomError(macro.LexicalInfo,"Join " + name +" section arguments must be reference expressions. Example: " + name + " name, surname"));
                        return null;
                    }
                    ale.Items.Add(new StringLiteralExpression(expr.Name));
                }
                var keyExpr = new BinaryExpression(BinaryOperatorType.Assign, new ReferenceExpression(name+"KeyColumns"), ale);
                macroParent.Arguments.Add(keyExpr);
            }

            foreach (Statement statement in macro.Body.Statements)
            {
                ExpressionStatement exprStmt = statement as ExpressionStatement;
                if(exprStmt==null)
                {
                    Errors.Add(CompilerErrorFactory.CustomError(macro.LexicalInfo, "Join " + name + " section can only contain expressions"));
                    return null;
                }
                Expression expr = exprStmt.Expression;
                parent.Arguments.Add(new MethodInvocationExpression(new ReferenceExpression(name), expr));
            }

            return null;
            
        }
开发者ID:f4i2u1,项目名称:rhino-etl,代码行数:55,代码来源:JoinSectionMacro.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Ast.Block类代码示例发布时间:2022-05-24
下一篇:
C# Ast.ArrayLiteralExpression类代码示例发布时间: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