248 references to BindValueKind
Microsoft.CodeAnalysis.CSharp (248)
Binder\Binder.ValueChecks.cs (104)
250private const BindValueKind ValueKindSignificantBitsMask = unchecked((BindValueKind)~((1 << ValueKindInsignificantBits) - 1)); 347private static bool RequiresRValueOnly(BindValueKind kind) 349return (kind & ValueKindSignificantBitsMask) == BindValueKind.RValue; 352private static bool RequiresAssignmentOnly(BindValueKind kind) 354return (kind & ValueKindSignificantBitsMask) == BindValueKind.Assignable; 357private static bool RequiresVariable(BindValueKind kind) 362private static bool RequiresReferenceToLocation(BindValueKind kind) 364return (kind & BindValueKind.RefersToLocation) != 0; 367private static bool RequiresAssignableVariable(BindValueKind kind) 369return (kind & BindValueKind.Assignable) != 0; 372private static bool RequiresRefAssignableVariable(BindValueKind kind) 374return (kind & BindValueKind.RefAssignable) != 0; 377private static bool RequiresRefOrOut(BindValueKind kind) 379return (kind & BindValueKind.RefOrOut) == BindValueKind.RefOrOut; 384private static AccessorKind GetIndexerAccessorKind(BoundIndexerAccess indexerAccess, BindValueKind valueKind) 394private static AccessorKind GetAccessorKind(BindValueKind valueKind) 396var coreValueKind = valueKind & ValueKindSignificantBitsMask; 399BindValueKind.CompoundAssignment => AccessorKind.Both, 400BindValueKind.Assignable => AccessorKind.Set, 405private BoundIndexerAccess BindIndexerDefaultArgumentsAndParamsCollection(BoundIndexerAccess indexerAccess, BindValueKind valueKind, BindingDiagnosticBag diagnostics) 407var coreValueKind = valueKind & ValueKindSignificantBitsMask; 409var useSetAccessor = coreValueKind == BindValueKind.Assignable && indexerAccess.Indexer.RefKind != RefKind.Ref; 504private BoundExpression CheckValue(BoundExpression expr, BindValueKind valueKind, BindingDiagnosticBag diagnostics) 519Debug.Assert(expr.Syntax.Kind() != SyntaxKind.Argument || valueKind == BindValueKind.RefOrOut); 524Debug.Assert(valueKind == BindValueKind.RefOrOut); 528Debug.Assert(valueKind is (BindValueKind.Assignable or BindValueKind.RefOrOut or BindValueKind.RefAssignable) || diagnostics.DiagnosticBag is null || diagnostics.HasAnyResolvedErrors()); 576if (valueKind == BindValueKind.RValue) 583if (valueKind == BindValueKind.RValue) 590if ((valueKind & BindValueKind.RefersToLocation) == BindValueKind.RefersToLocation) 598if ((valueKind & BindValueKind.RefersToLocation) == BindValueKind.RefersToLocation) 612if (expr.Kind == BoundKind.MethodGroup && valueKind != BindValueKind.RValueOrMethodGroup) 660expr.HasAnyErrors && valueKind == BindValueKind.RValueOrMethodGroup) 665var resultKind = (valueKind == BindValueKind.RValue || valueKind == BindValueKind.RValueOrMethodGroup) ? 697internal bool CheckValueKind(SyntaxNode node, BoundExpression expr, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 755case BoundKind.MethodGroup when valueKind == BindValueKind.AddressOf: 977bool checkArrayAccessValueKind(SyntaxNode node, BindValueKind valueKind, ImmutableArray<BoundExpression> indices, BindingDiagnosticBag diagnostics) 999private static void ReportThisLvalueError(SyntaxNode node, BindValueKind valueKind, bool isValueType, bool isPrimaryConstructorParameter, BindingDiagnosticBag diagnostics) 1027private void CheckAddressOfInAsyncOrIteratorMethod(SyntaxNode node, BindValueKind valueKind, BindingDiagnosticBag diagnostics) 1029if (valueKind == BindValueKind.AddressOf) 1042private bool CheckLocalValueKind(SyntaxNode node, BoundLocal local, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 1132private bool CheckParameterValueKind(SyntaxNode node, BoundParameter parameter, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 1134Debug.Assert(!RequiresAssignableVariable(BindValueKind.AddressOf)); 1195static void reportReadOnlyParameterError(ParameterSymbol parameterSymbol, SyntaxNode node, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 1199Debug.Assert(valueKind != BindValueKind.AddressOf); // If this assert fails, we probably should report ErrorCode.ERR_InvalidAddrOp 1205if (valueKind == BindValueKind.RefReturn) 1224if (valueKind == BindValueKind.RefReturn) 1340private bool CheckFieldValueKind(SyntaxNode node, BoundFieldAccess fieldAccess, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 1386Debug.Assert(valueKind == BindValueKind.RefAssignable); 1395return CheckIsValidReceiverForVariable(node, fieldAccess.ReceiverOpt, BindValueKind.Assignable, diagnostics); 1480private bool CheckSimpleAssignmentValueKind(SyntaxNode node, BoundAssignmentOperator assignment, BindValueKind valueKind, BindingDiagnosticBag diagnostics) 1559private bool CheckEventValueKind(BoundEventAccess boundEvent, BindValueKind valueKind, BindingDiagnosticBag diagnostics) 1570if (valueKind == BindValueKind.CompoundAssignment) 1596if (!CheckIsValidReceiverForVariable(eventSyntax, receiver, BindValueKind.Assignable, diagnostics)) 1603if (eventSymbol.IsWindowsRuntimeEvent && valueKind != BindValueKind.Assignable) 1607if (valueKind == BindValueKind.RefOrOut) 1628private bool CheckIsValidReceiverForVariable(SyntaxNode node, BoundExpression receiver, BindValueKind kind, BindingDiagnosticBag diagnostics) 1658BindValueKind valueKind, 1699private bool CheckPropertyValueKind(SyntaxNode node, BoundExpression expr, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 1726else if (valueKind == BindValueKind.RefOrOut) 1797var setValueKind = setMethod.IsEffectivelyReadOnly ? BindValueKind.RValue : BindValueKind.Assignable; 3087private static void ReportReadonlyLocalError(SyntaxNode node, LocalSymbol local, BindValueKind kind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 3090Debug.Assert(kind != BindValueKind.RValue); 3125private static ErrorCode GetThisLvalueError(BindValueKind kind, bool isValueType, bool isPrimaryConstructorParameter) 3129case BindValueKind.CompoundAssignment: 3130case BindValueKind.Assignable: 3133case BindValueKind.RefOrOut: 3136case BindValueKind.AddressOf: 3139case BindValueKind.IncrementDecrement: 3142case BindValueKind.RefReturn: 3143case BindValueKind.ReadonlyRef: 3146case BindValueKind.RefAssignable: 3158private static ErrorCode GetRangeLvalueError(BindValueKind kind) 3162case BindValueKind.Assignable: 3163case BindValueKind.CompoundAssignment: 3164case BindValueKind.IncrementDecrement: 3167case BindValueKind.AddressOf: 3170case BindValueKind.RefReturn: 3171case BindValueKind.ReadonlyRef: 3174case BindValueKind.RefAssignable: 3186private static ErrorCode GetMethodGroupOrFunctionPointerLvalueError(BindValueKind valueKind) 3197private static ErrorCode GetStandardLvalueError(BindValueKind kind) 3201case BindValueKind.CompoundAssignment: 3202case BindValueKind.Assignable: 3205case BindValueKind.AddressOf: 3208case BindValueKind.IncrementDecrement: 3211case BindValueKind.FixedReceiver: 3214case BindValueKind.RefReturn: 3215case BindValueKind.ReadonlyRef: 3218case BindValueKind.RefAssignable: 3246private static void ReportReadOnlyFieldError(FieldSymbol field, SyntaxNode node, BindValueKind kind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 3254Debug.Assert(kind != BindValueKind.AddressOf); // If this assert fails, we probably should report ErrorCode.ERR_InvalidAddrOp 3271int index = (checkingReceiver ? 6 : 0) + (field.IsStatic ? 3 : 0) + (kind == BindValueKind.RefReturn ? 0 : (RequiresRefOrOut(kind) ? 1 : 2)); 3282private static void ReportReadOnlyError(Symbol symbol, SyntaxNode node, BindValueKind kind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 3289if (kind == BindValueKind.AddressOf) 3307int index = (checkingReceiver ? 3 : 0) + (kind == BindValueKind.RefReturn ? 0 : (RequiresRefOrOut(kind) ? 1 : 2));
Binder\Binder_Attributes.cs (1)
561BoundExpression namedArgumentValue = this.BindValue(namedArgument.Expression, diagnostics, BindValueKind.RValue);
Binder\Binder_Conversions.cs (3)
455if (CheckValueKind(syntax, source, BindValueKind.RefersToLocation, checkingReceiver: false, BindingDiagnosticBag.Discarded)) 470if (CheckValueKind(syntax, source, BindValueKind.RefersToLocation | BindValueKind.Assignable, checkingReceiver: false, BindingDiagnosticBag.Discarded))
Binder\Binder_Deconstruct.cs (3)
99BoundExpression boundRight = rightPlaceholder ?? BindValue(right, deconstructionDiagnostics, BindValueKind.RValue); 658memberAccess = CheckValue(memberAccess, BindValueKind.RValueOrMethodGroup, diagnostics); 791var checkedVariable = CheckValue(boundVariable, BindValueKind.Assignable, diagnostics);
Binder\Binder_Expressions.cs (54)
236internal BoundExpression BindValue(ExpressionSyntax node, BindingDiagnosticBag diagnostics, BindValueKind valueKind) 244return BindToNaturalType(BindValue(node, diagnostics, BindValueKind.RValue), diagnostics, reportNoTargetType); 261return CheckValue(valueOrType, BindValueKind.RValue, diagnostics); 430internal BoundExpression BindValueAllowArgList(ExpressionSyntax node, BindingDiagnosticBag diagnostics, BindValueKind valueKind) 475BindValueKind valueKind; 506valueBeforeConversion = defaultValueBinder.BindValue(defaultValueSyntax.Value, diagnostics, BindValueKind.RValue); 524var initializer = initializerBinder.BindValue(equalsValueSyntax.Value, diagnostics, BindValueKind.RValue); 854node, LookupResultKind.Empty, ImmutableArray<Symbol>.Empty, ImmutableArray.Create<BoundExpression>(BindToTypeForErrorRecovery(BindValue(node.Expression, BindingDiagnosticBag.Discarded, BindValueKind.RefersToLocation))), 1006ImmutableArray.Create(BindValue(arguments[0].Expression, diagnostics, BindValueKind.RValue)) : 1036BoundExpression boundArgument = BindValue(argumentSyntax.Expression, diagnostics, BindValueKind.RValue); 1217BoundExpression argument = BindValue(node.Expression, diagnostics, BindValueKind.RValue); 1240BoundExpression argument = this.BindValue(node.Expression, diagnostics, BindValueKind.RefOrOut); 1265BoundExpression argument = BindValue(node.Expression, diagnostics, BindValueKind.RValue); 2536BoundExpression operand = this.BindValue(node.Expression, diagnostics, BindValueKind.RValue); 2561BoundExpression boundOperand = BindValue(node.Operand, diagnostics, BindValueKind.RValue); 2669BoundExpression boundOperand = BindValue(operand, diagnostics, BindValueKind.RValue); 3072var requiredValueKind = origRefKind == RefKind.In ? BindValueKind.ReadonlyRef : BindValueKind.RefOrOut; 3351BindValueKind valueKind = 3353BindValueKind.RValue : 3355BindValueKind.ReadonlyRef : 3356BindValueKind.RefOrOut; 3438if (!this.CheckValueKind(argument.Syntax, argument, BindValueKind.RefersToLocation, checkingReceiver: false, BindingDiagnosticBag.Discarded)) 3450if (this.CheckValueKind(argument.Syntax, argument, BindValueKind.Assignable, checkingReceiver: false, BindingDiagnosticBag.Discarded)) 4037var size = BindValue(dimension, diagnostics, BindValueKind.RValue); 4153var boundExpression = BindValue(expression, diagnostics, BindValueKind.RValue); 4170var boundExpression = BindValue(expression, diagnostics, BindValueKind.RValue); 4499count = BindValue(countSyntax, diagnostics, BindValueKind.RValue); 5214ExpressionElementSyntax expressionElementSyntax => @this.BindValue(expressionElementSyntax.Expression, diagnostics, BindValueKind.RValue), 5588BindValueKind rhsValueKind, 5600Debug.Assert(rhsValueKind == BindValueKind.RValue); 5688var rhsKind = isRef ? GetRequiredRHSValueKindForRefAssignment(boundLeft) : BindValueKind.RValue; 5736var boundExpression = BindValue(memberInitializer, diagnostics, BindValueKind.RValue); 5751BindValueKind valueKind = isRhsNestedInitializer ? BindValueKind.RValue : (isRef ? BindValueKind.RefAssignable : BindValueKind.Assignable); 5764leftSyntax, implicitReceiver, BindValueKind.Assignable, false, diagnostics); 5771BindValueKind valueKind, 6013BindValueKind valueKind, 6047return ToBadExpression(boundMember, (valueKind == BindValueKind.RValue) ? LookupResultKind.NotAValue : LookupResultKind.NotAVariable); 6302var boundElementInitializer = BindInitializerExpressionOrValue(elementInitializer, initializerType, BindValueKind.RValue, implicitReceiver.Syntax, diagnostics); 6331exprBuilder.Add(BindValue(childElementInitializer, diagnostics, BindValueKind.RValue)); 7621boundLeft = CheckValue(boundLeft, BindValueKind.RValue, diagnostics); 7731boundLeft = CheckValue(boundLeft, BindValueKind.RValue, diagnostics); 8573hasError = !CheckValueKind(node, receiver, BindValueKind.FixedReceiver, checkingReceiver: false, diagnostics: diagnostics); 8986receiver = CheckValue(receiver, BindValueKind.RValue, diagnostics); 9116if (CheckValueKind(node, expr, BindValueKind.RefersToLocation | BindValueKind.Assignable, checkingReceiver: false, BindingDiagnosticBag.Discarded)) 9128if (!CheckValueKind(node, expr, BindValueKind.RefersToLocation, checkingReceiver: false, BindingDiagnosticBag.Discarded)) 10151lengthOrCountAccess = CheckValue(lengthOrCountAccess, BindValueKind.RValue, diagnostics); 10946var access = conditionalAccessBinder.BindValue(node.WhenNotNull, diagnostics, BindValueKind.RValue);
Binder\Binder_InterpolatedString.cs (2)
90var value = BindValue(interpolation.Expression, diagnostics, BindValueKind.RValue); 101alignment = GenerateConversionForAssignment(intType, BindValue(interpolation.AlignmentClause.Value, diagnostics, Binder.BindValueKind.RValue), diagnostics);
Binder\Binder_Invocation.cs (8)
125boundExpression = CheckValue(boundExpression, BindValueKind.RValueOrMethodGroup, diagnostics); 245boundExpression = CheckValue(boundExpression, BindValueKind.RValueOrMethodGroup, diagnostics); 1230receiverArgument = CheckValue(receiverArgument, BindValueKind.RefOrOut, diagnostics); 1341var valueKind = method.IsEffectivelyReadOnly 1342? BindValueKind.RefersToLocation 1343: BindValueKind.RefersToLocation | BindValueKind.Assignable; 1860return CheckValue(typeOrValue.Data.ValueExpression, BindValueKind.RValue, diagnostics);
Binder\Binder_Operators.cs (24)
27BoundExpression right = BindValue(node.Right, diagnostics, BindValueKind.RValue); 99if (left.Kind == BoundKind.EventAccess && !CheckEventValueKind((BoundEventAccess)left, BindValueKind.Assignable, diagnostics)) 494BindValueKind bindValueKind = GetBinaryAssignmentKind(syntaxNode.Kind()); 496BoundExpression right = BindValue(syntaxNode.Right, diagnostics, BindValueKind.RValue); 2264BoundExpression operand = BindToNaturalType(BindValue(operandSyntax, diagnostics, BindValueKind.IncrementDecrement), diagnostics); 2512BoundExpression operand = BindToNaturalType(BindValue(node.Operand, diagnostics, BindValueKind.AddressOf), diagnostics); 2599bool receiverIsLValue = CheckValueKind(receiver.Syntax, receiver, BindValueKind.AddressOf, checkingReceiver: false, diagnostics: BindingDiagnosticBag.Discarded); 3024private static BindValueKind GetBinaryAssignmentKind(SyntaxKind kind) 3029return BindValueKind.Assignable; 3042return BindValueKind.CompoundAssignment; 3044return BindValueKind.RValue; 3048private static BindValueKind GetUnaryAssignmentKind(SyntaxKind kind) 3056return BindValueKind.IncrementDecrement; 3061return BindValueKind.RValue; 3982var leftOperand = BindValue(node.Left, diagnostics, BindValueKind.RValue); 3984var rightOperand = BindValue(node.Right, diagnostics, BindValueKind.RValue); 4171BoundExpression leftOperand = BindValue(node.Left, diagnostics, BindValueKind.CompoundAssignment); 4173BoundExpression rightOperand = BindValue(node.Right, diagnostics, BindValueKind.RValue); 4300BoundExpression trueExpr = BindValue(whenTrue, diagnostics, BindValueKind.RValue); 4301BoundExpression falseExpr = BindValue(whenFalse, diagnostics, BindValueKind.RValue); 4341BoundExpression trueExpr = BindValue(whenTrue, diagnostics, BindValueKind.RValue | BindValueKind.RefersToLocation); 4342BoundExpression falseExpr = BindValue(whenFalse, diagnostics, BindValueKind.RValue | BindValueKind.RefersToLocation);
Binder\Binder_Patterns.cs (5)
239indexerAccess = CheckValue(indexerAccess, BindValueKind.RValue, diagnostics); 388indexerAccess = CheckValue(indexerAccess, BindValueKind.RValue, diagnostics); 536expression = CheckValue(expression, BindValueKind.RValue, diagnostics); 1588boundMember = CheckValue(boundMember, BindValueKind.RValue, diagnostics); 1601if (!hasErrors && !CheckValueKind(node: memberName.Parent, expr: boundMember, valueKind: BindValueKind.RValue,
Binder\Binder_Query.cs (3)
837BoundExpression boundExpression = lambdaBodyBinder.BindValue(expression, diagnostics, BindValueKind.RValue); 847BoundExpression boundExpression = lambdaBodyBinder.BindValue(expression, diagnostics, BindValueKind.RValue); 1001var checkedUltimateReceiver = CheckValue(ultimateReceiver, BindValueKind.RValue, diagnostics);
Binder\Binder_Statements.cs (28)
240: BindValue(node.Expression, diagnostics, BindValueKind.RValue); 395var boundExpr = BindValue(exprSyntax, diagnostics, BindValueKind.RValue); 864BindValueKind valueKind; 871protected BoundExpression BindInferredVariableInitializer(BindingDiagnosticBag diagnostics, ExpressionSyntax initializer, BindValueKind valueKind, CSharpSyntaxNode errorSyntax) 912out BindValueKind valueKind, 919valueKind = BindValueKind.RValue; 929? BindValueKind.ReadonlyRef 930: BindValueKind.RefOrOut; 1005BindValueKind valueKind; 1417var lhsKind = isRef ? BindValueKind.RefAssignable : BindValueKind.Assignable; 1425var rhsKind = isRef ? GetRequiredRHSValueKindForRefAssignment(op1) : BindValueKind.RValue; 1438private static BindValueKind GetRequiredRHSValueKindForRefAssignment(BoundExpression boundLeft) 1440var rhsKind = BindValueKind.RefersToLocation; 1450rhsKind |= BindValueKind.Assignable; 1823BindValueKind valueKind, 2636var expr = BindValue(node, diagnostics, BindValueKind.RValue); 2991BindValueKind requiredValueKind = GetRequiredReturnValueKind(refKind); 3572BindValueKind requiredValueKind = bodyBinder.GetRequiredReturnValueKind(refKind); 3588BindValueKind requiredValueKind = GetRequiredReturnValueKind(refKind); 3602private BindValueKind GetRequiredReturnValueKind(RefKind refKind) 3604BindValueKind requiredValueKind = BindValueKind.RValue; 3609BindValueKind.RefReturn : 3610BindValueKind.ReadonlyRef;
Binder\ForEachLoopBinder.cs (9)
333BindValueKind requiredCurrentKind; 337requiredCurrentKind = BindValueKind.RValue; 340requiredCurrentKind = BindValueKind.Assignable | BindValueKind.RefersToLocation; 343requiredCurrentKind = BindValueKind.RefersToLocation; 611BoundExpression collectionExpr = this.GetBinder(collectionSyntax).BindValue(collectionSyntax, diagnostics, BindValueKind.RValue); 821if (CheckValueKind(collectionExpr.Syntax, collectionExpr, BindValueKind.RefersToLocation | BindValueKind.Assignable, checkingReceiver: false, BindingDiagnosticBag.Discarded)) 829if (!CheckValueKind(collectionExpr.Syntax, collectionExpr, BindValueKind.RefersToLocation, checkingReceiver: false, BindingDiagnosticBag.Discarded))
Binder\LockOrUsingBinder.cs (1)
84BoundExpression boundExpression = originalBinder.BindValue(TargetExpressionSyntax, expressionDiagnostics, Binder.BindValueKind.RValueOrMethodGroup);
Binder\SwitchBinder.cs (1)
497gotoCaseExpressionOpt = gotoBinder.BindValue(node.Expression, diagnostics, BindValueKind.RValue);
Binder\SwitchExpressionArmBinder.cs (1)
46BoundExpression armResult = armBinder.BindValue(node.Expression, diagnostics, BindValueKind.RValue);
Symbols\Source\SourceFixedFieldSymbol.cs (1)
92binder.BindValue(sizeExpression, diagnostics, Binder.BindValueKind.RValue),