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


C# BoundCall.Update方法代码示例

本文整理汇总了C#中Microsoft.CodeAnalysis.CSharp.BoundCall.Update方法的典型用法代码示例。如果您正苦于以下问题:C# BoundCall.Update方法的具体用法?C# BoundCall.Update怎么用?C# BoundCall.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.CodeAnalysis.CSharp.BoundCall的用法示例。


在下文中一共展示了BoundCall.Update方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VisitCall

            public override BoundNode VisitCall(BoundCall node)
            {
                if (node.Method.MethodKind == MethodKind.LocalFunction)
                {
                    BoundExpression receiver;
                    MethodSymbol method;
                    var arguments = node.Arguments;
                    _lambdaRewriter.RemapLocalFunction(node.Syntax, node.Method, out receiver, out method, ref arguments);
                    node = node.Update(receiver, method, arguments);
                }

                return base.VisitCall(node);
            }
开发者ID:jkotas,项目名称:roslyn,代码行数:13,代码来源:LambdaRewriter.LocalFunctionReferenceRewriter.cs

示例2: VisitCall

        public override BoundNode VisitCall(BoundCall node)
        {
            BoundSpillSequence2 ss = null;
            var arguments = this.VisitExpressionList(ref ss, node.Arguments, node.ArgumentRefKindsOpt);

            BoundExpression receiver = null;
            if (ss == null)
            {
                receiver = VisitExpression(ref ss, node.ReceiverOpt);
            }
            else if (!node.Method.IsStatic)
            {
                // spill the receiver if there were await expressions in the arguments
                var ss2 = new BoundSpillSequence2();
                receiver = Spill(ss2, VisitExpression(ref ss2, node.ReceiverOpt), refKind: node.ReceiverOpt.Type.IsReferenceType ? RefKind.None : RefKind.Ref);
                ss2.IncludeSequence(ss);
                ss = ss2;
            }

            return UpdateExpression(ss, node.Update(receiver, node.Method, arguments));
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:21,代码来源:AwaitLiftingRewriter.cs

示例3: MakeCall

        private BoundExpression MakeCall(
            BoundCall node,
            SyntaxNode syntax,
            BoundExpression rewrittenReceiver,
            MethodSymbol method,
            ImmutableArray<BoundExpression> rewrittenArguments,
            ImmutableArray<RefKind> argumentRefKinds,
            bool invokedAsExtensionMethod,
            LookupResultKind resultKind,
            TypeSymbol type,
            ImmutableArray<LocalSymbol> temps = default(ImmutableArray<LocalSymbol>))
        {
            BoundExpression rewrittenBoundCall;

            if (method.IsStatic &&
                method.ContainingType.IsObjectType() &&
                !_inExpressionLambda &&
                (object)method == (object)_compilation.GetSpecialTypeMember(SpecialMember.System_Object__ReferenceEquals))
            {
                Debug.Assert(rewrittenArguments.Length == 2);

                // ECMA - 335
                // I.8.2.5.1 Identity
                //           ...
                //           Identity is implemented on System.Object via the ReferenceEquals method.
                rewrittenBoundCall = new BoundBinaryOperator(
                    syntax,
                    BinaryOperatorKind.ObjectEqual,
                    rewrittenArguments[0],
                    rewrittenArguments[1],
                    null,
                    null,
                    resultKind,
                    type);
            }
            else if (node == null)
            {
                rewrittenBoundCall = new BoundCall(
                    syntax,
                    rewrittenReceiver,
                    method,
                    rewrittenArguments,
                    default(ImmutableArray<string>),
                    argumentRefKinds,
                    isDelegateCall: false,
                    expanded: false,
                    invokedAsExtensionMethod: invokedAsExtensionMethod,
                    argsToParamsOpt: default(ImmutableArray<int>),
                    resultKind: resultKind,
                    type: type);
            }
            else
            {
                rewrittenBoundCall = node.Update(
                    rewrittenReceiver,
                    method,
                    rewrittenArguments,
                    default(ImmutableArray<string>),
                    argumentRefKinds,
                    node.IsDelegateCall,
                    false,
                    node.InvokedAsExtensionMethod,
                    default(ImmutableArray<int>),
                    node.ResultKind,
                    node.Type);
            }

            if (!temps.IsDefaultOrEmpty)
            {
                return new BoundSequence(
                    syntax,
                    locals: temps,
                    sideEffects: ImmutableArray<BoundExpression>.Empty,
                    value: rewrittenBoundCall,
                    type: type);
            }

            return rewrittenBoundCall;
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:79,代码来源:LocalRewriter_Call.cs

示例4: VisitCall

        public override BoundNode VisitCall(BoundCall node)
        {
            BoundExpression receiverOpt = (BoundExpression)this.Visit(node.ReceiverOpt);
            ReadOnlyArray<BoundExpression> arguments = this.VisitList(node.Arguments);
            TypeSymbol type = this.VisitType(node.Type);

            if (!RequiresSpill(arguments) && !RequiresSpill(receiverOpt))
            {
                return node.Update(
                    receiverOpt, 
                    node.Method, 
                    arguments, 
                    node.ArgumentNamesOpt, 
                    node.ArgumentRefKindsOpt, 
                    node.IsDelegateCall,
                    node.Expanded, 
                    node.InvokedAsExtensionMethod, 
                    node.ArgsToParamsOpt, 
                    node.ResultKind, type);
            }

            var spillBuilder = new SpillBuilder();
            var spillResult = SpillExpressionsWithReceiver(receiverOpt, arguments, spillBuilder, node.Method.ParameterRefKinds);

            var newCall = node.Update(
                spillResult.Item1,
                node.Method,
                spillResult.Item2,
                node.ArgumentNamesOpt,
                node.ArgumentRefKindsOpt,
                node.IsDelegateCall,
                node.Expanded,
                node.InvokedAsExtensionMethod,
                node.ArgsToParamsOpt,
                node.ResultKind,
                type);

            return spillBuilder.BuildSequenceAndFree(F, newCall);
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:39,代码来源:AwaitLoweringRewriterPass1_ArgExpressions.cs

示例5: ReverseLastTwoParameterOrder

 private static BoundCall ReverseLastTwoParameterOrder(BoundCall result)
 {
     // The input call has its arguments in the appropriate order for the invocation, but its last
     // two argument expressions appear in the reverse order from which they appeared in source.
     // Since we want region analysis to see them in source order, we rewrite the call so that these
     // two arguments are evaluated in source order.
     int n = result.Arguments.Length;
     var arguments = ArrayBuilder<BoundExpression>.GetInstance();
     arguments.AddRange(result.Arguments);
     var lastArgument = arguments[n - 1];
     arguments[n - 1] = arguments[n - 2];
     arguments[n - 2] = lastArgument;
     var argsToParams = ArrayBuilder<int>.GetInstance();
     argsToParams.AddRange(Enumerable.Range(0, n));
     argsToParams[n - 1] = n - 2;
     argsToParams[n - 2] = n - 1;
     return result.Update(
         result.ReceiverOpt, result.Method, arguments.ToImmutableAndFree(), default(ImmutableArray<string>),
         default(ImmutableArray<RefKind>), result.IsDelegateCall, result.Expanded, result.InvokedAsExtensionMethod,
         argsToParams.ToImmutableAndFree(), result.ResultKind, result.Type);
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:21,代码来源:Binder_Query.cs


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