コード例 #1
0
            public override void VisitInvocationExpression(InvocationExpressionSyntax node)
            {
                var symbol = _semanticModel.GetSymbolInfo(node).Symbol;

                if (symbol != null && symbol.ContainingType.ToString().Equals(MetadataNames.NSubstituteCallInfoFullTypeName))
                {
                    switch (symbol.Name)
                    {
                    case MetadataNames.CallInfoArgAtMethod:
                        ArgAtInvocations.Add(node);
                        break;

                    case MetadataNames.CallInfoArgMethod:
                        ArgInvocations.Add(node);
                        break;

                    case "Item":
                        DirectIndexerAccesses.Add(node);
                        break;
                    }
                }

                if (symbol == null)
                {
                    var expressionSymbol = _semanticModel.GetSymbolInfo(node.Expression).Symbol;

                    if (expressionSymbol != null && expressionSymbol.ContainingType.ToString().Equals(MetadataNames.NSubstituteCallInfoFullTypeName))
                    {
                        DirectIndexerAccesses.Add(node);
                    }
                }

                base.VisitInvocationExpression(node);
            }
コード例 #2
0
            public override void VisitInvocationExpression(InvocationExpressionSyntax node)
            {
                var symbolInfo = _semanticModel.GetSymbolInfo(node);

                if (symbolInfo.Symbol != null && symbolInfo.Symbol.ContainingType.ToString().Equals(MetadataNames.NSubstituteCoreFullTypeName))
                {
                    switch (symbolInfo.Symbol.Name)
                    {
                    case MetadataNames.CallInfoArgAtMethod:
                        ArgAtInvocations.Add(node);
                        break;

                    case MetadataNames.CallInfoArgMethod:
                        ArgInvocations.Add(node);
                        break;
                    }
                }

                base.VisitInvocationExpression(node);
            }