private bool TryInitializeAssignmentCase() { if (!_syntaxFacts.IsSimpleAssignmentStatement(_containingStatement)) { return(false); } _syntaxFacts.GetPartsOfAssignmentStatement(_containingStatement, out var left, out var right); if (right != _objectCreationExpression) { return(false); } var typeInfo = _semanticModel.GetTypeInfo(left, _cancellationToken); if (typeInfo.Type is IDynamicTypeSymbol || typeInfo.ConvertedType is IDynamicTypeSymbol) { // Not supported if we're initializing something dynamic. The object we're instantiating // may not have the members that we're trying to access on the dynamic object. return(false); } _valuePattern = left; _initializedSymbol = _semanticModel.GetSymbolInfo(left, _cancellationToken).GetAnySymbol(); return(true); }
public static void GetPartsOfAssignmentStatement( this ISyntaxFacts syntaxFacts, SyntaxNode statement, out SyntaxNode left, out SyntaxNode right ) { syntaxFacts.GetPartsOfAssignmentStatement(statement, out left, out _, out right); }