248 references to BindValueKind
Microsoft.CodeAnalysis.CSharp (248)
Binder\Binder.ValueChecks.cs (104)
227private const BindValueKind ValueKindSignificantBitsMask = unchecked((BindValueKind)~((1 << ValueKindInsignificantBits) - 1)); 324private static bool RequiresRValueOnly(BindValueKind kind) 326return (kind & ValueKindSignificantBitsMask) == BindValueKind.RValue; 329private static bool RequiresAssignmentOnly(BindValueKind kind) 331return (kind & ValueKindSignificantBitsMask) == BindValueKind.Assignable; 334private static bool RequiresVariable(BindValueKind kind) 339private static bool RequiresReferenceToLocation(BindValueKind kind) 341return (kind & BindValueKind.RefersToLocation) != 0; 344private static bool RequiresAssignableVariable(BindValueKind kind) 346return (kind & BindValueKind.Assignable) != 0; 349private static bool RequiresRefAssignableVariable(BindValueKind kind) 351return (kind & BindValueKind.RefAssignable) != 0; 354private static bool RequiresRefOrOut(BindValueKind kind) 356return (kind & BindValueKind.RefOrOut) == BindValueKind.RefOrOut; 361private static AccessorKind GetIndexerAccessorKind(BoundIndexerAccess indexerAccess, BindValueKind valueKind) 371private static AccessorKind GetAccessorKind(BindValueKind valueKind) 373var coreValueKind = valueKind & ValueKindSignificantBitsMask; 376BindValueKind.CompoundAssignment => AccessorKind.Both, 377BindValueKind.Assignable => AccessorKind.Set, 382private BoundIndexerAccess BindIndexerDefaultArgumentsAndParamsCollection(BoundIndexerAccess indexerAccess, BindValueKind valueKind, BindingDiagnosticBag diagnostics) 384var coreValueKind = valueKind & ValueKindSignificantBitsMask; 386var useSetAccessor = coreValueKind == BindValueKind.Assignable && indexerAccess.Indexer.RefKind != RefKind.Ref; 481private BoundExpression CheckValue(BoundExpression expr, BindValueKind valueKind, BindingDiagnosticBag diagnostics) 496Debug.Assert(expr.Syntax.Kind() != SyntaxKind.Argument || valueKind == BindValueKind.RefOrOut); 501Debug.Assert(valueKind == BindValueKind.RefOrOut); 505Debug.Assert(valueKind is (BindValueKind.Assignable or BindValueKind.RefOrOut or BindValueKind.RefAssignable) || diagnostics.DiagnosticBag is null || diagnostics.HasAnyResolvedErrors()); 553if (valueKind == BindValueKind.RValue) 560if (valueKind == BindValueKind.RValue) 567if ((valueKind & BindValueKind.RefersToLocation) == BindValueKind.RefersToLocation) 575if ((valueKind & BindValueKind.RefersToLocation) == BindValueKind.RefersToLocation) 589if (expr.Kind == BoundKind.MethodGroup && valueKind != BindValueKind.RValueOrMethodGroup) 637expr.HasAnyErrors && valueKind == BindValueKind.RValueOrMethodGroup) 642var resultKind = (valueKind == BindValueKind.RValue || valueKind == BindValueKind.RValueOrMethodGroup) ? 674internal bool CheckValueKind(SyntaxNode node, BoundExpression expr, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 732case BoundKind.MethodGroup when valueKind == BindValueKind.AddressOf: 954bool checkArrayAccessValueKind(SyntaxNode node, BindValueKind valueKind, ImmutableArray<BoundExpression> indices, BindingDiagnosticBag diagnostics) 976private static void ReportThisLvalueError(SyntaxNode node, BindValueKind valueKind, bool isValueType, bool isPrimaryConstructorParameter, BindingDiagnosticBag diagnostics) 1004private void CheckAddressOfInAsyncOrIteratorMethod(SyntaxNode node, BindValueKind valueKind, BindingDiagnosticBag diagnostics) 1006if (valueKind == BindValueKind.AddressOf) 1019private bool CheckLocalValueKind(SyntaxNode node, BoundLocal local, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 1109private bool CheckParameterValueKind(SyntaxNode node, BoundParameter parameter, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 1111Debug.Assert(!RequiresAssignableVariable(BindValueKind.AddressOf)); 1172static void reportReadOnlyParameterError(ParameterSymbol parameterSymbol, SyntaxNode node, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 1176Debug.Assert(valueKind != BindValueKind.AddressOf); // If this assert fails, we probably should report ErrorCode.ERR_InvalidAddrOp 1182if (valueKind == BindValueKind.RefReturn) 1201if (valueKind == BindValueKind.RefReturn) 1317private bool CheckFieldValueKind(SyntaxNode node, BoundFieldAccess fieldAccess, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 1363Debug.Assert(valueKind == BindValueKind.RefAssignable); 1372return CheckIsValidReceiverForVariable(node, fieldAccess.ReceiverOpt, BindValueKind.Assignable, diagnostics); 1457private bool CheckSimpleAssignmentValueKind(SyntaxNode node, BoundAssignmentOperator assignment, BindValueKind valueKind, BindingDiagnosticBag diagnostics) 1536private bool CheckEventValueKind(BoundEventAccess boundEvent, BindValueKind valueKind, BindingDiagnosticBag diagnostics) 1547if (valueKind == BindValueKind.CompoundAssignment) 1573if (!CheckIsValidReceiverForVariable(eventSyntax, receiver, BindValueKind.Assignable, diagnostics)) 1580if (eventSymbol.IsWindowsRuntimeEvent && valueKind != BindValueKind.Assignable) 1584if (valueKind == BindValueKind.RefOrOut) 1605private bool CheckIsValidReceiverForVariable(SyntaxNode node, BoundExpression receiver, BindValueKind kind, BindingDiagnosticBag diagnostics) 1635BindValueKind valueKind, 1676private bool CheckPropertyValueKind(SyntaxNode node, BoundExpression expr, BindValueKind valueKind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 1703else if (valueKind == BindValueKind.RefOrOut) 1774var setValueKind = setMethod.IsEffectivelyReadOnly ? BindValueKind.RValue : BindValueKind.Assignable; 3064private static void ReportReadonlyLocalError(SyntaxNode node, LocalSymbol local, BindValueKind kind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 3067Debug.Assert(kind != BindValueKind.RValue); 3102private static ErrorCode GetThisLvalueError(BindValueKind kind, bool isValueType, bool isPrimaryConstructorParameter) 3106case BindValueKind.CompoundAssignment: 3107case BindValueKind.Assignable: 3110case BindValueKind.RefOrOut: 3113case BindValueKind.AddressOf: 3116case BindValueKind.IncrementDecrement: 3119case BindValueKind.RefReturn: 3120case BindValueKind.ReadonlyRef: 3123case BindValueKind.RefAssignable: 3135private static ErrorCode GetRangeLvalueError(BindValueKind kind) 3139case BindValueKind.Assignable: 3140case BindValueKind.CompoundAssignment: 3141case BindValueKind.IncrementDecrement: 3144case BindValueKind.AddressOf: 3147case BindValueKind.RefReturn: 3148case BindValueKind.ReadonlyRef: 3151case BindValueKind.RefAssignable: 3163private static ErrorCode GetMethodGroupOrFunctionPointerLvalueError(BindValueKind valueKind) 3174private static ErrorCode GetStandardLvalueError(BindValueKind kind) 3178case BindValueKind.CompoundAssignment: 3179case BindValueKind.Assignable: 3182case BindValueKind.AddressOf: 3185case BindValueKind.IncrementDecrement: 3188case BindValueKind.FixedReceiver: 3191case BindValueKind.RefReturn: 3192case BindValueKind.ReadonlyRef: 3195case BindValueKind.RefAssignable: 3223private static void ReportReadOnlyFieldError(FieldSymbol field, SyntaxNode node, BindValueKind kind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 3231Debug.Assert(kind != BindValueKind.AddressOf); // If this assert fails, we probably should report ErrorCode.ERR_InvalidAddrOp 3248int index = (checkingReceiver ? 6 : 0) + (field.IsStatic ? 3 : 0) + (kind == BindValueKind.RefReturn ? 0 : (RequiresRefOrOut(kind) ? 1 : 2)); 3259private static void ReportReadOnlyError(Symbol symbol, SyntaxNode node, BindValueKind kind, bool checkingReceiver, BindingDiagnosticBag diagnostics) 3266if (kind == BindValueKind.AddressOf) 3284int 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); 2539BoundExpression operand = this.BindValue(node.Expression, diagnostics, BindValueKind.RValue); 2564BoundExpression boundOperand = BindValue(node.Operand, diagnostics, BindValueKind.RValue); 2672BoundExpression boundOperand = BindValue(operand, diagnostics, BindValueKind.RValue); 3075var requiredValueKind = origRefKind == RefKind.In ? BindValueKind.ReadonlyRef : BindValueKind.RefOrOut; 3354BindValueKind valueKind = 3356BindValueKind.RValue : 3358BindValueKind.ReadonlyRef : 3359BindValueKind.RefOrOut; 3441if (!this.CheckValueKind(argument.Syntax, argument, BindValueKind.RefersToLocation, checkingReceiver: false, BindingDiagnosticBag.Discarded)) 3453if (this.CheckValueKind(argument.Syntax, argument, BindValueKind.Assignable, checkingReceiver: false, BindingDiagnosticBag.Discarded)) 4040var size = BindValue(dimension, diagnostics, BindValueKind.RValue); 4156var boundExpression = BindValue(expression, diagnostics, BindValueKind.RValue); 4173var boundExpression = BindValue(expression, diagnostics, BindValueKind.RValue); 4502count = BindValue(countSyntax, diagnostics, BindValueKind.RValue); 5217ExpressionElementSyntax expressionElementSyntax => @this.BindValue(expressionElementSyntax.Expression, diagnostics, BindValueKind.RValue), 5591BindValueKind rhsValueKind, 5603Debug.Assert(rhsValueKind == BindValueKind.RValue); 5691var rhsKind = isRef ? GetRequiredRHSValueKindForRefAssignment(boundLeft) : BindValueKind.RValue; 5739var boundExpression = BindValue(memberInitializer, diagnostics, BindValueKind.RValue); 5754BindValueKind valueKind = isRhsNestedInitializer ? BindValueKind.RValue : (isRef ? BindValueKind.RefAssignable : BindValueKind.Assignable); 5767leftSyntax, implicitReceiver, BindValueKind.Assignable, false, diagnostics); 5774BindValueKind valueKind, 6016BindValueKind valueKind, 6050return ToBadExpression(boundMember, (valueKind == BindValueKind.RValue) ? LookupResultKind.NotAValue : LookupResultKind.NotAVariable); 6305var boundElementInitializer = BindInitializerExpressionOrValue(elementInitializer, initializerType, BindValueKind.RValue, implicitReceiver.Syntax, diagnostics); 6334exprBuilder.Add(BindValue(childElementInitializer, diagnostics, BindValueKind.RValue)); 7624boundLeft = CheckValue(boundLeft, BindValueKind.RValue, diagnostics); 7734boundLeft = CheckValue(boundLeft, BindValueKind.RValue, diagnostics); 8576hasError = !CheckValueKind(node, receiver, BindValueKind.FixedReceiver, checkingReceiver: false, diagnostics: diagnostics); 8989receiver = CheckValue(receiver, BindValueKind.RValue, diagnostics); 9119if (CheckValueKind(node, expr, BindValueKind.RefersToLocation | BindValueKind.Assignable, checkingReceiver: false, BindingDiagnosticBag.Discarded)) 9131if (!CheckValueKind(node, expr, BindValueKind.RefersToLocation, checkingReceiver: false, BindingDiagnosticBag.Discarded)) 10154lengthOrCountAccess = CheckValue(lengthOrCountAccess, BindValueKind.RValue, diagnostics); 10949var 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; 1826BindValueKind valueKind, 2639var expr = BindValue(node, diagnostics, BindValueKind.RValue); 2994BindValueKind requiredValueKind = GetRequiredReturnValueKind(refKind); 3575BindValueKind requiredValueKind = bodyBinder.GetRequiredReturnValueKind(refKind); 3591BindValueKind requiredValueKind = GetRequiredReturnValueKind(refKind); 3605private BindValueKind GetRequiredReturnValueKind(RefKind refKind) 3607BindValueKind requiredValueKind = BindValueKind.RValue; 3612BindValueKind.RefReturn : 3613BindValueKind.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),