private ImmutableArray <ISymbol> GetSymbolsOffOfExpression(ExpressionSyntax originalExpression) { // In case of 'await x$$', we want to move to 'x' to get it's members. // To run GetSymbolInfo, we also need to get rid of parenthesis. var expression = originalExpression is AwaitExpressionSyntax awaitExpression ? awaitExpression.Expression.WalkDownParentheses() : originalExpression.WalkDownParentheses(); var leftHandBinding = _context.SemanticModel.GetSymbolInfo(expression, _cancellationToken); var container = _context.SemanticModel.GetTypeInfo(expression, _cancellationToken).Type; var normalSymbols = GetSymbolsOffOfBoundExpression(originalExpression, expression, leftHandBinding, container); // Check for the Color Color case. if (originalExpression.CanAccessInstanceAndStaticMembersOffOf(_context.SemanticModel, _cancellationToken)) { var speculativeSymbolInfo = _context.SemanticModel.GetSpeculativeSymbolInfo(expression.SpanStart, expression, SpeculativeBindingOption.BindAsTypeOrNamespace); var typeMembers = GetSymbolsOffOfBoundExpression(originalExpression, expression, speculativeSymbolInfo, container); normalSymbols = normalSymbols.Concat(typeMembers); } return(normalSymbols); }
private static IEnumerable <ISymbol> GetSymbolsOffOfExpression( CSharpSyntaxContext context, ExpressionSyntax originalExpression, CancellationToken cancellationToken) { var expression = originalExpression.WalkDownParentheses(); var leftHandBinding = context.SemanticModel.GetSymbolInfo(expression, cancellationToken); var container = context.SemanticModel.GetTypeInfo(expression, cancellationToken).Type; // TODO remove this when 531549 which causes GetTypeInfo to return an error type is fixed if (container.IsErrorType()) { container = leftHandBinding.Symbol.GetSymbolType() as ITypeSymbol; } var normalSymbols = GetSymbolsOffOfBoundExpression(context, originalExpression, expression, leftHandBinding, container, cancellationToken); // Check for the Color Color case. if (originalExpression.CanAccessInstanceAndStaticMembersOffOf(context.SemanticModel, cancellationToken)) { var speculativeSymbolInfo = context.SemanticModel.GetSpeculativeSymbolInfo(expression.SpanStart, expression, SpeculativeBindingOption.BindAsTypeOrNamespace); var typeMembers = GetSymbolsOffOfBoundExpression(context, originalExpression, expression, speculativeSymbolInfo, container, cancellationToken); normalSymbols = normalSymbols.Concat(typeMembers); } return(normalSymbols); }
private ImmutableArray <ISymbol> GetSymbolsOffOfExpression(ExpressionSyntax originalExpression) { var expression = originalExpression.WalkDownParentheses(); var leftHandBinding = _context.SemanticModel.GetSymbolInfo(expression, _cancellationToken); var container = _context.SemanticModel.GetTypeInfo(expression, _cancellationToken).Type; var normalSymbols = GetSymbolsOffOfBoundExpression(originalExpression, expression, leftHandBinding, container); // Check for the Color Color case. if (originalExpression.CanAccessInstanceAndStaticMembersOffOf(_context.SemanticModel, _cancellationToken)) { var speculativeSymbolInfo = _context.SemanticModel.GetSpeculativeSymbolInfo(expression.SpanStart, expression, SpeculativeBindingOption.BindAsTypeOrNamespace); var typeMembers = GetSymbolsOffOfBoundExpression(originalExpression, expression, speculativeSymbolInfo, container); normalSymbols = normalSymbols.Concat(typeMembers); } return(normalSymbols); }
private static ImmutableArray<ISymbol> GetSymbolsOffOfExpression( CSharpSyntaxContext context, ExpressionSyntax originalExpression, CancellationToken cancellationToken) { var expression = originalExpression.WalkDownParentheses(); var leftHandBinding = context.SemanticModel.GetSymbolInfo(expression, cancellationToken); var container = context.SemanticModel.GetTypeInfo(expression, cancellationToken).Type; var normalSymbols = GetSymbolsOffOfBoundExpression(context, originalExpression, expression, leftHandBinding, container, cancellationToken); // Check for the Color Color case. if (originalExpression.CanAccessInstanceAndStaticMembersOffOf(context.SemanticModel, cancellationToken)) { var speculativeSymbolInfo = context.SemanticModel.GetSpeculativeSymbolInfo(expression.SpanStart, expression, SpeculativeBindingOption.BindAsTypeOrNamespace); var typeMembers = GetSymbolsOffOfBoundExpression(context, originalExpression, expression, speculativeSymbolInfo, container, cancellationToken); normalSymbols = normalSymbols.Concat(typeMembers); } return normalSymbols; }
private static IEnumerable<ISymbol> GetSymbolsOffOfExpression( CSharpSyntaxContext context, ExpressionSyntax originalExpression, CancellationToken cancellationToken) { var expression = originalExpression.WalkDownParentheses(); var leftHandBinding = context.SemanticModel.GetSymbolInfo(expression, cancellationToken); var container = context.SemanticModel.GetTypeInfo(expression, cancellationToken).Type; // TODO remove this when 531549 which causes GetTypeInfo to return an error type is fixed if (container.IsErrorType()) { container = leftHandBinding.Symbol.GetSymbolType() as ITypeSymbol; } var normalSymbols = GetSymbolsOffOfBoundExpression(context, originalExpression, expression, leftHandBinding, container, cancellationToken); // Check for the Color Color case. if (originalExpression.CanAccessInstanceAndStaticMembersOffOf(context.SemanticModel, cancellationToken)) { var speculativeSymbolInfo = context.SemanticModel.GetSpeculativeSymbolInfo(expression.SpanStart, expression, SpeculativeBindingOption.BindAsTypeOrNamespace); var typeMembers = GetSymbolsOffOfBoundExpression(context, originalExpression, expression, speculativeSymbolInfo, container, cancellationToken); normalSymbols = normalSymbols.Concat(typeMembers); } return normalSymbols; }