Binder\Binder.ValueChecks.cs (78)
465BindDefaultArguments(indexerAccess.Syntax, parameters, argumentsBuilder, refKindsBuilderOpt, namesBuilder, ref argsToParams, out defaultArguments, indexerAccess.Expanded, enableCallerInfo: true, diagnostics);
519Debug.Assert(expr.Syntax.Kind() != SyntaxKind.Argument || valueKind == BindValueKind.RefOrOut);
617diagnostics.Add(expr.Syntax, useSiteInfo);
651expr.Syntax,
659if (!hasResolutionErrors && CheckValueKind(expr.Syntax, expr, valueKind, checkingReceiver: false, diagnostics: diagnostics) ||
875return CheckMethodReturnValueKind(call.Method, call.Syntax, node, valueKind, checkingReceiver, diagnostics);
879expr.Syntax,
893return CheckMethodReturnValueKind(sliceAccess.Method, sliceAccess.Syntax, node, valueKind, checkingReceiver, diagnostics);
918return CheckMethodReturnValueKind(getItemOrSliceHelper, elementAccess.Syntax, node, valueKind, checkingReceiver, diagnostics);
938(CheckValueKind(conditional.Consequence.Syntax, conditional.Consequence, valueKind, checkingReceiver: false, diagnostics: diagnostics) &
939CheckValueKind(conditional.Alternative.Syntax, conditional.Alternative, valueKind, checkingReceiver: false, diagnostics: diagnostics)))
1017Error(diagnostics, ErrorCode.ERR_BadSKknown, expr.Syntax, ((BoundNamespaceExpression)expr).NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize(), MessageID.IDS_SK_VARIABLE.Localize());
1020Error(diagnostics, ErrorCode.ERR_BadSKunknown, expr.Syntax, expr.Type, MessageID.IDS_SK_TYPE.Localize());
1055diagnostics.Add(ErrorCode.WRN_AssignmentToLockOrDispose, local.Syntax.Location, localSymbol);
1105Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_RefReturnLocal2 : ErrorCode.ERR_RefReturnLocal2, local.Syntax, localSymbol);
1116Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_RefReturnNonreturnableLocal2 : ErrorCode.ERR_RefReturnNonreturnableLocal2, local.Syntax, localSymbol);
1189diagnostics.Add(ErrorCode.WRN_AssignmentToLockOrDispose, parameter.Syntax.Location, parameterSymbol.Name);
1315(checkingReceiver: true, isRefScoped: true, inUnsafeRegion: false, _) => (ErrorCode.ERR_RefReturnScopedParameter2, parameter.Syntax),
1316(checkingReceiver: true, isRefScoped: true, inUnsafeRegion: true, _) => (ErrorCode.WRN_RefReturnScopedParameter2, parameter.Syntax),
1317(checkingReceiver: true, isRefScoped: false, inUnsafeRegion: false, ReturnOnlyScope) => (ErrorCode.ERR_RefReturnOnlyParameter2, parameter.Syntax),
1318(checkingReceiver: true, isRefScoped: false, inUnsafeRegion: true, ReturnOnlyScope) => (ErrorCode.WRN_RefReturnOnlyParameter2, parameter.Syntax),
1319(checkingReceiver: true, isRefScoped: false, inUnsafeRegion: false, _) => (ErrorCode.ERR_RefReturnParameter2, parameter.Syntax),
1320(checkingReceiver: true, isRefScoped: false, inUnsafeRegion: true, _) => (ErrorCode.WRN_RefReturnParameter2, parameter.Syntax),
1724Error(diagnostics, ErrorCode.ERR_ReturnNotLValue, expr.Syntax, propertySymbol);
2220return CheckValEscape(receiver.Syntax, receiver, escapeFrom, escapeTo, false, diagnostics);
2324receiver = new BoundCapturedReceiverPlaceholder(receiver.Syntax, receiver, _localScopeDepth, receiver.Type).MakeCompilerGenerated();
3325CheckRefEscape(expr.Syntax, expr, _localScopeDepth, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
3329CheckValEscape(expr.Syntax, expr, _localScopeDepth, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
3737return CheckRefEscape(conditional.Consequence.Syntax, conditional.Consequence, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics) &&
3738CheckRefEscape(conditional.Alternative.Syntax, conditional.Alternative, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
3769call.Syntax,
3795indexerAccess.Syntax,
3826indexerAccess.Syntax,
3852call.Syntax,
3888elementAccess.Syntax,
3913functionPointerInvocation.Syntax,
3938propertyAccess.Syntax,
4796Error(diagnostics, inUnsafeRegion ? ErrorCode.WRN_EscapeVariable : ErrorCode.ERR_EscapeVariable, node, expr.Syntax);
4813return CheckValEscape(underlyingReceiver.Syntax, underlyingReceiver, escapeFrom, escapeTo, checkingReceiver, diagnostics);
4828CheckValEscape(conditional.Consequence.Syntax, conditional.Consequence, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics) &&
4829CheckValEscape(conditional.Alternative.Syntax, conditional.Alternative, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
4836var consValid = CheckValEscape(conditional.Consequence.Syntax, conditional.Consequence, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
4845return CheckValEscape(conditional.Alternative.Syntax, conditional.Alternative, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
4850return CheckValEscape(coalescingOp.LeftOperand.Syntax, coalescingOp.LeftOperand, escapeFrom, escapeTo, checkingReceiver, diagnostics) &&
4851CheckValEscape(coalescingOp.RightOperand.Syntax, coalescingOp.RightOperand, escapeFrom, escapeTo, checkingReceiver, diagnostics);
4872call.Syntax,
4892ptrInvocation.Syntax,
4912indexerAccess.Syntax,
4938indexerAccess.Syntax,
4960call.Syntax,
4987elementAccess.Syntax,
5007propertyAccess.Syntax,
5027objectCreation.Syntax,
5046initializerExpr.Syntax,
5067initializerExpr.Syntax,
5084escape = escape && CheckValEscape(initializerExpr.Syntax, initializerExpr, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
5094unary.Syntax,
5141conversion.Syntax,
5162conversion.Syntax,
5197compound.Syntax,
5212return CheckValEscape(compound.Left.Syntax, compound.Left, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics) &&
5213CheckValEscape(compound.Right.Syntax, compound.Right, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
5226binary.Syntax,
5241return CheckValEscape(binary.Left.Syntax, binary.Left, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics) &&
5242CheckValEscape(binary.Right.Syntax, binary.Right, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
5247if (range.LeftOperandOpt is { } left && !CheckValEscape(left.Syntax, left, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics))
5252return !(range.RightOperandOpt is { } right && !CheckValEscape(right.Syntax, right, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics));
5258uo.Syntax,
5274return CheckValEscape(clauseValue.Syntax, clauseValue, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
5278return CheckValEscape(variableValue.Syntax, variableValue, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics);
5298return CheckValEscape(accessedExpression.Syntax, accessedExpression, escapeFrom, escapeTo, checkingReceiver, diagnostics);
5302return CheckValEscape(operandExpression.Syntax, operandExpression, escapeFrom, escapeTo, checkingReceiver, diagnostics);
5317if (!CheckValEscape(result.Syntax, result, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics))
5563if (!CheckValEscape(element.Syntax, element, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics))
5580Error(diagnostics, _inUnsafeRegion ? ErrorCode.WRN_EscapeVariable : ErrorCode.ERR_EscapeVariable, initExpr.Syntax, expr.Syntax);
5594if (!CheckValEscape(expression.Syntax, expression, escapeFrom, escapeTo, checkingReceiver: false, diagnostics: diagnostics))
5619CheckValEscape(expression.Syntax, data.Construction, escapeFrom, escapeTo, checkingReceiver: false, diagnostics);
Binder\Binder_Attributes.cs (9)
288Debug.Assert(boundAttribute.Syntax.Kind() == SyntaxKind.Attribute);
296return new SourceAttributeData(Compilation, (AttributeSyntax)boundAttribute.Syntax, attributeType, attributeConstructor, hasErrors);
300ValidateTypeForAttributeParameters(attributeConstructor.Parameters, ((AttributeSyntax)boundAttribute.Syntax).Name, diagnostics, ref hasErrors);
321(AttributeSyntax)boundAttribute.Syntax,
331diagnostics.Add(boundAttribute.Syntax, useSiteInfo);
335(AttributeSyntax)boundAttribute.Syntax,
891Binder.Error(diagnostics, ErrorCode.ERR_BadAttributeArgument, node.Syntax);
962Binder.Error(diagnostics, ErrorCode.ERR_AttrArgWithTypeVars, node.Syntax, typeOfArgument.ToDisplayString(SymbolDisplayFormat.CSharpErrorMessageFormat));
1046Binder.Error(diagnostics, ErrorCode.ERR_BadAttributeArgument, node.Syntax);
Binder\Binder_Conversions.cs (9)
28diagnostics.Add(source.Syntax, useSiteInfo);
29return CreateConversion(source.Syntax, source, conversion, isCast: false, conversionGroupOpt: null, destination: destination, diagnostics: diagnostics);
38return CreateConversion(source.Syntax, source, conversion, isCast: false, conversionGroupOpt: null, destination: destination, diagnostics: diagnostics);
77var placeholder2 = new BoundValuePlaceholder(source.Syntax, source.Type);
272source = new BoundDefaultExpression(source.Syntax, targetType: null, constantValue, type: destination)
284diagnostics.Add(ErrorCode.WRN_ConvertingLock, source.Syntax);
327new BoundValuePlaceholder(source.Syntax, source.Type.GetNullableUnderlyingType()),
356new BoundValuePlaceholder(source.Syntax, source.Type.GetNullableUnderlyingType()),
384new BoundValuePlaceholder(source.Syntax, sourceTypes[i].Type),
Binder\Binder_Deconstruct.cs (12)
132new BoundConversion(boundRHS.Syntax, boundRHS, Conversion.Deconstruction, @checked: false, explicitCastInCode: false, conversionGroupOpt: null,
145boundRHS.Syntax,
162boundRHS.Syntax,
228Error(diagnostics, ErrorCode.ERR_DeconstructRequiresExpression, boundRHS.Syntax);
408variables[i] = new DeconstructionVariable(errorLocal, errorLocal.Syntax);
414Error(diagnostics, ErrorCode.ERR_TypeInferenceFailedForImplicitlyTypedDeconstructionVariable, pending.Syntax, "_");
415variables[i] = new DeconstructionVariable(pending.FailInference(this, diagnostics), pending.Syntax);
496Error(diagnostics, ErrorCode.ERR_DeconstructRequiresExpression, element.Syntax);
514Error(diagnostics, ErrorCode.ERR_DeconstructRequiresExpression, element.Syntax);
519locationsBuilder.Add(element.Syntax.Location);
602return InferTupleElementName(expression.Syntax);
621var receiverSyntax = (CSharpSyntaxNode)receiver.Syntax;
Binder\Binder_Expressions.cs (81)
217expr.Syntax,
293var exprSyntax = (SwitchExpressionSyntax)expr.Syntax;
324diagnostics.Add(op.NoCommonTypeError, op.Syntax.Location, trueArg, falseArg);
338sourceTuple.Syntax,
353diagnostics.Add(ErrorCode.ERR_DefaultLiteralNoTargetType, defaultExpr.Syntax.GetLocation());
357defaultExpr.Syntax,
376diagnostics.Add(ErrorCode.ERR_ImplicitObjectCreationNoTargetType, expr.Syntax.GetLocation(), expr.Display);
396diagnostics.Add(ErrorCode.ERR_CollectionExpressionNoTargetType, expr.Syntax.GetLocation());
413var syntax = expr.Syntax;
2726GenerateAnonymousFunctionConversionError(diagnostics, operand.Syntax, (UnboundLambda)operand, targetType);
2816GenerateImplicitConversionError(diagnostics, operand.Syntax, conversion, operand, targetType);
2863GenerateExplicitConversionErrors(diagnostics, argument.Syntax, elementConversion, argument, targetElementType);
3414var available = CheckFeatureAvailability(argument.Syntax, MessageID.IDS_FeatureRefReadonlyParameters, diagnostics);
3431argument.Syntax,
3438if (!this.CheckValueKind(argument.Syntax, argument, BindValueKind.RefersToLocation, checkingReceiver: false, BindingDiagnosticBag.Discarded))
3444argument.Syntax,
3450if (this.CheckValueKind(argument.Syntax, argument, BindValueKind.Assignable, checkingReceiver: false, BindingDiagnosticBag.Discarded))
3455argument.Syntax,
3463argument.Syntax,
3524coercedArgument = CreateConversion(argument.Syntax, argument, kind, isCast: false, conversionGroupOpt: null, parameterTypeWithAnnotations.Type, diagnostics);
3545coercedArgument = CreateConversion(argument.Syntax, argument, kind, isCast: false, conversionGroupOpt: null, parameterTypeWithAnnotations.Type, diagnostics);
3669ReportUnsafeIfNotAllowed(argument.Syntax, diagnostics);
3704unconvertedString.Syntax,
3718diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerArgumentAttributeMalformed, unconvertedString.Syntax.Location, correspondingParameter, handlerType);
3720unconvertedString.Syntax,
3735unconvertedString.Syntax,
3819unconvertedString.Syntax.Location,
3858placeholderSyntax = receiver.Syntax;
3861placeholderSyntax = unconvertedString.Syntax;
3893interpolatedString.Syntax,
4392Error(diagnostics, ErrorCode.ERR_ConstantExpected, size.Syntax);
4629Error(diagnostics, ErrorCode.ERR_ConstantExpected, sizeOpt.Syntax);
5097return (parameter, boundParameter.Syntax);
5257lengthOrCount = new BoundLiteral(expression.Syntax, ConstantValue.Create(length), @this.GetSpecialType(SpecialType.System_Int32, diagnostics, expression.Syntax)) { WasCompilerGenerated = true };
5347GenerateImplicitConversionError(diagnostics, unboundLambda.Syntax, conversion, unboundLambda, type);
5360CheckParameterModifierMismatchMethodConversion(unboundLambda.Syntax, boundLambda.Symbol, type, invokedAsExtensionMethod: false, diagnostics);
5387diagnostics.Add(ErrorCode.ERR_MethodNameExpected, argument.Syntax.Location);
5411Conversion conv = Conversions.MethodGroupConversion(argument.Syntax, methodGroup, type, ref useSiteInfo);
5416argument.Syntax, default, WellKnownMemberNames.DelegateInvokeName, ImmutableArray.Create(sourceDelegate.DelegateInvokeMethod),
5432if (!this.MethodGroupConversionHasErrors(argument.Syntax, conv, argument, conv.IsExtensionMethod, isAddressOf: false, type, diagnostics))
5448diagnostics.Add(ErrorCode.ERR_MethodNameExpected, argument.Syntax.Location);
5524var result = MakeBadExpressionForObjectCreation(node.Syntax, CreateErrorType(), arguments, node.InitializerOpt, typeSyntax: node.Syntax, diagnostics);
5695typeSyntax: boundLeft.Syntax,
5916diagnostics.Add(ErrorCode.ERR_InterpolatedStringsReferencingInstanceCannotBeInObjectInitializers, argument.Syntax.Location);
5927MessageID.IDS_FeatureImplicitIndexerInitializer.CheckFeatureAvailability(diagnostics, implicitIndexer.Syntax);
5962if (!CheckValueKind(boundMember.Syntax, boundMember, valueKind, checkingReceiver: false, diagnostics: diagnostics))
6060var memberInitializerSyntax = boundMemberInitializer.Syntax;
6149diagnostics.Add(ErrorCode.ERR_RequiredMembersMustBeAssignedValue, initializerExpression.Syntax.Location, requiredMember);
6302var boundElementInitializer = BindInitializerExpressionOrValue(elementInitializer, initializerType, BindValueKind.RValue, implicitReceiver.Syntax, diagnostics);
6787CheckRequiredMembersInObjectInitializer(creation.Constructor, creation.InitializerExpressionOpt?.Initializers ?? default, creation.Syntax, diagnostics);
7843CheckFeatureAvailability(boundLeft.Syntax, MessageID.IDS_FeatureStaticAbstractMembersInInterfaces, diagnostics);
7848Error(diagnostics, ErrorCode.ERR_LookupInTypeVariable, boundLeft.Syntax, leftType);
7895diagnostics.Add(expr.Syntax, useSiteInfo);
9134if (expr.Syntax.Parent is ConditionalAccessExpressionSyntax conditional &&
9135conditional.Expression == expr.Syntax)
9137location = expr.Syntax.SyntaxTree.GetLocation(TextSpan.FromBounds(expr.Syntax.SpanStart, conditional.OperatorToken.Span.End));
9141location = expr.Syntax.GetLocation();
9156checkInlineArrayBounds(convertedIndex.Syntax, constIndex, length, excludeEnd: true, diagnostics);
9237location = hatExpression.Syntax;
9243location = operand.Syntax;
9251location = index.Syntax;
9357Error(diagnostics, ErrorCode.WRN_NegativeArrayIndex, index.Syntax);
9371var receiverPlaceholder = new BoundImplicitIndexerReceiverPlaceholder(expr.Syntax, isEquivalentToThisReference: expr.IsEquivalentToThisReference, expr.Type) { WasCompilerGenerated = true };
9372var argumentPlaceholders = ImmutableArray.Create(new BoundImplicitIndexerValuePlaceholder(convertedArguments[0].Syntax, int32) { WasCompilerGenerated = true });
9403var node = index.Syntax;
9511BoundExpression result = CreateConversion(expr.Syntax, expr, conversion, isCast: false, conversionGroupOpt: null, destination: targetType, diagnostics); // UNDONE: was cast?
9552Error(diagnostics, ErrorCode.ERR_VoidError, expr.Syntax);
9570Error(diagnostics, ErrorCode.ERR_BadArgExtraRef, analyzedArguments.Argument(i).Syntax, i + 1, refKind.ToArgumentDisplayString());
9650var syntax = propertyGroup.Syntax;
9916var receiverPlaceholder = new BoundImplicitIndexerReceiverPlaceholder(receiver.Syntax, isEquivalentToThisReference: receiver.IsEquivalentToThisReference, receiver.Type) { WasCompilerGenerated = true };
10250node, node.Syntax, node.Name, analyzedArguments, ref useSiteInfo,
10468return GetMethodGroupOrLambdaDelegateType(node.Syntax, method, hasParams: useParams);
10525PopulateExtensionMethodsFromSingleBinder(scope, methodGroup, node.Syntax, receiver, node.Name, node.TypeArgumentsOpt, BindingDiagnosticBag.Discarded);
10691PopulateExtensionMethodsFromSingleBinder(scope, methodGroup, node.Syntax, receiver, node.Name, typeArguments, BindingDiagnosticBag.Discarded);
11041diagnostics.Add(new CSDiagnostic(diagnosticInfo, access.Syntax.Location));
11042receiver = BadExpression(receiver.Syntax, receiver);
11084if (receiver?.Syntax != GetConditionalReceiverSyntax(conditionalAccessNode))
11099receiver = new BoundConditionalReceiver(receiver.Syntax, 0, receiverType ?? CreateErrorType(), hasErrors: receiver.HasErrors) { WasCompilerGenerated = true };
Binder\Binder_InterpolatedString.cs (19)
112diagnostics.Add(ErrorCode.WRN_AlignmentMagnitude, alignment.Syntax.Location, alignmentConstant.Int32Value, magnitudeLimit);
268unconvertedInterpolatedString.Syntax,
339SyntaxNode syntax = unconvertedSource.Syntax;
495binaryOperator.Syntax,
504convertedBinaryOperator = UpdateBinaryOperatorWithInterpolatedContents(binaryOperator, appendCalls, data, binaryOperator.Syntax, diagnostics);
532expression.Syntax,
542original.Syntax,
583unconvertedInterpolatedString.Syntax,
593unconvertedInterpolatedString.Syntax,
620binaryOperator.Syntax,
628var result = UpdateBinaryOperatorWithInterpolatedContents(binaryOperator, appendCalls, data, binaryOperator.Syntax, diagnostics);
689CheckFeatureAvailability(value.Syntax, MessageID.IDS_FeatureImprovedInterpolatedStrings, diagnostics);
699CheckFeatureAvailability(value.Syntax, MessageID.IDS_FeatureImprovedInterpolatedStrings, diagnostics);
853var objectType = GetSpecialType(SpecialType.System_Object, diagnostics, unconvertedInterpolatedString.Syntax);
939parameterNamesAndLocationsBuilder.Add(("alignment", insert.Alignment.Syntax.Location));
945parameterNamesAndLocationsBuilder.Add(("format", insert.Format.Syntax.Location));
975var call = MakeInvocationExpression(part.Syntax, implicitBuilderReceiver, methodName, arguments, diagnostics, names: parameterNamesAndLocations, searchExtensionMethodsIfNecessary: false);
989diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnMalformed, part.Syntax.Location, method);
999diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnInconsistent, part.Syntax.Location, method, expected);
Binder\Binder_Invocation.cs (19)
291Error(diagnostics, ErrorCode.ERR_CantUseVoidInArglist, argument.Syntax);
306Error(diagnostics, ErrorCode.ERR_CantUseInOrOutInArglist, argument.Syntax);
557Error(diagnostics, ErrorCode.ERR_CannotDynamicInvokeOnExpression, receiver.Syntax, receiver.Type);
567Error(diagnostics, ErrorCode.ERR_InDynamicMethodArg, arguments[argIndex].Syntax);
588Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArgLambda, arg.Syntax);
594Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArgMemgrp, arg.Syntax);
602Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArg, arg.Syntax, "__arglist");
611Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArg, arg.Syntax, arg.Type);
1053Error(diagnostics, ErrorCode.ERR_NoImplicitConv, call.ReceiverOpt.Syntax, distinguisher.First, distinguisher.Second);
1059Error(diagnostics, ErrorCode.ERR_NoImplicitConv, call.ReceiverOpt.Syntax, distinguisher.First, distinguisher.Second);
1073Error(diagnostics, ErrorCode.ERR_BadDynamicMethodArg, dynInvoke.Expression.Syntax, dynInvoke.Expression.Type);
1240CheckFeatureAvailability(receiverArgument.Syntax, MessageID.IDS_FeatureRefExtensionMethods, diagnostics);
1246CheckFeatureAvailability(receiverArgument.Syntax, MessageID.IDS_FeatureRefExtensionMethods, diagnostics);
1344var result = !CheckValueKind(receiver.Syntax, receiver, valueKind, checkingReceiver: true, BindingDiagnosticBag.Discarded);
1698defaultValue.Syntax,
1793Error(diagnostics, ErrorCode.WRN_ImplicitCopyInReadOnlyMember, receiver.Syntax, method, ThisParameterSymbol.SymbolName);
2255diagnostics.Add(methodGroup.Syntax, useSiteInfo);
2259diagnostics.Add(ErrorCode.ERR_NameofExtensionMethod, methodGroup.Syntax.Location);
2371boundExpression.Syntax,
Binder\Binder_Operators.cs (30)
63var placeholder = new BoundValuePlaceholder(right.Syntax, left.HasDynamicType() ? left.Type : right.Type).MakeCompilerGenerated();
243var leftPlaceholder = new BoundValuePlaceholder(left.Syntax, leftType).MakeCompilerGenerated();
786left = BindSimpleBinaryOperator((BinaryExpressionSyntax)current.Syntax, diagnostics, left ?? current.Left, right, leaveUnconvertedIfInterpolatedString: false);
822GenerateImplicitConversionError(diagnostics, right.Syntax, conversion, right, left.Type);
1074var operandPlaceholder = new BoundValuePlaceholder(left.Syntax, left.Type).MakeCompilerGenerated();
1075CreateConversion(left.Syntax, operandPlaceholder, implicitConversion, isCast: false, conversionGroupOpt: null, booleanType, diagnostics);
1082diagnostics.Add(left.Syntax, useSiteInfo);
1088diagnostics.Add(left.Syntax, useSiteInfo);
1094diagnostics.Add(left.Syntax, useSiteInfo);
1849Error(diagnostics, ErrorCode.ERR_ConstantStringTooLong, right.Syntax);
2357var operandPlaceholder = new BoundValuePlaceholder(operand.Syntax, operand.Type).MakeCompilerGenerated();
2448Error(diagnostics, ErrorCode.ERR_IllegalSuppression, expr.Syntax);
2454Error(diagnostics, ErrorCode.ERR_DuplicateNullSuppression, expr.Syntax);
2599bool receiverIsLValue = CheckValueKind(receiver.Syntax, receiver, BindValueKind.AddressOf, checkingReceiver: false, diagnostics: BindingDiagnosticBag.Discarded);
2718Error(diagnostics, ErrorCode.ERR_IllegalSuppression, expr.Syntax);
2788var resultOperand = CreateConversion(operand.Syntax, operand, best.Conversion, isCast: false, conversionGroupOpt: null, signature.OperandType, diagnostics);
3084if (node.Operand != operand.Syntax || operand.Syntax.Kind() != SyntaxKind.NumericLiteralExpression)
3089var literal = (LiteralExpressionSyntax)operand.Syntax;
3783operandPlaceholder = new BoundValuePlaceholder(operand.Syntax, operand.Type).MakeCompilerGenerated();
3793operand = new BoundDefaultExpression(operand.Syntax, targetType: null, constantValueOpt: ConstantValue.Null,
3830operandPlaceholder = new BoundValuePlaceholder(operand.Syntax, operand.Type).MakeCompilerGenerated();
4048var leftPlaceholder = new BoundValuePlaceholder(leftOperand.Syntax, optLeftType).MakeCompilerGenerated();
4070var leftPlaceholder = new BoundValuePlaceholder(leftOperand.Syntax, optLeftType0).MakeCompilerGenerated();
4089var leftPlaceholder = new BoundValuePlaceholder(leftOperand.Syntax, optLeftType).MakeCompilerGenerated();
4139var leftPlaceholder = new BoundValuePlaceholder(leftOperand.Syntax, optLeftType0).MakeCompilerGenerated();
4153var leftPlaceholder = new BoundValuePlaceholder(leftOperand.Syntax, optLeftType).MakeCompilerGenerated();
4351diagnostics.Add(ErrorCode.ERR_RefConditionalDifferentTypes, falseExpr.Syntax.Location, trueType);
4387CheckValEscape(falseExpr.Syntax, falseExpr, currentScope, whenTrueEscape, checkingReceiver: false, diagnostics: diagnostics);
4389CheckValEscape(trueExpr.Syntax, trueExpr, currentScope, whenFalseEscape, checkingReceiver: false, diagnostics: diagnostics);
Binder\Binder_Patterns.cs (6)
34expression = BadExpression(expression.Syntax, expression);
59this.Compilation, pattern.Syntax, expression, innerPattern, whenTrueLabel: whenTrueLabel, whenFalseLabel: whenFalseLabel, diagnostics);
613diagnostics.Add(ErrorCode.ERR_ValueCantBeNull, expression.Syntax.Location, inputType);
623diagnostics.Add(ErrorCode.ERR_PatternWrongType, expression.Syntax.Location, inputType, expression.Display);
635expression.Syntax.Location, inputType, expression.Display, new CSharpRequiredLanguageVersion(requiredVersion));
673diagnostics.Add(ErrorCode.ERR_PatternSpanCharCannotBeStringNull, convertedExpression.Syntax.Location, inputType);
Binder\Binder_Query.cs (8)
736yExpression = new BoundBadExpression(yExpression.Syntax, LookupResultKind.Empty, ImmutableArray<Symbol?>.Empty, ImmutableArray.Create(yExpression), CreateErrorType());
742yExpression = new BoundBadExpression(yExpression.Syntax, LookupResultKind.Empty, ImmutableArray<Symbol?>.Empty, ImmutableArray.Create(yExpression), yExpression.Type);
803field2Value = new BoundBadExpression(field2Value.Syntax, LookupResultKind.Empty, ImmutableArray<Symbol?>.Empty, ImmutableArray.Create(field2Value), field2Value.Type, true);
818new AnonymousTypeField(fieldName, fieldValue.Syntax.Location, TypeWithAnnotations.Create(TypeOrError(fieldValue)), RefKind.None, ScopedKind.None);
949diagnostics.Add(ErrorCode.ERR_BadSKunknown, ultimateReceiver.Syntax.Location, ((BoundNamespaceExpression)ultimateReceiver).NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize());
975receiver = new BoundBadExpression(receiver.Syntax, LookupResultKind.NotAValue, ImmutableArray<Symbol?>.Empty, ImmutableArray.Create(receiver), CreateErrorType());
982Error(diagnostics, ErrorCode.ERR_BadSKunknown, ultimateReceiver.Syntax, ultimateReceiver.Type, MessageID.IDS_SK_TYVAR.Localize());
997receiver = new BoundBadExpression(receiver.Syntax, LookupResultKind.NotAValue, ImmutableArray<Symbol?>.Empty, ImmutableArray.Create(receiver), CreateErrorType());
Binder\Binder_Statements.cs (30)
156Debug.Assert(result.Syntax is StatementSyntax, "BoundStatement should be associated with a statement syntax.");
158Debug.Assert(System.Linq.Enumerable.Contains(result.Syntax.AncestorsAndSelf(), node), @"Bound statement (or one of its parents)
682Error(diagnostics, ErrorCode.WRN_UnobservedAwaitableExpression, expression.Syntax);
1233SyntaxNode initializerSyntax = initializerOpt.Syntax;
1300CheckFeatureAvailability(initializerOpt.Syntax, MessageID.IDS_FeatureExtensibleFixedStatement, diagnostics);
1329var result = PerformPatternMethodLookup(initializer, methodName, initializer.Syntax, additionalDiagnostics, out var patternMethodSymbol, out bool isExpanded);
1342additionalDiagnostics.Add(ErrorCode.WRN_PatternBadSignature, initializer.Syntax.Location, initializer.Type, "fixed", patternMethodSymbol);
1363SyntaxNode initializerSyntax = initializer.Syntax;
1467diagnostics.Add(ErrorCode.ERR_VoidAssignment, op1.Syntax.Location);
1562Error(diagnostics, errorCode, node, getName(op1), op2.Syntax);
1583Error(diagnostics, errorCode, node, getName(op1), op2.Syntax);
1675var syntax = expr.Syntax;
1723SyntaxNode syntax = expr.Syntax;
1944diagnostics.Add(expression.Syntax, useSiteInfo);
1950Error(diagnostics, ErrorCode.ERR_RefAssignmentMustHaveIdentityConversion, expression.Syntax, targetType);
1973expression.Syntax,
1979GenerateImplicitConversionError(diagnostics, expression.Syntax, conversion, expression, targetType);
1987return CreateConversion(expression.Syntax, expression, conversion, isCast: false, conversionGroupOpt: null, targetType, diagnostics);
2405Error(diagnostics, ErrorCode.ERR_InvalidAddrOp, ((BoundAddressOfOperator)operand).Operand.Syntax);
2424GenerateImplicitConversionError(diagnostics, expr.Syntax, conversion, expr, targetType);
2524GenerateImplicitConversionError(diagnostics, argument.Syntax, elementConversion, argument, targetElementType);
2670diagnostics.Add(expr.Syntax, useSiteInfo);
2685Error(diagnostics, ErrorCode.WRN_IncorrectBooleanAssg, assignment.Syntax);
2691syntax: expr.Syntax,
3163Error(diagnostics, ErrorCode.ERR_RefReturnMustHaveIdentityConversion, argument.Syntax, returnType);
3180Error(diagnostics, ErrorCode.ERR_BadAsyncReturnExpression, argument.Syntax, returnType, argument.Type);
3184GenerateImplicitConversionError(diagnostics, argument.Syntax, conversion, argument, returnType);
3187ReportCantConvertLambdaReturn(argument.Syntax, diagnostics);
3194return CreateConversion(argument.Syntax, argument, conversion, isCast: false, conversionGroupOpt: null, returnType, diagnostics);
3447var syntax = expressionSyntax ?? expression.Syntax;
Binder\Binder_Symbols.cs (3)
1434diagnostics.Add(colorColorValueReceiver.Syntax, useSiteInfo);
1441Error(diagnostics, ErrorCode.ERR_AmbiguousPrimaryConstructorParameterAsColorColorReceiver, colorColorValueReceiver.Syntax, parameter.Name, parameter.Type, parameter);
1451receiver = new BoundBadExpression(receiver.Syntax, LookupResultKind.Ambiguous, ImmutableArray<Symbol>.Empty, ImmutableArray.Create(receiver), receiver.Type, hasErrors: true).MakeCompilerGenerated();
Binder\Binder_TupleOperators.cs (4)
65tuple.Syntax, tuple, wasTargetTyped: false, builder.ToImmutableAndFree(), tuple.ArgumentNamesOpt, tuple.InferredNamesOpt, tuple.Type, tuple.HasErrors);
318Location location = ((BoundTupleExpression)(useRight ? right : left)).Arguments[i].Syntax.Parent.Location;
333return new BoundDefaultExpression(expr.Syntax, targetType);
385.SelectAsArray((t, s) => (BoundExpression)new BoundTupleOperandPlaceholder(s, t.Type), expr.Syntax);
Binder\DecisionDagBuilder.cs (37)
136builder.Add(MakeTestsForPattern(index: 1, pattern.Syntax, rootIdentifier, pattern, whenClause: null, whenTrueLabel));
153if (label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel)
155builder.Add(MakeTestsForPattern(++i, label.Syntax, rootIdentifier, label.Pattern, label.WhenClause, label.Label));
175builder.Add(MakeTestsForPattern(++i, arm.Syntax, rootIdentifier, arm.Pattern, arm.WhenClause, arm.Label));
324var syntax = pattern.Syntax;
402input = MakeConvertToType(input, declaration.Syntax, type!, isExplicitTest: false, tests);
426output = MakeConvertToType(input: input, syntax: typePattern.Syntax, type: type, isExplicitTest: typePattern.IsExplicitNotNullTest, tests: tests);
490return new Tests.One(new BoundDagExplicitNullTest(constant.Syntax, input));
495return new Tests.One(new BoundDagValueTest(constant.Syntax, constant.ConstantValue, input));
501output = input = constant.Value.Type is { } type ? MakeConvertToType(input, constant.Syntax, type, isExplicitTest: false, tests) : input;
510tests.Add(new Tests.One(new BoundDagValueTest(constant.Syntax, constant.ConstantValue, input)));
525output = input = MakeConvertToType(input, recursive.Syntax, inputType, isExplicitTest: recursive.IsExplicitNotNullTest, tests);
533var evaluation = new BoundDagDeconstructEvaluation(recursive.Syntax, method, OriginalInput(input, method));
540SyntaxNode syntax = pattern.Syntax;
561SyntaxNode syntax = pattern.Syntax;
574tests.Add(new Tests.One(new BoundDagTypeTest(recursive.Syntax, ErrorType(), input, hasErrors: true)));
588tests.Add(new Tests.One(new BoundDagTypeTest(recursive.Syntax, ErrorType(), input, hasErrors: true)));
614input = MakeConvertToType(input, member.Syntax, member.Receiver.Type.StrippedType(), isExplicitTest: false, tests);
621evaluation = new BoundDagPropertyEvaluation(member.Syntax, property, isLengthOrCount, OriginalInput(input, property));
624evaluation = new BoundDagFieldEvaluation(member.Syntax, field, OriginalInput(input, field));
631input = new BoundDagTemp(member.Syntax, member.Type, evaluation);
688output = @this.MakeConvertToType(input: input, syntax: bin.Syntax, type: bin.NarrowedType, isExplicitTest: false, tests: builder);
712output = MakeConvertToType(input, rel.Syntax, type, isExplicitTest: false, tests);
721tests.Add(new Tests.One(new BoundDagRelationalTest(rel.Syntax, rel.Relation, rel.ConstantValue, output, rel.HasErrors)));
756var boundDecisionDag = new BoundDecisionDag(rootDecisionDagNode.Syntax, rootDecisionDagNode);
958state.SelectedTest = new BoundDagNonNullTest(t.Syntax, isExplicitTest: true, t.Input, t.HasErrors);
1048state.Dag = uniqifyDagNode(new BoundEvaluationDecisionDagNode(e.Syntax, e, next));
1057state.Dag = uniqifyDagNode(new BoundTestDecisionDagNode(d.Syntax, d, whenTrue, whenFalse));
1470Debug.Assert(s1LengthTemp.Syntax is ListPatternSyntax);
1471Debug.Assert(s2LengthTemp.Syntax is ListPatternSyntax);
1475s1LengthTemp.Syntax != s2LengthTemp.Syntax)
1726builder.Append($" WHEN[{cd.WhenClause.Syntax}]");
2146SyntaxNode syntax = test.Syntax;
2218if (e.Syntax.IsKind(SyntaxKind.ListPattern))
2241new One(new BoundDagValueTest(t.Syntax, safeAdd(t.Value, offset), lengthTemp));
2245new One(new BoundDagRelationalTest(t.Syntax, t.OperatorKind, safeAdd(t.Value, offset), lengthTemp));
Binder\DecisionDagBuilder_ListPatterns.cs (7)
21var syntax = list.Syntax;
24output = input = MakeConvertToType(input, list.Syntax, list.NarrowedType, isExplicitTest: false, tests);
28tests.Add(new Tests.One(new BoundDagTypeTest(list.Syntax, ErrorType(), input, hasErrors: true)));
63var sliceEvaluation = new BoundDagSliceEvaluation(slicePattern.Syntax, slicePattern.InputType, lengthTemp, startIndex: startIndex, endIndex: index,
67var sliceTemp = new BoundDagTemp(slicePattern.Syntax, slicePattern.InputType, sliceEvaluation);
78var indexEvaluation = new BoundDagIndexerEvaluation(subpattern.Syntax, subpattern.InputType, lengthTemp, index++,
82var indexTemp = new BoundDagTemp(subpattern.Syntax, subpattern.InputType, indexEvaluation);
Binder\ForEachLoopBinder.cs (26)
242messageId.CheckFeatureAvailability(diagnostics, Compilation, collectionExpr.Syntax.Location);
246Error(diagnostics, ErrorCode.ERR_RefLvalueExpected, collectionExpr.Syntax);
354collectionExpr.Syntax,
361hasErrors |= !CheckValueKind(collectionExpr.Syntax, collectionExpr, requiredCurrentKind, checkingReceiver: false, diagnostics);
473Error(diagnostics, ErrorCode.ERR_RefAssignmentMustHaveIdentityConversion, collectionExpr.Syntax, iterationVariableType.Type);
631collectionExpr.Syntax,
646collectionExpr.Syntax,
688inferredType = TypeWithAnnotations.Create(GetSpecialType(SpecialType.System_Char, diagnostics, collectionExpr.Syntax));
706SyntaxNode exprSyntax = collectionExpr.Syntax;
821if (CheckValueKind(collectionExpr.Syntax, collectionExpr, BindValueKind.RefersToLocation | BindValueKind.Assignable, checkingReceiver: false, BindingDiagnosticBag.Discarded))
829if (!CheckValueKind(collectionExpr.Syntax, collectionExpr, BindValueKind.RefersToLocation, checkingReceiver: false, BindingDiagnosticBag.Discarded))
835NamedTypeSymbol spanType = GetWellKnownType(wellKnownSpan, diagnostics, collectionExpr.Syntax);
847diagnostics.Add(ErrorCode.ERR_InlineArrayForEachNotSupported, collectionExpr.Syntax.GetLocation(), collectionExpr.Type);
853BoundExpression span = new BoundValuePlaceholder(collectionExpr.Syntax, spanType).MakeCompilerGenerated();
875CheckFeatureAvailability(collectionExpr.Syntax, MessageID.IDS_FeatureInlineArrays, diagnostics);
881_ = GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_Unsafe__AsRef_T, diagnostics, syntax: collectionExpr.Syntax);
884_ = GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_Unsafe__Add_T, diagnostics, syntax: collectionExpr.Syntax);
885_ = GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_Unsafe__As_T, diagnostics, syntax: collectionExpr.Syntax);
887CheckInlineArrayTypeIsSupported(collectionExpr.Syntax, collectionExpr.Type, elementField.Type, diagnostics);
895diagnostics.Add(ErrorCode.ERR_InlineArrayForEachNotSupported, collectionExpr.Syntax.GetLocation(), collectionExpr.Type);
1114collectionExpr.Syntax,
1179diagnostics.Add(ErrorCode.ERR_NullNotValid, collectionExpr.Syntax.Location);
1228CheckFeatureAvailability(expr.Syntax, MessageID.IDS_FeatureDisposalPattern, diagnostics);
1247Error(diagnostics, ErrorCode.ERR_BadAllowByRefLikeEnumerator, expr.Syntax, enumeratorType);
1535collectionExpr.Syntax,
1548collectionExpr.Syntax,
Binder\PatternExplainer.cs (9)
344var typedTemp = new BoundDagTemp(te.Syntax, te.Type, te);
359var typedTemp = new BoundDagTemp(te.Syntax, te.Type, te);
403var lengthTemp = new BoundDagTemp(lengthOrCount.Syntax, lengthOrCount.Property.Type, lengthOrCount);
431var indexerTemp = new BoundDagTemp(e.Syntax, e.IndexerType, e);
450var sliceTemp = new BoundDagTemp(slice.Syntax, slice.SliceType, slice);
479var elementTemp = new BoundDagTemp(e.Syntax, e.Field.Type, e);
547var elementTemp = new BoundDagTemp(e.Syntax, method.Parameters[j + extensionExtra].Type, e, j);
566var subInput = new BoundDagTemp(e.Syntax, e.Field.Type, e);
573var subInput = new BoundDagTemp(e.Syntax, e.Property.Type, e);
Binder\RefSafetyAnalysis.cs (10)
286RoslynDebug.Assert(added, $"Expression {expr} `{expr.Syntax}` visited more than once.");
299RoslynDebug.Assert(_visited.Contains(expr), $"Expected {expr} `{expr.Syntax}` to be visited.");
543ValidateAssignment(node.Syntax, node.Left, node.Right, node.IsRef, _diagnostics);
551ValidateAssignment(node.Syntax, node.Left, node, isRef: false, _diagnostics);
630ValidateRefConditionalOperator(node.Syntax, node.Consequence, node.Alternative, _diagnostics);
660node.Syntax,
761node.Syntax,
843node.Syntax,
866node.Syntax,
916VisitDeconstructionArguments(variables, right.Syntax, right.Conversion, right.Operand);
Binder\Semantics\Conversions\Conversions.cs (9)
162var syntax = node.Syntax;
239new BoundValuePlaceholder(element.Syntax, enumeratorInfo.ElementType),
254GetDelegateOrFunctionPointerArguments(source.Syntax, analyzedArguments, delegateInvokeMethodOpt.Parameters, binder.Compilation);
300diagnostics.Add(expr.Syntax, useSiteInfo);
336expr.Syntax.Location,
347expr.Syntax.Location,
359binder: binder, location: expr.Syntax.Location, nodeOpt: expr.Syntax, diagnostics: overloadDiagnostics,
361receiver: resolution.MethodGroup.Receiver, invokedExpression: expr.Syntax, arguments: resolution.AnalyzedArguments,
BoundTree\UnboundLambda.cs (17)
33SyntaxNode IBoundLambdaOrFunction.Syntax { get { return Syntax; } }
72public MessageID MessageID { get { return Syntax.Kind() == SyntaxKind.AnonymousMethodExpression ? MessageID.IDS_AnonMethod : MessageID.IDS_Lambda; } }
80SyntaxNode IBoundLambdaOrFunction.Syntax { get { return Syntax; } }
429var lambda = new UnboundLambda(Syntax, data, FunctionType, WithDependencies, nullableState, HasErrors);
442var lambda = new UnboundLambda(Syntax, data, FunctionType, WithDependencies, _nullableState, HasErrors);
574Binder.RecordLambdaBinding(UnboundLambda.Syntax);
593this.Binder.GenerateAnonymousFunctionConversionError(diagnostics, _unboundLambda.Syntax, _unboundLambda, targetType);
717var lambdaBodyBinder = new ExecutableCodeBinder(_unboundLambda.Syntax, lambdaSymbol, GetWithParametersBinder(lambdaSymbol, Binder));
765_unboundLambda.Syntax,
812lambdaBodyBinder = new ExecutableCodeBinder(_unboundLambda.Syntax, lambdaSymbol, GetWithParametersBinder(lambdaSymbol, Binder), inExpressionTree ? BinderFlags.InExpressionTree : BinderFlags.None);
875var result = new BoundLambda(_unboundLambda.Syntax, _unboundLambda, block, diagnostics.ToReadOnlyAndFree(), lambdaBodyBinder, delegateType, inferredReturnType: default)
971_unboundLambda.Syntax,
1000var lambdaBodyBinder = new ExecutableCodeBinder(_unboundLambda.Syntax, lambdaSymbol, GetWithParametersBinder(lambdaSymbol, Binder));
1221_unboundLambda.Syntax,
1489public override MessageID MessageID { get { return this.UnboundLambda.Syntax.Kind() == SyntaxKind.AnonymousMethodExpression ? MessageID.IDS_AnonMethod : MessageID.IDS_Lambda; } }
1495return UnboundLambda.Syntax.AnonymousFunctionBody();
1502var syntax = UnboundLambda.Syntax;
CodeGen\EmitAddress.cs (12)
138var temp = this.AllocateTemp(type, expression.Syntax);
142EmitSymbolToken(type, expression.Syntax);
246EmitInitObj(receiverType, true, expression.Syntax);
247EmitBox(receiverType, expression.Syntax);
320EmitSymbolToken(refValue.Type, refValue.Syntax);
333var value = this.AllocateTemp(expression.Type, expression.Syntax);
409EmitSymbolToken(elementType, arrayAccess.Syntax);
414arrayAccess.Syntax, _diagnostics.DiagnosticBag);
449EmitStaticFieldAddress(field, fieldAccess.Syntax);
526EmitBox(receiver.Type, receiver.Syntax);
561EmitSymbolToken(field, fieldAccess.Syntax);
584EmitSymbolToken(fixedElementField, fieldAccess.Syntax);
CodeGen\EmitArrayInitializer.cs (24)
58_builder.EmitArrayBlockInitializer(data, inits.Syntax, _diagnostics.DiagnosticBag);
93EmitVectorElementStore(arrayType, init.Syntax);
464var rosPointerCtor = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_ReadOnlySpan_T__ctor_Pointer, _diagnostics, syntax: wrappedExpression.Syntax, isOptional: true);
557var field = _builder.module.GetFieldForData(data, alignment: 1, wrappedExpression.Syntax, _diagnostics.DiagnosticBag);
559_builder.EmitToken(field, wrappedExpression.Syntax, _diagnostics.DiagnosticBag);
575EmitSymbolToken(rosPointerCtor.AsMember(spanType), wrappedExpression.Syntax, optArgList: null);
610MethodSymbol? createSpan = (MethodSymbol?)Binder.GetWellKnownTypeMember(_module.Compilation, WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__CreateSpanRuntimeFieldHandle, _diagnostics, syntax: wrappedExpression.Syntax, isOptional: true);
618var field = _builder.module.GetFieldForData(data, alignment: (ushort)specialElementType.SizeInBytes(), wrappedExpression.Syntax, _diagnostics.DiagnosticBag);
620_builder.EmitToken(field, wrappedExpression.Syntax, _diagnostics.DiagnosticBag);
622EmitSymbolToken(createSpan.Construct(elementType), wrappedExpression.Syntax, optArgList: null);
634if (!tryGetReadOnlySpanArrayCtor(wrappedExpression.Syntax, out var rosArrayCtor))
651var cachingField = _builder.module.GetArrayCachingFieldForData(data, _module.Translate(arrayType), wrappedExpression.Syntax, _diagnostics.DiagnosticBag);
657_builder.EmitToken(cachingField, wrappedExpression.Syntax, _diagnostics.DiagnosticBag);
667EmitSymbolToken(arrayType.ElementType, wrappedExpression.Syntax);
668_builder.EmitArrayBlockInitializer(data, wrappedExpression.Syntax, _diagnostics.DiagnosticBag);
671_builder.EmitToken(cachingField, wrappedExpression.Syntax, _diagnostics.DiagnosticBag);
677EmitSymbolToken(rosArrayCtor.AsMember(spanType), wrappedExpression.Syntax, optArgList: null);
698if (!tryGetReadOnlySpanArrayCtor(arrayCreation.Syntax, out var rosArrayCtor))
710arrayCreation.Syntax, _diagnostics.DiagnosticBag);
717_builder.EmitToken(cachingField, arrayCreation.Syntax, _diagnostics.DiagnosticBag);
727_builder.EmitToken(cachingField, arrayCreation.Syntax, _diagnostics.DiagnosticBag);
745EmitSymbolToken(rosArrayCtor.AsMember(spanType), arrayCreation.Syntax, optArgList: null);
763EmitSymbolToken(spanType, wrappedExpression.Syntax);
773EmitDefaultValue(spanType, used, wrappedExpression.Syntax);
CodeGen\EmitConversion.cs (12)
86EmitSymbolToken(expression.ConversionMethod, expression.Syntax, optArgList: null);
232EmitBox(conversion.Operand.Type, conversion.Operand.Syntax);
243EmitSymbolToken(conversion.Type, conversion.Syntax);
251EmitStaticCast(conversion.Type, conversion.Syntax);
264EmitBox(conversion.Operand.Type, conversion.Operand.Syntax);
275EmitSymbolToken(conversion.Type, conversion.Syntax);
280EmitSymbolToken(conversion.Type, conversion.Syntax);
337EmitSymbolToken(receiver.Type, receiver.Syntax);
345EmitBox(receiver.Type, receiver.Syntax);
368EmitSymbolToken(method, node.Syntax, null);
373var ctor = DelegateConstructor(node.Syntax, delegateType);
374if ((object)ctor != null) EmitSymbolToken(ctor, node.Syntax, null);
CodeGen\EmitExpression.cs (109)
56EmitConstantExpression(expression.Type, constantValue, used, expression.Syntax);
183EmitLoadIndirect(thisType, expression.Syntax);
184EmitBox(thisType, expression.Syntax);
247EmitThrowIfModuleCancellationRequested(expression.Syntax);
252EmitModuleCancellationTokenLoad(expression.Syntax);
374EmitDefaultValue(node.Type, used, node.Syntax);
387EmitInitObj(receiverType, true, expression.Syntax);
388EmitBox(receiverType, expression.Syntax);
471EmitDefaultValue(receiverType, true, receiver.Syntax);
472EmitBox(receiverType, receiver.Syntax);
474EmitLoadIndirect(receiverType, receiver.Syntax);
476cloneTemp = AllocateTemp(receiverType, receiver.Syntax);
480EmitBox(receiverType, receiver.Syntax);
491EmitLoadIndirect(receiverType, receiver.Syntax);
492EmitBox(receiverType, receiver.Syntax);
524EmitSymbolToken(hasValueOpt, expression.Syntax, null);
545EmitDefaultValue(expression.Type, used, expression.Syntax);
658EmitLoadIndirect(expression.Type, expression.Syntax);
667EmitLoadIndirect(expression.Type, expression.Syntax);
680EmitSymbolToken(expression.Operand.Type, expression.Operand.Syntax);
695EmitSymbolToken(getTypeMethod, expression.Syntax, null);
771EmitLoadIndirect(expression.Type, expression.Syntax);
792EmitLoadIndirect(expression.Type, expression.Syntax);
814EmitLoadIndirect(thisType, thisRef.Syntax);
834var syntax = node.Syntax;
880DefineLocal(local, sequence.Syntax);
914var seqLocal = DefineLocal(local, sequence.Syntax);
1094EmitSymbolToken(elementType, arrayAccess.Syntax);
1101_builder.EmitArrayElementLoad(_module.Translate((ArrayTypeSymbol)arrayAccess.Expression.Type), arrayAccess.Expression.Syntax, _diagnostics.DiagnosticBag);
1146EmitLoadIndirect(field.Type, fieldAccess.Syntax);
1165EmitSymbolToken(field, fieldAccess.Syntax);
1192EmitSymbolToken(field, fieldAccess.Syntax);
1238EmitSymbolToken(receiver.Type, receiver.Syntax);
1252EmitSymbolToken(field, fieldAccess.Syntax);
1414EmitLoadIndirect(local.LocalSymbol.Type, local.Syntax);
1427EmitLoadIndirect(parameterType, parameter.Syntax);
1650EmitSymbolToken(method.ContainingType, call.Syntax);
1674EmitSymbolToken(receiver.Type, receiver.Syntax);
1679EmitSymbolToken(method, call.Syntax,
1682EmitCallCleanup(call.Syntax, useKind, method);
1773EmitBox(parentCallReceiverType, nested.Syntax);
1792tempOpt = this.AllocateTemp(parentCallReceiverType, nested.Syntax);
1926EmitBox(receiverType, receiver.Syntax);
2008EmitSymbolToken(receiver.Type, receiver.Syntax);
2013EmitSymbolToken(actualMethodTargetedByTheCall, call.Syntax,
2016EmitCallCleanup(call.Syntax, useKind, method);
2051EmitDefaultValue(receiverType, true, receiver.Syntax);
2052EmitBox(receiverType, receiver.Syntax);
2059EmitLoadIndirect(receiverType, receiver.Syntax);
2060tempOpt = AllocateTemp(receiverType, receiver.Syntax);
2381EmitSymbolToken(arrayType.ElementType, expression.Syntax);
2385_builder.EmitArrayCreation(_module.Translate(arrayType), expression.Syntax, _diagnostics.DiagnosticBag);
2426EmitInitObj(expression.Type, used, expression.Syntax);
2455EmitSymbolToken(constructor, expression.Syntax,
2678EmitSymbolToken(target.Type, target.Syntax);
2712EmitSymbolToken(constructor, objCreation.Syntax,
3051assignmentOperator.Left.Syntax,
3079EmitIndirectStore(local.LocalSymbol.Type, local.Syntax);
3098EmitArrayElementStore(arrayType, expression.Syntax);
3111EmitIndirectStore(expression.Type, expression.Syntax);
3116EmitIndirectStore(expression.Type, expression.Syntax);
3122EmitIndirectStore(expression.Type, expression.Syntax);
3134EmitIndirectStore(expression.Type, expression.Syntax);
3139EmitIndirectStore(expression.Type, expression.Syntax);
3156EmitIndirectStore(nested.Type, expression.Syntax);
3183EmitLoadIndirect(assignment.Type, assignment.Syntax);
3192EmitSymbolToken(thisRef.Type, thisRef.Syntax);
3286EmitIndirectStore(field.Type, fieldAccess.Syntax);
3291EmitSymbolToken(field, fieldAccess.Syntax);
3301EmitIndirectStore(parameter.ParameterSymbol.Type, parameter.Syntax);
3389EmitBox(operand.Type, operand.Syntax);
3392EmitSymbolToken(isOp.TargetType.Type, isOp.Syntax);
3418EmitBox(operandType, operand.Syntax);
3421EmitSymbolToken(targetType, asOp.Syntax);
3426EmitSymbolToken(targetType, asOp.Syntax);
3472EmitDefaultValue(expression.Type, used, expression.Syntax);
3509EmitSymbolToken(getTypeMethod, boundTypeOf.Syntax, null);
3516EmitSymbolToken(type, boundTypeOfOperator.SourceType.Syntax);
3524EmitSymbolToken(type, boundSizeOfOperator.SourceType.Syntax);
3542EmitSymbolToken(symbol, node.Syntax, null, encodeAsRawDefinitionToken: true);
3555EmitHoistedVariableId(node.HoistedField, node.Syntax);
3569EmitHoistedVariableId(node.HoistedField, node.Syntax);
3604_module.GetModuleVersionId(_module.Translate(node.Type, node.Syntax, _diagnostics.DiagnosticBag), node.Syntax, _diagnostics.DiagnosticBag),
3605node.Syntax,
3662_builder.EmitToken(_module.GetInstrumentationPayloadRoot(node.AnalysisKind, _module.Translate(node.Type, node.Syntax, _diagnostics.DiagnosticBag), node.Syntax, _diagnostics.DiagnosticBag), node.Syntax, _diagnostics.DiagnosticBag);
3675EmitSymbolToken(node.Method, node.Syntax, null);
3688EmitSymbolToken(node.Method.ContainingType, node.Syntax);
3692EmitSymbolToken(getMethod, node.Syntax, null);
3696EmitSymbolToken(node.Type, node.Syntax);
3703EmitSymbolToken(node.Field, node.Syntax);
3715EmitSymbolToken(node.Field.ContainingType, node.Syntax);
3719EmitSymbolToken(getField, node.Syntax, null);
3723EmitSymbolToken(node.Type, node.Syntax);
3790EmitStaticCast(expr.Type, expr.Syntax);
3795EmitStaticCast(expr.Type, expr.Syntax);
3814EmitStaticCast(expr.Type, expr.Syntax);
3819EmitStaticCast(expr.Type, expr.Syntax);
3851EmitStaticCast(expr.Type, expr.Syntax);
3856EmitStaticCast(expr.Type, expr.Syntax);
3864EmitBox(expr.Type, expr.LeftOperand.Syntax);
3881EmitStaticCast(expr.Type, expr.Syntax);
4025temp = AllocateTemp(ptrInvocation.InvokedExpression.Type, ptrInvocation.Syntax);
4040EmitSignatureToken(ptrInvocation.FunctionPointer, ptrInvocation.Syntax);
4041EmitCallCleanup(ptrInvocation.Syntax, useKind, method);
4112EmitSymbolToken(load.ConstrainedToTypeOpt, load.Syntax);
4116EmitSymbolToken(load.TargetMethod, load.Syntax, optArgList: null);
CodeGen\EmitStatement.cs (19)
182this.EmitBox(exprType, thrown.Syntax);
593EmitBox(operand.Type, operand.Syntax);
596EmitSymbolToken(isOp.TargetType.Type, isOp.TargetType.Syntax);
613EmitBox(conditionType, condition.Syntax);
686DefineLocal(local, block.Syntax);
753DefineLocal(local, !declaringReferences.IsEmpty ? (CSharpSyntaxNode)declaringReferences[0].GetSyntax() : block.Syntax);
858(boundReturnStatement.Syntax.IsKind(SyntaxKind.Block) || _method?.IsImplicitConstructor == true) &&
915_module.Translate(expressionOpt.Type, boundReturnStatement.Syntax, _diagnostics.DiagnosticBag);
1049_module.Translate(catchBlock.ExceptionTypeOpt, catchBlock.Syntax, _diagnostics.DiagnosticBag) :
1050_module.GetSpecialType(SpecialType.System_Object, catchBlock.Syntax, _diagnostics.DiagnosticBag);
1064var syntax = catchBlock.Syntax as CatchClauseSyntax;
1096var exceptionType = _module.Translate(catchBlock.ExceptionTypeOpt, catchBlock.Syntax, _diagnostics.DiagnosticBag);
1099_builder.EmitToken(exceptionType, catchBlock.Syntax, _diagnostics.DiagnosticBag);
1117var localSyntax = !declaringReferences.IsEmpty ? (CSharpSyntaxNode)declaringReferences[0].GetSyntax() : catchBlock.Syntax;
1131EmitSymbolToken(exceptionSourceOpt.Type, exceptionSourceOpt.Syntax);
1169var temp = AllocateTemp(exceptionSource.Type, exceptionSource.Syntax);
1301temp = AllocateTemp(expression.Type, expression.Syntax);
1315this.EmitStringSwitchJumpTable(switchCaseLabels, fallThroughLabel, key, expression.Syntax, expression.Type);
1319this.EmitLengthBasedStringSwitchJumpTable(lengthBasedSwitchStringJumpTableOpt, fallThroughLabel, key, expression.Syntax, expression.Type);
Compilation\MemberSemanticModel.cs (14)
1458alreadyInTree = _guardedBoundNodeMap.ContainsKey(bound.Syntax);
1466Debug.Assert(syntax != _root || _guardedBoundNodeMap.ContainsKey(bound.Syntax));
1490alreadyInTree = _guardedBoundNodeMap.ContainsKey(bound.Syntax);
1502Debug.Assert(syntax != _root || _guardedBoundNodeMap.ContainsKey(bound.Syntax));
1811return GetEnclosingBinderInternalWithinRoot(AdjustStartingNodeAccordingToNewRoot(startingNode, unbound.Syntax),
1812position, unbound.BindForErrorRecovery().Binder, unbound.Syntax);
1815return GetEnclosingBinderInternalWithinRoot(AdjustStartingNodeAccordingToNewRoot(startingNode, lambda.Body.Syntax),
1816position, lambda.Binder, lambda.Body.Syntax);
1824return GetEnclosingBinderInternalWithinRoot(AdjustStartingNodeAccordingToNewRoot(startingNode, queryClause.Syntax),
1825position, queryClause.Binder, queryClause.Syntax);
1840var span = expr.Syntax.FullSpan;
1859if (value.Syntax.FullSpan.Contains(position))
1864if (expr.Syntax.FullSpan.Contains(position))
1953_guardedBoundNodeMap.ContainsKey(bind(bindableRoot, out _).Syntax));
Compiler\MethodCompiler.cs (9)
971body = BoundBlock.SynthesizedNoLocals(initializerStatements.Syntax, initializerStatements.Statements);
1004new BoundBlock(analyzedInitializers.Syntax, ImmutableArray<LocalSymbol>.Empty, analyzedInitializers.Statements), // The block is necessary to establish the right local scope for the analysis
1127var syntax = body.Syntax;
1478return new BoundBadStatement(body.Syntax, ImmutableArray.Create<BoundNode>(body), hasErrors: true);
1860body = new BoundBlock(constructor.Syntax, constructor.Locals, ImmutableArray.Create<BoundStatement>(constructor.Initializer));
1864body = new BoundBlock(constructor.Syntax, constructor.Locals, ImmutableArray.Create<BoundStatement>(constructor.Initializer, body));
2213if (!LambdaUtilities.TryGetLambdaBodies(node.Syntax, out var body1, out var body2))
2348var constructorInitializer = new BoundExpressionStatement(initializerInvocation.Syntax, initializerInvocation) { WasCompilerGenerated = method.IsImplicitlyDeclared };
2363compilationState.ReportCtorInitializerCycles(method, ctorCall.Method, ctorCall.Syntax, diagnostics);
FlowAnalysis\DefiniteAssignment.cs (22)
386LeaveParameters(methodParameters, returnBranch.Branch.Syntax, null);
387if ((object)methodThisParameter != null) LeaveParameter(methodThisParameter, returnBranch.Branch.Syntax, null);
1520CheckAssigned(fieldAccess, node.Syntax);
1624LeaveParameter(param, node.Syntax, paramExpr.Syntax.Location);
2354if ((localSymbol as SourceLocalSymbol)?.IsVar == true && localSymbol.ForbiddenZone?.Contains(node.Syntax) == true)
2368CheckAssigned(localSymbol, node.Syntax);
2375Diagnostics.Add(ErrorCode.ERR_FixedLocalInLambda, new SourceLocation(node.Syntax), localSymbol);
2443LeaveParameters(node.Symbol.Parameters, node.Syntax, null);
2452LeaveParameters(node.Symbol.Parameters, pending.Branch.Syntax, null);
2471CheckAssigned(MethodThisParameter, node.Syntax);
2479CheckAssigned(node.ParameterSymbol, node.Syntax);
2550if (_unassignedVariableAddressOfSyntaxes?.Contains(node.Syntax as PrefixUnaryExpressionSyntax) == false)
2557_unsafeAddressTakenVariables.Add(variable, node.Syntax.Location);
2574CheckAssigned(arg, arg.Syntax);
2673CheckAssigned(MethodThisParameter, node.Syntax);
2700if (node.FieldSymbol.IsFixedSizeBuffer && node.Syntax != null && !SyntaxFacts.IsFixedStatementExpression(node.Syntax))
2708_unsafeAddressTakenVariables.Add(receiver, node.Syntax.Location);
2715CheckAssigned(node, node.FieldSymbol, node.Syntax);
2736ReportUnassignedIfNotCapturedInLocalFunction(backingField, node.Syntax, unassignedSlot);
2755CheckAssigned(node, associatedField, node.Syntax);
FlowAnalysis\NullableWalker.cs (71)
609enforceMemberNotNull(syntaxOpt: pendingReturn.Branch.Syntax, pendingReturn.State);
613EnforceParameterNotNullOnExit(returnStatement.Syntax, pendingReturn.State);
990_ => syntaxOpt ?? (SyntaxNodeOrToken)methodMainNode.Syntax.GetLastToken()
1005enforceMemberNotNullWhen(returnStatement.Syntax, sense: value, pendingReturn.State);
1018enforceMemberNotNullWhenIfAffected(returnStatement.Syntax, sense: true, members: method.ContainingType.GetMembers(memberName), state: pendingReturn.StateWhenTrue, otherState: pendingReturn.StateWhenFalse);
1023enforceMemberNotNullWhenIfAffected(returnStatement.Syntax, sense: false, members: method.ContainingType.GetMembers(memberName), state: pendingReturn.StateWhenFalse, otherState: pendingReturn.StateWhenTrue);
1063Diagnostics.Add(ErrorCode.WRN_MemberNotNullWhen, syntaxOpt?.GetLocation() ?? methodMainNode.Syntax.GetLastToken().GetLocation(), member.Name, sense ? "true" : "false");
1163EnforceParameterNotNullWhenOnExit(returnStatement.Syntax, parameters, sense: value, stateWhen: pendingReturn.State);
1177ReportParameterIfBadConditionalState(returnStatement.Syntax, parameter, sense: true, stateWhen: pendingReturn.StateWhenTrue);
1178ReportParameterIfBadConditionalState(returnStatement.Syntax, parameter, sense: false, stateWhen: pendingReturn.StateWhenFalse);
1185EnforceParameterNotNullWhenOnExit(returnStatement.Syntax, parameters, sense: value, stateWhen: pendingReturn.State);
1218location = syntaxOpt?.GetLocation() ?? methodMainNode.Syntax.GetLastToken().GetLocation();
1304var location = syntaxOpt?.GetLocation() ?? methodMainNode.Syntax.GetLastToken().GetLocation();
1327ReportDiagnostic(ErrorCode.WRN_ShouldNotReturn, syntaxOpt?.GetLocation() ?? methodMainNode.Syntax.GetLastToken().GetLocation());
1381compilation.GetBinderFactory(node.SyntaxTree).GetBinder(node.Syntax);
1808var key = (object?)symbol ?? methodMainNode.Syntax;
1851RoslynDebug.Assert(AreCloseEnough(originalSymbol, updatedSymbol), $"Attempting to set {node.Syntax} from {originalSymbol.ToDisplayString()} to {updatedSymbol.ToDisplayString()}");
2318location ??= value.Syntax.GetLocation();
2858CheckDisallowedNullAssignment(resultType, parameterAnnotations, equalsValue.Value.Syntax);
2885EnforceDoesNotReturn(node.Syntax);
2915CheckDisallowedNullAssignment(returnState, ToInwardAnnotations(returnAnnotations), node.Syntax, boundValueOpt: expr);
2927EnforceDoesNotReturn(node.Syntax);
2943EnforceNotNullIfNotNull(node.Syntax, this.State, method.Parameters, method.ReturnNotNullIfParameterNotNull, ResultType.State, outputParam: null);
2961ReportNullabilityMismatchInAssignment(expr.Syntax, lvalueResultType, destinationType);
3021if (local is SourceLocalSymbol { IsVar: true } && local.ForbiddenZone?.Contains(node.Syntax) == true)
3300enforceMemberNotNull(syntax: pendingReturn.Branch?.Syntax, pendingReturn.State);
3305EnforceParameterNotNullOnExit(returnStatement.Syntax, pendingReturn.State);
3816var foundIterationType = _binder.TryGetCollectionIterationType((ExpressionSyntax)node.Syntax, collectionType, out targetElementType);
4233ReportDiagnostic(ErrorCode.WRN_NullReferenceInitializer, initializer.Syntax, symbol);
5134if (CheckDisallowedNullAssignment(resultType, parameterAnnotations, expr.Syntax, operand))
6097ReportNullabilityMismatchInAssignment(node.Syntax, source, destination);
6158new BoundExpressionWithNullability(expr.Syntax, expr, type.NullableAnnotation, type.Type);
6687var syntax = node.Syntax;
6835var syntax = node.Syntax;
7375ReportNullabilityMismatchInArgument(argumentNoConversion.Syntax, argumentResultType, parameter, parameterType.Type, forOutput: false);
7395if (CheckDisallowedNullAssignment(stateAfterConversion, parameterAnnotations, argumentNoConversion.Syntax))
7417CheckDisallowedNullAssignment(resultType, parameterAnnotations, argumentNoConversion.Syntax);
7517var parameterValue = new BoundParameter(argument.Syntax, parameter);
7557var parameterValue = new BoundParameter(argument.Syntax, parameter);
7560CheckDisallowedNullAssignment(parameterWithState, leftAnnotations, argument.Syntax);
7573ReportNullabilityMismatchInArgument(argument.Syntax, lValueType.Type, parameter, parameterType.Type, forOutput: true);
7980return new BoundUnconvertedCollectionExpression(collection.Syntax, elementsBuilder.ToImmutableAndFree()) { WasCompilerGenerated = true };
7994return new BoundExpressionWithNullability(argument.Syntax, argument, NullableAnnotation.Oblivious, type: null);
7997return new BoundExpressionWithNullability(argument.Syntax, argument, argumentType.NullableAnnotation, argumentType.Type);
8088ReportNullabilityMismatchInAssignment(sourceExpression.Syntax, GetTypeAsDiagnosticArgument(sourceType), destinationType);
8442var locations = tupleOpt.TupleElements.SelectAsArray((element, location) => element.TryGetFirstLocation() ?? location, node.Syntax.Location);
8446tupleOpt.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(compilation, _conversions, includeNullability: true, node.Syntax.Location, diagnostics: null),
8447typeSyntax: node.Syntax, locations, nullabilityDiagnosticsOpt: diagnostics);
8615diagnosticLocation: (conversionOpt ?? convertedNode).Syntax.GetLocation());
8688if (lambda.Syntax is LambdaExpressionSyntax lambdaSyntax)
9128diagnosticLocation ??= (conversionOpt ?? conversionOperand).Syntax.GetLocation();
9398Location operandLocation = conversionOperand.Syntax.GetLocation();
9411if (!isLiftedConversion && CheckDisallowedNullAssignment(operandType, parameterAnnotations, conversionOperand.Syntax))
9486conversionOpt.Syntax.SpanStart != convertedNode.Syntax.SpanStart)
9685ReportNullabilityMismatchWithTargetDelegate(group.Syntax.Location, delegateType, delegateInvokeMethod, method, node.IsExtensionMethod);
9757ReportNullabilityMismatchWithTargetDelegate(arg.Syntax.Location, delegateType, delegateInvokeMethod, argInvokeMethod, invokedAsExtensionMethod: false);
9813var syntax = group.Syntax;
9818if (method.IsGenericMethod && HasImplicitTypeArguments(group.Syntax))
9971CheckDisallowedNullAssignment(rightState, leftAnnotations, right.Syntax);
10194CheckMethodConstraints(invocation.Syntax, deconstructMethod);
10308CheckDisallowedNullAssignment(valueType, leftAnnotations, right.Syntax);
10566CheckDisallowedNullAssignment(resultTypeWithState, leftArgumentAnnotations, node.Syntax);
10608ReportNullabilityMismatchInArgument(argument.Syntax, argType, parameter, paramType.Type, forOutput: false);
10615argument.Syntax, argumentType, parameterType,
11020ReportDiagnostic(ErrorCode.WRN_NullReferenceReceiver, expr.Syntax.GetLocation());
11074var variableLocation = node.Syntax switch
11078_ => throw ExceptionUtilities.UnexpectedValue(node.Syntax)
11109var foreachSyntax = (ForEachStatementSyntax)node.Syntax;
11807if (!ReportPossibleNullReceiverIfNeeded(resultTypeSymbol, resultType.State, checkNullableValueType, receiverOpt.Syntax, out reportedDiagnostic))
11984ReportDiagnostic(ErrorCode.WRN_ThrowPossibleNull, expr.Syntax);
FlowAnalysis\NullableWalker_Patterns.cs (11)
300var labelStateMap = LearnFromDecisionDag(node.Syntax, node.ReachabilityDecisionDag, node.Expression, expressionState, stateWhenNotNullOpt: null);
452var output = new BoundDagTemp(e.Syntax, parameterType.Type, e, i);
461var output = new BoundDagTemp(e.Syntax, e.Type, e);
490var output = new BoundDagTemp(e.Syntax, type.Type, e);
536var output = new BoundDagTemp(e.Syntax, type.Type, e);
561var output = new BoundDagTemp(e.Syntax, type.Type, e);
573var output = new BoundDagTemp(e.Syntax, type.Type, e);
840var output = new BoundDagTemp(e.Syntax, type.Type, e, index: index);
892var labelStateMap = LearnFromDecisionDag(node.Syntax, node.ReachabilityDecisionDag, node.Expression, expressionState, stateWhenNotNullOpt: null);
907((SwitchExpressionSyntax)node.Syntax).SwitchKeyword.GetLocation(),
1060var labelStateMap = LearnFromDecisionDag(node.Syntax, node.ReachabilityDecisionDag, node.Expression, expressionState, hasStateWhenNotNull ? conditionalStateWhenNotNull : null);
Generated\BoundNodes.xml.Generated.cs (230)
328var result = new BoundFieldEqualsValue(this.Syntax, field, locals, value, this.HasErrors);
358var result = new BoundPropertyEqualsValue(this.Syntax, property, locals, value, this.HasErrors);
388var result = new BoundParameterEqualsValue(this.Syntax, parameter, locals, value, this.HasErrors);
416var result = new BoundGlobalStatementInitializer(this.Syntax, statement, this.HasErrors);
489var result = new BoundValuePlaceholder(this.Syntax, type, this.HasErrors);
519var result = new BoundCapturedReceiverPlaceholder(this.Syntax, receiver, localScopeDepth, type, this.HasErrors);
560var result = new BoundDeconstructValuePlaceholder(this.Syntax, variableSymbol, isDiscardExpression, type, this.HasErrors);
595var result = new BoundTupleOperandPlaceholder(this.Syntax, type, this.HasErrors);
624var result = new BoundAwaitableValuePlaceholder(this.Syntax, type, this.HasErrors);
659var result = new BoundDisposableValuePlaceholder(this.Syntax, type, this.HasErrors);
697var result = new BoundObjectOrCollectionValuePlaceholder(this.Syntax, isNewInstance, type, this.HasErrors);
732var result = new BoundImplicitIndexerValuePlaceholder(this.Syntax, type, this.HasErrors);
770var result = new BoundImplicitIndexerReceiverPlaceholder(this.Syntax, isEquivalentToThisReference, type, this.HasErrors);
805var result = new BoundListPatternReceiverPlaceholder(this.Syntax, type, this.HasErrors);
840var result = new BoundListPatternIndexPlaceholder(this.Syntax, type, this.HasErrors);
875var result = new BoundSlicePatternReceiverPlaceholder(this.Syntax, type, this.HasErrors);
910var result = new BoundSlicePatternRangePlaceholder(this.Syntax, type, this.HasErrors);
941var result = new BoundDup(this.Syntax, refKind, type, this.HasErrors);
969var result = new BoundPassByCopy(this.Syntax, expression, type, this.HasErrors);
1002var result = new BoundBadExpression(this.Syntax, resultKind, symbols, childBoundNodes, type, this.HasErrors);
1030var result = new BoundBadStatement(this.Syntax, childBoundNodes, this.HasErrors);
1058var result = new BoundExtractedFinallyBlock(this.Syntax, finallyBlock, this.HasErrors);
1093var result = new BoundTypeExpression(this.Syntax, aliasOpt, boundContainingTypeOpt, boundDimensionsOpt, typeWithAnnotations, type, this.HasErrors);
1131var result = new BoundTypeOrValueExpression(this.Syntax, data, type, this.HasErrors);
1172var result = new BoundNamespaceExpression(this.Syntax, namespaceSymbol, aliasOpt, this.HasErrors);
1214var result = new BoundUnaryOperator(this.Syntax, operatorKind, operand, constantValueOpt, methodOpt, constrainedToTypeOpt, resultKind, originalUserDefinedOperatorsOpt, type, this.HasErrors);
1262var result = new BoundIncrementOperator(this.Syntax, operatorKind, operand, methodOpt, constrainedToTypeOpt, operandPlaceholder, operandConversion, resultPlaceholder, resultConversion, resultKind, originalUserDefinedOperatorsOpt, type, this.HasErrors);
1294var result = new BoundAddressOfOperator(this.Syntax, operand, isManaged, type, this.HasErrors);
1323var result = new BoundUnconvertedAddressOfOperator(this.Syntax, operand, this.HasErrors);
1366var result = new BoundFunctionPointerLoad(this.Syntax, targetMethod, constrainedToTypeOpt, type, this.HasErrors);
1398var result = new BoundPointerIndirectionOperator(this.Syntax, operand, refersToLocation, type, this.HasErrors);
1435var result = new BoundPointerElementAccess(this.Syntax, expression, index, @checked, refersToLocation, type, this.HasErrors);
1472var result = new BoundFunctionPointerInvocation(this.Syntax, invokedExpression, arguments, argumentRefKindsOpt, resultKind, type, this.HasErrors);
1504var result = new BoundRefTypeOperator(this.Syntax, operand, getTypeFromHandle, type, this.HasErrors);
1534var result = new BoundMakeRefOperator(this.Syntax, operand, type, this.HasErrors);
1566var result = new BoundRefValueOperator(this.Syntax, nullableAnnotation, operand, type, this.HasErrors);
1598var result = new BoundFromEndIndexExpression(this.Syntax, operand, methodOpt, type, this.HasErrors);
1631var result = new BoundRangeExpression(this.Syntax, leftOperandOpt, rightOperandOpt, methodOpt, type, this.HasErrors);
1684var result = new BoundBinaryOperator(this.Syntax, operatorKind, data, resultKind, left, right, type, this.HasErrors);
1722var result = new BoundTupleBinaryOperator(this.Syntax, left, right, operatorKind, operators, type, this.HasErrors);
1767var result = new BoundUserDefinedConditionalLogicalOperator(this.Syntax, operatorKind, logicalOperator, trueOperator, falseOperator, constrainedToTypeOpt, resultKind, originalUserDefinedOperatorsOpt, left, right, type, this.HasErrors);
1814var result = new BoundCompoundAssignmentOperator(this.Syntax, @operator, left, right, leftPlaceholder, leftConversion, finalPlaceholder, finalConversion, resultKind, originalUserDefinedOperatorsOpt, type, this.HasErrors);
1848var result = new BoundAssignmentOperator(this.Syntax, left, right, isRef, type, this.HasErrors);
1883var result = new BoundDeconstructionAssignmentOperator(this.Syntax, left, right, isUsed, type, this.HasErrors);
1924var result = new BoundNullCoalescingOperator(this.Syntax, leftOperand, rightOperand, leftPlaceholder, leftConversion, operatorResultKind, @checked, type, this.HasErrors);
1955var result = new BoundNullCoalescingAssignmentOperator(this.Syntax, leftOperand, rightOperand, type, this.HasErrors);
1994var result = new BoundUnconvertedConditionalOperator(this.Syntax, condition, consequence, alternative, constantValueOpt, noCommonTypeError, this.HasErrors);
2038var result = new BoundConditionalOperator(this.Syntax, isRef, condition, consequence, alternative, constantValueOpt, naturalTypeOpt, wasTargetTyped, type, this.HasErrors);
2071var result = new BoundArrayAccess(this.Syntax, expression, indices, type, this.HasErrors);
2100var result = new BoundRefArrayAccess(this.Syntax, arrayAccess, this.HasErrors);
2130var result = new BoundArrayLength(this.Syntax, expression, type, this.HasErrors);
2163var result = new BoundAwaitableInfo(this.Syntax, awaitableInstancePlaceholder, isDynamic, getAwaiter, isCompleted, getResult, this.HasErrors);
2198var result = new BoundAwaitExpression(this.Syntax, expression, awaitableInfo, debugInfo, type, this.HasErrors);
2251var result = new BoundTypeOfOperator(this.Syntax, sourceType, getTypeFromHandle, type, this.HasErrors);
2283var result = new BoundBlockInstrumentation(this.Syntax, locals, prologue, epilogue, this.HasErrors);
2323var result = new BoundMethodDefIndex(this.Syntax, method, type, this.HasErrors);
2366var result = new BoundLocalId(this.Syntax, local, hoistedField, type, this.HasErrors);
2409var result = new BoundParameterId(this.Syntax, parameter, hoistedField, type, this.HasErrors);
2444var result = new BoundStateMachineInstanceId(this.Syntax, type, this.HasErrors);
2479var result = new BoundMaximumMethodDefIndex(this.Syntax, type, this.HasErrors);
2517var result = new BoundInstrumentationPayloadRoot(this.Syntax, analysisKind, type, this.HasErrors);
2552var result = new BoundThrowIfModuleCancellationRequested(this.Syntax, type, this.HasErrors);
2587var result = new ModuleCancellationTokenExpression(this.Syntax, type, this.HasErrors);
2622var result = new BoundModuleVersionId(this.Syntax, type, this.HasErrors);
2657var result = new BoundModuleVersionIdString(this.Syntax, type, this.HasErrors);
2697var result = new BoundSourceDocumentIndex(this.Syntax, document, type, this.HasErrors);
2740var result = new BoundMethodInfo(this.Syntax, method, getMethodFromHandle, type, this.HasErrors);
2783var result = new BoundFieldInfo(this.Syntax, field, getFieldFromHandle, type, this.HasErrors);
2837var result = new BoundDefaultExpression(this.Syntax, targetType, constantValueOpt, type, this.HasErrors);
2872var result = new BoundIsOperator(this.Syntax, operand, targetType, conversionKind, type, this.HasErrors);
2909var result = new BoundAsOperator(this.Syntax, operand, targetType, operandPlaceholder, operandConversion, type, this.HasErrors);
2941var result = new BoundSizeOfOperator(this.Syntax, sourceType, constantValueOpt, type, this.HasErrors);
2985var result = new BoundConversion(this.Syntax, operand, conversion, isBaseConversion, @checked, explicitCastInCode, constantValueOpt, conversionGroupOpt, originalUserDefinedConversionsOpt, type, this.HasErrors);
3018var result = new BoundReadOnlySpanFromArray(this.Syntax, operand, conversionMethod, type, this.HasErrors);
3053var result = new BoundArgList(this.Syntax, type, this.HasErrors);
3084var result = new BoundArgListOperator(this.Syntax, arguments, argumentRefKindsOpt, type, this.HasErrors);
3123var result = new BoundFixedLocalCollectionInitializer(this.Syntax, elementPointerType, elementPointerPlaceholder, elementPointerConversion, expression, getPinnableOpt, type, this.HasErrors);
3162var result = new BoundSequencePoint(this.Syntax, statementOpt, this.HasErrors);
3189var result = new BoundSequencePointWithSpan(this.Syntax, statementOpt, span, this.HasErrors);
3226var result = new BoundSavePreviousSequencePoint(this.Syntax, identifier, this.HasErrors);
3263var result = new BoundRestorePreviousSequencePoint(this.Syntax, identifier, this.HasErrors);
3294var result = new BoundStepThroughSequencePoint(this.Syntax, span, this.HasErrors);
3330var result = new BoundBlock(this.Syntax, locals, localFunctions, hasUnsafeModifier, instrumentation, statements, this.HasErrors);
3359var result = new BoundScope(this.Syntax, locals, statements, this.HasErrors);
3390var result = new BoundStateMachineScope(this.Syntax, fields, statement, this.HasErrors);
3426var result = new BoundLocalDeclaration(this.Syntax, localSymbol, declaredTypeOpt, initializerOpt, argumentsOpt, inferredType, this.HasErrors);
3466var result = new BoundMultipleLocalDeclarations(this.Syntax, localDeclarations, this.HasErrors);
3496var result = new BoundUsingLocalDeclarations(this.Syntax, patternDisposeInfoOpt, awaitOpt, localDeclarations, this.HasErrors);
3528var result = new BoundLocalFunctionStatement(this.Syntax, symbol, blockBody, expressionBody, this.HasErrors);
3559var result = new BoundNoOpStatement(this.Syntax, flavor, this.HasErrors);
3588var result = new BoundReturnStatement(this.Syntax, refKind, expressionOpt, @checked, this.HasErrors);
3616var result = new BoundYieldReturnStatement(this.Syntax, expression, this.HasErrors);
3658var result = new BoundThrowStatement(this.Syntax, expressionOpt, this.HasErrors);
3686var result = new BoundExpressionStatement(this.Syntax, expression, this.HasErrors);
3723var result = new BoundBreakStatement(this.Syntax, label, this.HasErrors);
3760var result = new BoundContinueStatement(this.Syntax, label, this.HasErrors);
3805var result = new BoundSwitchStatement(this.Syntax, expression, innerLocals, innerLocalFunctions, switchSections, reachabilityDecisionDag, defaultLabel, breakLabel, this.HasErrors);
3841var result = new BoundSwitchDispatch(this.Syntax, expression, cases, defaultLabel, lengthBasedStringSwitchDataOpt, this.HasErrors);
3874var result = new BoundIfStatement(this.Syntax, condition, consequence, alternativeOpt, this.HasErrors);
3954var result = new BoundDoStatement(this.Syntax, locals, condition, body, breakLabel, continueLabel, this.HasErrors);
3984var result = new BoundWhileStatement(this.Syntax, locals, condition, body, breakLabel, continueLabel, this.HasErrors);
4026var result = new BoundForStatement(this.Syntax, outerLocals, initializer, innerLocals, condition, increment, body, breakLabel, continueLabel, this.HasErrors);
4077var result = new BoundForEachStatement(this.Syntax, enumeratorInfoOpt, elementPlaceholder, elementConversion, iterationVariableType, iterationVariables, iterationErrorExpressionOpt, expression, deconstructionOpt, awaitOpt, body, breakLabel, continueLabel, this.HasErrors);
4108var result = new BoundForEachDeconstructStep(this.Syntax, deconstructionAssignment, targetPlaceholder, this.HasErrors);
4147var result = new BoundUsingStatement(this.Syntax, locals, declarationsOpt, expressionOpt, body, awaitOpt, patternDisposeInfoOpt, this.HasErrors);
4181var result = new BoundFixedStatement(this.Syntax, locals, declarations, body, this.HasErrors);
4212var result = new BoundLockStatement(this.Syntax, argument, body, this.HasErrors);
4249var result = new BoundTryStatement(this.Syntax, tryBlock, catchBlocks, finallyBlockOpt, finallyLabelOpt, preferFaultHandler, this.HasErrors);
4290var result = new BoundCatchBlock(this.Syntax, locals, exceptionSourceOpt, exceptionTypeOpt, exceptionFilterPrologueOpt, exceptionFilterOpt, body, isSynthesizedAsyncCatchAll, this.HasErrors);
4321var result = new BoundLiteral(this.Syntax, constantValueOpt, type, this.HasErrors);
4361var result = new BoundUtf8String(this.Syntax, value, type, this.HasErrors);
4396var result = new BoundThisReference(this.Syntax, type, this.HasErrors);
4431var result = new BoundPreviousSubmissionReference(this.Syntax, type, this.HasErrors);
4466var result = new BoundHostObjectMemberReference(this.Syntax, type, this.HasErrors);
4495var result = new BoundBaseReference(this.Syntax, type, this.HasErrors);
4544var result = new BoundLocal(this.Syntax, localSymbol, declarationKind, constantValueOpt, isNullableUnknown, type, this.HasErrors);
4589var result = new BoundPseudoVariable(this.Syntax, localSymbol, emitExpressions, type, this.HasErrors);
4622var result = new BoundRangeVariable(this.Syntax, rangeVariableSymbol, value, type, this.HasErrors);
4662var result = new BoundParameter(this.Syntax, parameterSymbol, type, this.HasErrors);
4699var result = new BoundLabelStatement(this.Syntax, label, this.HasErrors);
4731var result = new BoundGotoStatement(this.Syntax, label, caseExpressionOpt, labelExpressionOpt, this.HasErrors);
4762var result = new BoundLabeledStatement(this.Syntax, label, body, this.HasErrors);
4799var result = new BoundLabel(this.Syntax, label, type, this.HasErrors);
4836var result = new BoundStatementList(this.Syntax, statements, this.HasErrors);
4869var result = new BoundConditionalGoto(this.Syntax, condition, jumpIfTrue, label, this.HasErrors);
4932var result = new BoundSwitchExpressionArm(this.Syntax, locals, pattern, whenClause, value, label, this.HasErrors);
4960var result = new BoundUnconvertedSwitchExpression(this.Syntax, expression, switchArms, reachabilityDecisionDag, defaultLabel, reportedNotExhaustive, type, this.HasErrors);
4994var result = new BoundConvertedSwitchExpression(this.Syntax, naturalTypeOpt, wasTargetTyped, expression, switchArms, reachabilityDecisionDag, defaultLabel, reportedNotExhaustive, type, this.HasErrors);
5022var result = new BoundDecisionDag(this.Syntax, rootNode, this.HasErrors);
5067var result = new BoundEvaluationDecisionDagNode(this.Syntax, evaluation, next, this.HasErrors);
5101var result = new BoundTestDecisionDagNode(this.Syntax, test, whenTrue, whenFalse, this.HasErrors);
5136var result = new BoundWhenDecisionDagNode(this.Syntax, bindings, whenExpression, whenTrue, whenFalse, this.HasErrors);
5173var result = new BoundLeafDecisionDagNode(this.Syntax, label, this.HasErrors);
5219var result = new BoundDagTemp(this.Syntax, type, source, index, this.HasErrors);
5248var result = new BoundDagTypeTest(this.Syntax, type, input, this.HasErrors);
5276var result = new BoundDagNonNullTest(this.Syntax, isExplicitTest, input, this.HasErrors);
5302var result = new BoundDagExplicitNullTest(this.Syntax, input, this.HasErrors);
5331var result = new BoundDagValueTest(this.Syntax, value, input, this.HasErrors);
5362var result = new BoundDagRelationalTest(this.Syntax, operatorKind, value, input, this.HasErrors);
5403var result = new BoundDagDeconstructEvaluation(this.Syntax, deconstructMethod, input, this.HasErrors);
5432var result = new BoundDagTypeEvaluation(this.Syntax, type, input, this.HasErrors);
5461var result = new BoundDagFieldEvaluation(this.Syntax, field, input, this.HasErrors);
5492var result = new BoundDagPropertyEvaluation(this.Syntax, property, isLengthOrCount, input, this.HasErrors);
5523var result = new BoundDagIndexEvaluation(this.Syntax, property, index, input, this.HasErrors);
5570var result = new BoundDagIndexerEvaluation(this.Syntax, indexerType, lengthTemp, index, indexerAccess, receiverPlaceholder, argumentPlaceholder, input, this.HasErrors);
5619var result = new BoundDagSliceEvaluation(this.Syntax, sliceType, lengthTemp, startIndex, endIndex, indexerAccess, receiverPlaceholder, argumentPlaceholder, input, this.HasErrors);
5648var result = new BoundDagAssignmentEvaluation(this.Syntax, target, input, this.HasErrors);
5680var result = new BoundSwitchSection(this.Syntax, locals, switchLabels, statements, this.HasErrors);
5713var result = new BoundSwitchLabel(this.Syntax, label, pattern, whenClause, this.HasErrors);
5755var result = new BoundSequencePointExpression(this.Syntax, expression, type, this.HasErrors);
5791var result = new BoundSequence(this.Syntax, locals, sideEffects, value, type, this.HasErrors);
5827var result = new BoundSpillSequence(this.Syntax, locals, sideEffects, value, type, this.HasErrors);
5866var result = new BoundDynamicMemberAccess(this.Syntax, receiver, typeArgumentsOpt, name, invoked, indexed, type, this.HasErrors);
5919var result = new BoundDynamicInvocation(this.Syntax, argumentNamesOpt, argumentRefKindsOpt, applicableMethods, expression, arguments, type, this.HasErrors);
5952var result = new BoundConditionalAccess(this.Syntax, receiver, accessExpression, type, this.HasErrors);
5993var result = new BoundLoweredConditionalAccess(this.Syntax, receiver, hasValueMethodOpt, whenNotNull, whenNullOpt, id, forceCopyOfNullableValueType, type, this.HasErrors);
6031var result = new BoundConditionalReceiver(this.Syntax, id, type, this.HasErrors);
6064var result = new BoundComplexConditionalReceiver(this.Syntax, valueTypeReceiver, referenceTypeReceiver, type, this.HasErrors);
6105var result = new BoundMethodGroup(this.Syntax, typeArgumentsOpt, name, methods, lookupSymbolOpt, lookupError, flags, functionType, receiverOpt, resultKind, this.HasErrors);
6133var result = new BoundPropertyGroup(this.Syntax, properties, receiverOpt, resultKind, this.HasErrors);
6188var result = new BoundCall(this.Syntax, receiverOpt, initialBindingReceiverIsSubjectToCloning, method, arguments, argumentNamesOpt, argumentRefKindsOpt, isDelegateCall, expanded, invokedAsExtensionMethod, argsToParamsOpt, defaultArguments, resultKind, originalMethodsOpt, type, this.HasErrors);
6227var result = new BoundEventAssignmentOperator(this.Syntax, @event, isAddition, isDynamic, receiverOpt, argument, type, this.HasErrors);
6272var result = new BoundAttribute(this.Syntax, constructor, constructorArguments, constructorArgumentNamesOpt, constructorArgumentsToParamsOpt, constructorExpanded, constructorDefaultArguments, namedArguments, resultKind, type, this.HasErrors);
6310var result = new BoundUnconvertedObjectCreationExpression(this.Syntax, arguments, argumentNamesOpt, argumentRefKindsOpt, initializerOpt, binder, this.HasErrors);
6382var result = new BoundObjectCreationExpression(this.Syntax, constructor, constructorsGroup, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, defaultArguments, constantValueOpt, initializerExpressionOpt, wasTargetTyped, type, this.HasErrors);
6423var result = new BoundUnconvertedCollectionExpression(this.Syntax, elements, this.HasErrors);
6468var result = new BoundCollectionExpression(this.Syntax, collectionTypeKind, placeholder, collectionCreation, collectionBuilderMethod, collectionBuilderInvocationPlaceholder, collectionBuilderInvocationConversion, wasTargetTyped, unconvertedCollectionExpression, elements, type, this.HasErrors);
6496var result = new BoundCollectionExpressionSpreadExpressionPlaceholder(this.Syntax, type, this.HasErrors);
6536var result = new BoundCollectionExpressionSpreadElement(this.Syntax, expression, expressionPlaceholder, conversion, enumeratorInfoOpt, lengthOrCount, elementPlaceholder, iteratorBody, this.HasErrors);
6581var result = new BoundTupleLiteral(this.Syntax, arguments, argumentNamesOpt, inferredNamesOpt, type, this.HasErrors);
6611var result = new BoundConvertedTupleLiteral(this.Syntax, sourceTuple, wasTargetTyped, arguments, argumentNamesOpt, inferredNamesOpt, type, this.HasErrors);
6654var result = new BoundDynamicObjectCreationExpression(this.Syntax, name, arguments, argumentNamesOpt, argumentRefKindsOpt, initializerExpressionOpt, applicableMethods, wasTargetTyped, type, this.HasErrors);
6686var result = new BoundNoPiaObjectCreationExpression(this.Syntax, guidString, initializerExpressionOpt, wasTargetTyped, type, this.HasErrors);
6733var result = new BoundObjectInitializerExpression(this.Syntax, placeholder, initializers, type, this.HasErrors);
6782var result = new BoundObjectInitializerMember(this.Syntax, memberSymbol, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, argsToParamsOpt, defaultArguments, resultKind, accessorKind, receiverType, type, this.HasErrors);
6827var result = new BoundDynamicObjectInitializerMember(this.Syntax, memberName, receiverType, type, this.HasErrors);
6855var result = new BoundCollectionInitializerExpression(this.Syntax, placeholder, initializers, type, this.HasErrors);
6900var result = new BoundCollectionElementInitializer(this.Syntax, addMethod, arguments, implicitReceiverOpt, expanded, argsToParamsOpt, defaultArguments, invokedAsExtensionMethod, resultKind, type, this.HasErrors);
6932var result = new BoundDynamicCollectionElementInitializer(this.Syntax, applicableMethods, expression, arguments, type, this.HasErrors);
6967var result = new BoundImplicitReceiver(this.Syntax, type, this.HasErrors);
7003var result = new BoundAnonymousObjectCreationExpression(this.Syntax, constructor, arguments, declarations, type, this.HasErrors);
7043var result = new BoundAnonymousPropertyDeclaration(this.Syntax, property, type, this.HasErrors);
7073var result = new BoundNewT(this.Syntax, initializerExpressionOpt, wasTargetTyped, type, this.HasErrors);
7109var result = new BoundDelegateCreationExpression(this.Syntax, argument, methodOpt, isExtensionMethod, wasTargetTyped, type, this.HasErrors);
7141var result = new BoundArrayCreation(this.Syntax, bounds, initializerOpt, type, this.HasErrors);
7172var result = new BoundArrayInitialization(this.Syntax, isInferred, initializers, this.HasErrors);
7218var result = new BoundStackAllocArrayCreation(this.Syntax, elementType, count, initializerOpt, type, this.HasErrors);
7247var result = new BoundConvertedStackAllocExpression(this.Syntax, elementType, count, initializerOpt, type, this.HasErrors);
7287var result = new BoundFieldAccess(this.Syntax, receiverOpt, fieldSymbol, constantValueOpt, resultKind, isByValue, isDeclaration, type, this.HasErrors);
7327var result = new BoundHoistedFieldAccess(this.Syntax, fieldSymbol, type, this.HasErrors);
7365var result = new BoundPropertyAccess(this.Syntax, receiverOpt, initialBindingReceiverIsSubjectToCloning, propertySymbol, autoPropertyAccessorKind, resultKind, type, this.HasErrors);
7401var result = new BoundEventAccess(this.Syntax, receiverOpt, eventSymbol, isUsableAsField, resultKind, type, this.HasErrors);
7452var result = new BoundIndexerAccess(this.Syntax, receiverOpt, initialBindingReceiverIsSubjectToCloning, indexer, arguments, argumentNamesOpt, argumentRefKindsOpt, expanded, accessorKind, argsToParamsOpt, defaultArguments, originalIndexersOpt, type, this.HasErrors);
7501var result = new BoundImplicitIndexerAccess(this.Syntax, receiver, argument, lengthOrCountAccess, receiverPlaceholder, indexerOrSliceAccess, argumentPlaceholders, type, this.HasErrors);
7542var result = new BoundInlineArrayAccess(this.Syntax, expression, argument, isValue, getItemOrSliceHelper, type, this.HasErrors);
7582var result = new BoundDynamicIndexerAccess(this.Syntax, receiver, arguments, argumentNamesOpt, argumentRefKindsOpt, applicableIndexers, type, this.HasErrors);
7622var result = new BoundLambda(this.Syntax, unboundLambda, symbol, body, diagnostics, binder, type, this.HasErrors);
7666var result = new UnboundLambda(this.Syntax, data, functionType, withDependencies, this.HasErrors);
7707var result = new BoundQueryClause(this.Syntax, value, definedSymbol, operation, cast, binder, unoptimizedForm, type, this.HasErrors);
7733var result = new BoundTypeOrInstanceInitializers(this.Syntax, statements, this.HasErrors);
7766var result = new BoundNameOfOperator(this.Syntax, argument, constantValueOpt, type, this.HasErrors);
7808var result = new BoundUnconvertedInterpolatedString(this.Syntax, parts, constantValueOpt, type, this.HasErrors);
7836var result = new BoundInterpolatedString(this.Syntax, interpolationData, parts, constantValueOpt, type, this.HasErrors);
7864var result = new BoundInterpolatedStringHandlerPlaceholder(this.Syntax, type, this.HasErrors);
7902var result = new BoundInterpolatedStringArgumentPlaceholder(this.Syntax, argumentIndex, type, this.HasErrors);
7937var result = new BoundStringInsert(this.Syntax, value, alignment, format, isInterpolatedStringHandlerAppendCall, this.HasErrors);
7979var result = new BoundIsPatternExpression(this.Syntax, expression, pattern, isNegated, reachabilityDecisionDag, whenTrueLabel, whenFalseLabel, type, this.HasErrors);
8040var result = new BoundConstantPattern(this.Syntax, value, constantValue, inputType, narrowedType, this.HasErrors);
8076var result = new BoundDiscardPattern(this.Syntax, inputType, narrowedType, this.HasErrors);
8125var result = new BoundDeclarationPattern(this.Syntax, declaredType, isVar, variable, variableAccess, inputType, narrowedType, this.HasErrors);
8162var result = new BoundRecursivePattern(this.Syntax, declaredType, deconstructMethod, deconstruction, properties, isExplicitNotNullTest, variable, variableAccess, inputType, narrowedType, this.HasErrors);
8206var result = new BoundListPattern(this.Syntax, subpatterns, hasSlice, lengthAccess, indexerAccess, receiverPlaceholder, argumentPlaceholder, variable, variableAccess, inputType, narrowedType, this.HasErrors);
8245var result = new BoundSlicePattern(this.Syntax, pattern, indexerAccess, receiverPlaceholder, argumentPlaceholder, inputType, narrowedType, this.HasErrors);
8281var result = new BoundITuplePattern(this.Syntax, getLengthMethod, getItemMethod, subpatterns, inputType, narrowedType, this.HasErrors);
8323var result = new BoundPositionalSubpattern(this.Syntax, symbol, pattern, this.HasErrors);
8353var result = new BoundPropertySubpattern(this.Syntax, member, isLengthOrCount, pattern, this.HasErrors);
8385var result = new BoundPropertySubpatternMember(this.Syntax, receiver, symbol, type, this.HasErrors);
8417var result = new BoundTypePattern(this.Syntax, declaredType, isExplicitNotNullTest, inputType, narrowedType, this.HasErrors);
8452var result = new BoundBinaryPattern(this.Syntax, disjunction, left, right, inputType, narrowedType, this.HasErrors);
8482var result = new BoundNegatedPattern(this.Syntax, negated, inputType, narrowedType, this.HasErrors);
8517var result = new BoundRelationalPattern(this.Syntax, relation, value, constantValue, inputType, narrowedType, this.HasErrors);
8552var result = new BoundDiscardExpression(this.Syntax, nullableAnnotation, isInferred, type, this.HasErrors);
8580var result = new BoundThrowExpression(this.Syntax, expression, type, this.HasErrors);
8623var result = new OutVariablePendingInference(this.Syntax, variableSymbol, receiverOpt, this.HasErrors);
8649var result = new DeconstructionVariablePendingInference(this.Syntax, variableSymbol, receiverOpt, this.HasErrors);
8684var result = new OutDeconstructVarPendingInference(this.Syntax, variableSymbol, isDiscardExpression, this.HasErrors);
8720var result = new BoundNonConstructorMethodBody(this.Syntax, blockBody, expressionBody, this.HasErrors);
8750var result = new BoundConstructorMethodBody(this.Syntax, locals, initializer, blockBody, expressionBody, this.HasErrors);
8781var result = new BoundExpressionWithNullability(this.Syntax, expression, nullableAnnotation, type, this.HasErrors);
8816var result = new BoundWithExpression(this.Syntax, receiver, cloneMethod, initializerExpression, type, this.HasErrors);
Lowering\ClosureConversion\ClosureConversion.cs (22)
301body = new BoundBlock(body.Syntax, _addedLocals.ToImmutableAndFree(), _addedStatements.ToImmutableAndFree()) { WasCompilerGenerated = true };
367var syntax = scopeBoundNode.Syntax;
668SyntaxNode syntax = node.Syntax;
824return new BoundParameter(node.Syntax, replacementParameter, node.HasErrors);
844FramePointer(node.Syntax, (NamedTypeSymbol)node.Type));
851: FramePointer(node.Syntax, _topLevelMethod.ContainingType); // technically, not the correct static type
1080node.Syntax,
1122syntax: node.Syntax,
1208return new BoundStatementList(node.Syntax, statements);
1247rewrittenExceptionSource.Syntax,
1267rewrittenFilterPrologue = new BoundStatementList(rewrittenFilter.Syntax, prologueBuilder.ToImmutableAndFree());
1320return new BoundBlock(node.Syntax, newLocals.ToImmutableAndFree(), newStatements.ToImmutableAndFree(), node.HasErrors);
1344node.Syntax,
1352node.Syntax,
1371node.Syntax,
1402syntax: conversion.Syntax,
1436return new BoundNoOpStatement(node.Syntax, NoOpStatementFlavor.Default);
1651RemapLambdaOrLocalFunction(node.Syntax, node.Symbol, default(ImmutableArray<TypeWithAnnotations>), closureKind, ref referencedMethod, out receiver, out constructedFrame);
1662node.Syntax,
1680InLoopOrLambda(node.Syntax, lambdaScope.Syntax);
1685var F = new SyntheticBoundNodeFactory(_currentMethod, node.Syntax, CompilationState, Diagnostics);
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (8)
116var r = new ExpressionLambdaRewriter(compilationState, typeMap, node.Syntax, recursionDepth, diagnostics);
120diagnostics.Add(ErrorCode.ERR_MissingPredefinedMember, node.Syntax.Location, r.ExpressionType, "Lambda");
173_bound.Syntax = node.Syntax;
351return new BoundBadExpression(node.Syntax, default(LookupResultKind), ImmutableArray<Symbol>.Empty, ImmutableArray.Create<BoundExpression>(node), ExpressionType);
382return new BoundBadExpression(node.Syntax, 0, ImmutableArray<Symbol>.Empty, ImmutableArray.Create<BoundExpression>(node), ExpressionType);
1091return new BoundBadExpression(node.Syntax, default(LookupResultKind), ImmutableArray<Symbol>.Empty, ImmutableArray.Create<BoundExpression>(node), node.Type);
1098return new BoundBadExpression(node.Syntax, default(LookupResultKind), ImmutableArray<Symbol>.Empty, ImmutableArray.Create<BoundExpression>(node), node.Type);
1130return new BoundBadExpression(node.Syntax, default(LookupResultKind), ImmutableArray<Symbol>.Empty, ImmutableArray.Create<BoundExpression>(node), node.Type);
Lowering\DiagnosticsPass_ExpressionTrees.cs (6)
61_diagnostics.Add(code, node.Syntax.Location, args);
278Binder.ReportDiagnosticsIfObsolete(_diagnostics, node.EventSymbol.AssociatedField, node.Syntax, hasBaseReceiver, _containingSymbol, _containingSymbol.ContainingType, BinderFlags.None);
292Binder.ReportDiagnosticsIfObsolete(_diagnostics, node.Event, ((AssignmentExpressionSyntax)node.Syntax).Left, hasBaseReceiver, _containingSymbol, _containingSymbol.ContainingType, BinderFlags.None);
591switch (node.Syntax.Kind())
595var lambdaSyntax = (ParenthesizedLambdaExpressionSyntax)node.Syntax;
613var lambdaSyntax = (SimpleLambdaExpressionSyntax)node.Syntax;
Lowering\Instrumentation\DebugInfoInjector.cs (45)
61switch (original.Syntax)
106throw ExceptionUtilities.UnexpectedValue(original.Syntax.Kind());
109else if (original.Syntax is ParameterSyntax parameterSyntax)
121SyntaxNode syntax = original.Syntax;
172if (original.WasCompilerGenerated && original.Syntax.Kind() == SyntaxKind.Block)
175return new BoundSequencePointWithSpan(original.Syntax, rewritten, ((BlockSyntax)original.Syntax).CloseBraceToken.Span);
193if (original.Syntax is BlockSyntax blockSyntax && !original.WasCompilerGenerated)
195prologue = new BoundSequencePointWithSpan(original.Syntax, previousPrologue, blockSyntax.OpenBraceToken.Span);
199SyntaxNode? parent = original.Syntax.Parent;
202epilogue = new BoundSequencePointWithSpan(original.Syntax, previousEpilogue, blockSyntax.CloseBraceToken.Span);
215original.Syntax is RecordDeclarationSyntax { ParameterList.Parameters.Count: > 0 })
231return AddConditionSequencePoint(base.InstrumentDoStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory);
238return AddConditionSequencePoint(base.InstrumentWhileStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory);
243var doSyntax = (DoStatementSyntax)original.Syntax;
253WhileStatementSyntax whileSyntax = (WhileStatementSyntax)original.Syntax;
271var forEachSyntax = (CommonForEachStatementSyntax)original.Syntax;
278var forEachSyntax = (ForEachVariableStatementSyntax)original.Syntax;
292var forEachSyntax = (CommonForEachStatementSyntax)original.Syntax;
314switch (original.Syntax.Kind())
318var forEachSyntax = (ForEachStatementSyntax)original.Syntax;
324var forEachSyntax = (ForEachVariableStatementSyntax)original.Syntax;
329throw ExceptionUtilities.UnexpectedValue(original.Syntax.Kind());
331return new BoundSequencePointWithSpan(original.Syntax,
339return BoundSequencePoint.Create(original.Condition?.Syntax,
345var syntax = (CommonForEachStatementSyntax)original.Syntax;
355return AddConditionSequencePoint(base.InstrumentForStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory);
360var syntax = (IfStatementSyntax)original.Syntax;
374return AddConditionSequencePoint(base.InstrumentIfStatementCondition(original, rewrittenCondition, factory), original.Syntax, factory);
379var labeledSyntax = (LabeledStatementSyntax)original.Syntax;
388return AddSequencePoint(original.Syntax.Kind() == SyntaxKind.VariableDeclarator ?
389(VariableDeclaratorSyntax)original.Syntax :
390((LocalDeclarationStatementSyntax)original.Syntax).Declaration.Variables.First(),
396LockStatementSyntax lockSyntax = (LockStatementSyntax)original.Syntax;
406if (original.WasCompilerGenerated && original.ExpressionOpt == null && original.Syntax.Kind() == SyntaxKind.Block)
409return new BoundSequencePointWithSpan(original.Syntax, rewritten, ((BlockSyntax)original.Syntax).CloseBraceToken.Span);
412if (original.Syntax is ParameterSyntax parameterSyntax)
420return new BoundSequencePoint(original.Syntax, rewritten);
425SwitchStatementSyntax switchSyntax = (SwitchStatementSyntax)original.Syntax;
439WhenClauseSyntax? whenClause = original.Syntax.FirstAncestorOrSelf<WhenClauseSyntax>();
450return AddSequencePoint((UsingStatementSyntax)original.Syntax,
480var filterClause = ((CatchClauseSyntax)original.Syntax).Filter;
490return AddConditionSequencePoint(base.InstrumentSwitchStatementExpression(original, rewrittenExpression, factory), original.Syntax, factory);
495return new BoundSequencePointExpression(original.Syntax, base.InstrumentSwitchExpressionArmExpression(original, rewrittenExpression, factory), rewrittenExpression.Type);
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (6)
181var scope = new Scope(factory.SynthesizedLocal(contextType, methodBody.Syntax, kind: SynthesizedLocalKind.LocalStoreTracker));
280_scope.Open(_factory.SynthesizedLocal(_contextType, original.Syntax, kind: SynthesizedLocalKind.LocalStoreTracker));
394var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal, original.Syntax);
464var toStringMethod = GetSpecialMethodSymbol(SpecialMember.System_Object__ToString, value.Syntax);
525var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, original.Syntax);
589var logger = GetLocalOrParameterStoreLogger(targetType, targetSymbol, refAssignmentSourceIsLocal: null, invocation.Syntax);
Lowering\IteratorRewriter\IteratorRewriter.cs (4)
142Binder.TryGetSpecialTypeMember(F.Compilation, member, body.Syntax, bag, out symbol);
148Binder.GetSpecialType(F.Compilation, type, body.Syntax, bag);
162Binder.Error(bag, ErrorCode.ERR_PropertyLacksGet, body.Syntax, symbol);
166bag.ReportUseSite(getter, body.Syntax.Location);
Lowering\LocalRewriter\LocalRewriter.cs (17)
107var factory = new SyntheticBoundNodeFactory(method, statement.Syntax, compilationState, diagnostics, instrumentationState);
173return new BoundBadStatement(statement.Syntax, ImmutableArray.Create<BoundNode>(statement), hasErrors: true);
249var nameofIdentiferSyntax = (IdentifierNameSyntax)((InvocationExpressionSyntax)nameofOperator.Syntax).Expression;
262var result = MakeLiteral(node.Syntax, constantValue, type);
300visited.Syntax,
318var result = new BoundFieldAccess(node.Syntax, new BoundThisReference(node.Syntax, primaryCtor.ContainingType), field, ConstantValue.NotAvailable, LookupResultKind.Viable, node.Type);
343location = node.Syntax.Location;
578return BadExpression(node.Syntax, node.Type, ImmutableArray.Create(node));
662tryGetResult = TryGetSpecialTypeMethod(node.Syntax, SpecialMember.System_Type__GetTypeFromHandle, out getTypeFromHandle);
666tryGetResult = TryGetWellKnownTypeMember(node.Syntax, WellKnownMember.System_Type__GetTypeFromHandle, out getTypeFromHandle);
671return new BoundTypeOfOperator(node.Syntax, sourceType, null, type, hasErrors: true);
688if (!TryGetWellKnownTypeMember(node.Syntax, WellKnownMember.System_Type__GetTypeFromHandle, out getTypeFromHandle))
690return new BoundRefTypeOperator(node.Syntax, operand, null, type, hasErrors: true);
730statement.Syntax,
814return new BoundStatementList(node.Syntax, rewrittenStatements, node.HasErrors);
863var syntax = initializer.Syntax;
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (10)
474_factory.Syntax = test.Syntax;
568return new ValueDispatchNode.LeafDispatchNode(node.Syntax, label);
573return new ValueDispatchNode.LeafDispatchNode(node.Syntax, label);
583return ValueDispatchNode.RelationalDispatch.CreateBalanced(testNode.Syntax, relational.Value, relational.OperatorKind, whenTrue: whenTrue, whenFalse: whenFalse);
604return PushEqualityTestsIntoTree(value.Syntax, otherwise, cases.ToImmutableAndFree(), fac);
609return new ValueDispatchNode.LeafDispatchNode(node.Syntax, label);
1063ArrayBuilder<BoundStatement> sectionBuilder = BuilderForSection(whenNode.Syntax);
1155ArrayBuilder<BoundStatement> sectionBuilder = BuilderForSection(whenClause.Syntax);
1163addConditionalGoto(whenClause.WhenExpression, whenClause.Syntax, trueLabel, sectionBuilder);
1200_factory.Syntax = node.Syntax;
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (23)
143var outputTemp = new BoundDagTemp(f.Syntax, field.Type, f);
145BoundExpression access = _localRewriter.MakeFieldAccess(f.Syntax, input, field, null, LookupResultKind.Viable, field.Type);
153var outputTemp = new BoundDagTemp(p.Syntax, property.Type, p);
189var outputTemp = new BoundDagTemp(d.Syntax, parameter.Type, d, i - extensionExtra);
208var outputTemp = new BoundDagTemp(t.Syntax, type, t);
214_localRewriter._diagnostics.Add(t.Syntax, useSiteInfo);
220_localRewriter.TryGetNullableMethod(t.Syntax, inputType, SpecialMember.System_Nullable_T_GetValueOrDefault, out MethodSymbol getValueOrDefault))
245var outputTemp = new BoundDagTemp(e.Syntax, type, e);
270var outputTemp = new BoundDagTemp(e.Syntax, e.IndexerType, e);
296var outputTemp = new BoundDagTemp(e.Syntax, e.SliceType, e);
328return new BoundRangeExpression(e.Syntax, makeUnloweredIndexArgument(e.StartIndex), end,
338_factory.Syntax = test.Syntax;
344return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullNotEqual : BinaryOperatorKind.NotEqual);
351return MakeNullCheck(d.Syntax, input, input.Type.IsNullableType() ? BinaryOperatorKind.NullableNullEqual : BinaryOperatorKind.Equal);
355return MakeValueTest(d.Syntax, input, d.Value);
360return MakeRelationalTest(d.Syntax, input, d.OperatorKind, d.Value);
474BoundExpression output = _tempAllocator.GetTemp(new BoundDagTemp(evaluation.Syntax, typeEvaluation1.Type, evaluation));
490BoundExpression output = _tempAllocator.GetTemp(new BoundDagTemp(evaluation.Syntax, baseType, evaluation));
493_localRewriter._diagnostics.Add(test.Syntax, useSiteInfo);
554loweredInput.Syntax.Kind() == SyntaxKind.TupleExpression &&
619var originalInput = BoundDagTemp.ForOriginalInput(loweredInput.Syntax, loweredInput.Type);
626var fieldFetchEvaluation = new BoundDagFieldEvaluation(expr.Syntax, field, originalInput);
627var temp = new BoundDagTemp(expr.Syntax, expr.Type, fieldFetchEvaluation);
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (7)
71var syntax = node.Syntax;
119return LowerPartsToString(data, parts, node.Syntax, node.Type);
152loweredLeft = MakeBinaryOperator(original, original.Syntax, original.OperatorKind, loweredLeft, loweredRight, original.Type, original.Method, original.ConstrainedToType,
202Debug.Assert(oldNode == null || (oldNode.Syntax == syntax));
739_diagnostics.Add(loweredLeft.Syntax, useSiteInfo);
2135SyntaxNode rightSyntax = loweredRight.Syntax;
2214_factory.Syntax = loweredRight.Syntax;
Lowering\LocalRewriter\LocalRewriter_Call.cs (7)
52loweredReceiver = new BoundTypeExpression(node.Syntax, null, firstContainer);
58loweredReceiver = new BoundTypeExpression(node.Syntax, null, _factory.CurrentType);
67EmbedIfNeedTo(loweredReceiver, methodGroup.Methods, node.Syntax);
427var rewrittenCall = MakeCall(node, node.Syntax, rewrittenReceiver, method, rewrittenArguments, argRefKindsOpt, node.ResultKind, temps.ToImmutableAndFree());
963new BoundComplexConditionalReceiver(receiverTemp.Syntax,
1135optimized = CreateArrayEmptyCallIfAvailable(possibleParamsArray.Syntax, ((ArrayTypeSymbol)possibleParamsArray.Type!).ElementType);
1643argument.Syntax,
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (14)
39_factory.Syntax = node.Syntax;
169if (!TryGetWellKnownTypeMember(node.Syntax, WellKnownMember.System_Linq_Enumerable__ToList, out MethodSymbol? toListGeneric, isOptional: true))
250var syntax = node.Syntax;
353var syntax = iteratorBody.Syntax;
370node.Syntax,
396var syntax = node.Syntax;
479node.Syntax,
641var syntax = node.Syntax;
746var expressionSyntax = rewrittenValue.Syntax;
969sideEffects.Add(new BoundAssignmentOperator(rewrittenSpreadOperand.Syntax, indexTemp, _factory.Binary(BinaryOperatorKind.Addition, indexTemp.Type, indexTemp, spreadLength), isRef: false, indexTemp.Type));
1083var expressionSyntax = rewrittenValue.Syntax;
1152node.Syntax,
1217new BoundBlock(iteratorBody.Syntax, locals: ImmutableArray<LocalSymbol>.Empty, statements);
1296var iterationVariable = _factory.SynthesizedLocal(enumeratorInfo.ElementType, node.Syntax);
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (9)
97rewrittenAssignment = new BoundSequence(node.Syntax, eventTemps.ToImmutableAndFree(), sequence.ToImmutableAndFree(), condition, condition.Type!);
108node.Syntax,
120SyntaxNode syntax = node.Syntax;
241return new BoundDynamicMemberAccess(memberAccess.Syntax, receiverTemp, memberAccess.TypeArgumentsOpt, memberAccess.Name, memberAccess.Invoked, memberAccess.Indexed, memberAccess.Type);
322SyntaxNode syntax = indexerAccess.Syntax;
538indexerAccess.Syntax,
644return MakeFieldAccess(fieldAccess.Syntax, receiverOpt, fieldAccess.FieldSymbol, fieldAccess.ConstantValueOpt, fieldAccess.ResultKind, fieldAccess.Type, fieldAccess);
735return MakeEventAccess(eventAccess.Syntax, receiverOpt, eventAccess.EventSymbol, eventAccess.ConstantValueOpt, eventAccess.ResultKind, eventAccess.Type);
768rewrittenReceiver.Syntax,
Lowering\LocalRewriter\LocalRewriter_ConditionalOperator.cs (1)
33node.Syntax,
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (23)
34InterpolationHandlerResult interpolationResult = RewriteToInterpolatedStringHandlerPattern(data, parts, node.Operand.Syntax);
53return ConvertToNullable(node.Syntax, node.Type, objectCreation);
63return ConvertToNullable(node.Syntax, node.Type, rewrittenCollection);
79var result = MakeConversionNode(node, node.Syntax, rewrittenOperand, node.Conversion, node.Checked, node.ExplicitCastInCode, node.ConstantValueOpt, rewrittenType);
100_factory.Syntax = node.Syntax;
106BadExpression(node.Syntax, byteArray, ImmutableArray<BoundExpression>.Empty) :
107MakeUnderlyingArrayForUtf8Span(node.Syntax, byteArray, bytes, out length);
109if (!TryGetWellKnownTypeMember<MethodSymbol>(node.Syntax, WellKnownMember.System_ReadOnlySpan_T__ctor_Array_Start_Length, out MethodSymbol? ctor))
111result = BadExpression(node.Syntax, node.Type, ImmutableArray<BoundExpression>.Empty);
115result = new BoundObjectCreationExpression(node.Syntax, ctor.AsMember((NamedTypeSymbol)node.Type), utf8Bytes, _factory.Literal(0), _factory.Literal(length));
135node.Syntax.Location,
307Debug.Assert(oldNodeOpt == null || oldNodeOpt.Syntax == syntax);
555return new BoundFunctionPointerLoad(oldNodeOpt.Syntax, symbolOpt,
569_factory.Syntax = (mg.ReceiverOpt ?? mg).Syntax;
577EnsureParamCollectionAttributeExists(rewrittenOperand.Syntax, rewrittenType);
802return MakeConversionNode(rewrittenOperand.Syntax, rewrittenOperand, conversion, rewrittenType, @checked);
816diagnostics.Add(rewrittenOperand.Syntax, useSiteInfo);
827rewrittenOperand.Syntax.Location,
1017syntax: expression.Syntax,
1318seq.Syntax,
1322conditional.Syntax,
1384MethodSymbol ctor = UnsafeGetNullableMethod(call.Syntax, resultType, SpecialMember.System_Nullable_T__ctor);
1385return new BoundObjectCreationExpression(call.Syntax, ctor, call);
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (8)
254effects.assignments.Add(MakeAssignmentOperator(resultPart.Syntax, leftTarget, resultPart,
266compilation: _compilation, shouldCheckConstraints: false, includeNullability: false, errorPositions: default, syntax: (CSharpSyntaxNode)right.Syntax, diagnostics: _diagnostics);
269right.Syntax, sourceTuple: null, wasTargetTyped: false, arguments: builder!.ToImmutableAndFree(), argumentNamesOpt: default, inferredNamesOpt: default, tupleType);
364var fieldAccess = MakeTupleFieldAccessAndReportUseSiteDiagnostics(tuple, expression.Syntax, fields[i]);
392var localBound = new BoundLocal(target.Syntax, localSymbol, constantValueOpt: null, type: outputPlaceholder.Type)
452assignmentTargets.Add(new Binder.DeconstructionVariable(variable, variable.Syntax));
458assignmentTargets.Add(new Binder.DeconstructionVariable(GetAssignmentTargetsAndSideEffects(tuple, temps, effects), tuple.Syntax));
465assignmentTargets.Add(new Binder.DeconstructionVariable(temp, variable.Syntax));
Lowering\LocalRewriter\LocalRewriter_Event.cs (7)
37_diagnostics.Add(errorInfo, node.Syntax.Location);
51return RewriteWindowsRuntimeEventAssignmentOperator(node.Syntax, node.Event, kind, rewrittenReceiverOpt, rewrittenArgument);
59return MakeCall(node.Syntax, rewrittenReceiverOpt, method, rewrittenArguments);
216return MakeEventAccess(node.Syntax, rewrittenReceiver, node.EventSymbol, node.ConstantValueOpt, node.ResultKind, node.Type);
299_factory.Syntax = node.Syntax;
325module.EmbeddedTypesManagerOpt.EmbedEventIfNeedTo(node.Event.GetCciAdapter(), node.Syntax, _diagnostics.DiagnosticBag, isUsedForComAwareEventBinding: true);
333return new BoundBadExpression(node.Syntax, LookupResultKind.NotCreatable, ImmutableArray.Create<Symbol?>(node.Event),
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (9)
83SyntaxNode? node = boundFixed.Syntax.Parent;
255VariableDeclaratorSyntax? declarator = fixedInitializer.Syntax.FirstAncestorOrSelf<VariableDeclaratorSyntax>();
311var initializerSyntax = initializerExpr.Syntax;
316VariableDeclaratorSyntax? declarator = fixedInitializer.Syntax.FirstAncestorOrSelf<VariableDeclaratorSyntax>();
447VariableDeclaratorSyntax? declarator = fixedInitializer.Syntax.FirstAncestorOrSelf<VariableDeclaratorSyntax>();
477if (TryGetWellKnownTypeMember(fixedInitializer.Syntax, WellKnownMember.System_Runtime_CompilerServices_RuntimeHelpers__get_OffsetToStringData, out offsetMethod))
483helperCall = new BoundBadExpression(fixedInitializer.Syntax, LookupResultKind.NotInvocable, ImmutableArray<Symbol?>.Empty, ImmutableArray<BoundExpression>.Empty, ErrorTypeSymbol.UnknownResultType);
538if (TryGetSpecialTypeMethod(fixedInitializer.Syntax, SpecialMember.System_Array__get_Length, out lengthMethod))
544lengthCall = new BoundBadExpression(fixedInitializer.Syntax, LookupResultKind.NotInvocable, ImmutableArray<Symbol?>.Empty, ImmutableArray.Create<BoundExpression>(factory.Local(pinnedTemp)), ErrorTypeSymbol.UnknownResultType);
Lowering\LocalRewriter\LocalRewriter_IfStatement.cs (6)
56builder.Add(new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, afterif));
78builder.Add(new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, alt));
81var syntax = (IfStatementSyntax)node.Syntax;
102var syntax = (IfStatementSyntax)node.Syntax;
116return new BoundStatementList(node.Syntax, builder.ToImmutableAndFree(), node.HasErrors);
137builder.Add(new BoundConditionalGoto(rewrittenCondition.Syntax, rewrittenCondition, false, afterif));
Lowering\LocalRewriter\LocalRewriter_Index.cs (10)
18BoundExpression fromEnd = MakeLiteral(node.Syntax, ConstantValue.Create(true), booleanType);
24operand = new BoundDefaultExpression(operand.Syntax, operand.Type!.GetNullableUnderlyingType());
31return new BoundObjectCreationExpression(node.Syntax, node.MethodOpt, operand, fromEnd);
39BoundExpression condition = MakeOptimizedHasValue(operand.Syntax, operand);
42BoundExpression boundOperandGetValueOrDefault = MakeOptimizedGetValueOrDefault(operand.Syntax, operand);
43BoundExpression indexCreation = new BoundObjectCreationExpression(node.Syntax, node.MethodOpt, boundOperandGetValueOrDefault, fromEnd);
46BoundExpression consequence = ConvertToNullable(node.Syntax, node.Type, indexCreation);
49BoundExpression alternative = new BoundDefaultExpression(node.Syntax, node.Type);
53syntax: node.Syntax,
62syntax: node.Syntax,
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (8)
58EmbedIfNeedTo(loweredReceiver, node.ApplicableIndexers, node.Syntax);
88node.Syntax,
328createSpan = _factory.ModuleBuilderOpt.EnsureInlineArrayAsReadOnlySpanExists(node.Syntax, spanType, intType, _diagnostics.DiagnosticBag);
332createSpan = _factory.ModuleBuilderOpt.EnsureInlineArrayAsSpanExists(node.Syntax, spanType, intType, _diagnostics.DiagnosticBag);
354elementRef = _factory.ModuleBuilderOpt.EnsureInlineArrayFirstElementRefExists(node.Syntax, _diagnostics.DiagnosticBag);
359elementRef = _factory.ModuleBuilderOpt.EnsureInlineArrayFirstElementRefReadOnlyExists(node.Syntax, _diagnostics.DiagnosticBag);
373elementRef = _factory.ModuleBuilderOpt.EnsureInlineArrayElementRefExists(node.Syntax, intType, _diagnostics.DiagnosticBag);
378elementRef = _factory.ModuleBuilderOpt.EnsureInlineArrayElementRefReadOnlyExists(node.Syntax, intType, _diagnostics.DiagnosticBag);
Lowering\LocalRewriter\LocalRewriter_LockStatement.cs (9)
24LockStatementSyntax lockSyntax = (LockStatementSyntax)node.Syntax;
38rewrittenArgument.Syntax,
45if (LockBinder.TryFindLockTypeInfo(argumentType, _diagnostics, rewrittenArgument.Syntax) is not { } lockTypeInfo)
56rewrittenArgument.Syntax,
67var expressionStatement = new BoundExpressionStatement(rewrittenArgument.Syntax, tempAssignment);
70rewrittenArgument.Syntax,
71rewrittenArgument.Syntax,
91rewrittenArgument.Syntax,
145MakeLiteral(rewrittenArgument.Syntax, ConstantValue.False, boolType),
Lowering\LocalRewriter\LocalRewriter_NullCoalescingAssignmentOperator.cs (8)
17SyntaxNode syntax = node.Syntax;
45var leftPlaceholder = new BoundValuePlaceholder(lhsRead.Syntax, lhsRead.Type);
71if (!TryGetNullableMethod(leftOperand.Syntax,
79if (!TryGetNullableMethod(leftOperand.Syntax,
103var tmp = _factory.StoreToTemp(BoundCall.Synthesized(leftOperand.Syntax, lhsRead, initialBindingReceiverIsSubjectToCloning: ThreeState.Unknown, getValueOrDefault),
110var tmpAssignment = MakeAssignmentOperator(node.Syntax, tmp, loweredRight, used: true, isChecked: false, isCompoundAssignment: false);
118node.Syntax,
126var lhsReadHasValue = BoundCall.Synthesized(leftOperand.Syntax, lhsRead, initialBindingReceiverIsSubjectToCloning: ThreeState.Unknown, hasValue);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (7)
19return MakeNullCoalescingOperator(node.Syntax, rewrittenLeft, rewrittenRight, node.LeftPlaceholder, node.LeftConversion, node.OperatorResultKind, rewrittenResultType);
140TryGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeft.Type, SpecialMember.System_Nullable_T_GetValueOrDefault, out MethodSymbol? getValueOrDefault, isOptional: true))
142return BoundCall.Synthesized(rewrittenLeft.Syntax, rewrittenLeft, initialBindingReceiverIsSubjectToCloning: ThreeState.Unknown, getValueOrDefault);
147TryGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeft.Type, SpecialMember.System_Nullable_T_GetValueOrDefaultDefaultValue, out MethodSymbol? getValueOrDefaultDefaultValue, isOptional: true))
149return BoundCall.Synthesized(rewrittenLeft.Syntax, rewrittenLeft, initialBindingReceiverIsSubjectToCloning: ThreeState.Unknown, getValueOrDefaultDefaultValue, rewrittenRight);
257MethodSymbol getValueOrDefault = UnsafeGetNullableMethod(rewrittenLeft.Syntax, rewrittenLeftType, SpecialMember.System_Nullable_T_GetValueOrDefault);
258rewrittenLeft = BoundCall.Synthesized(rewrittenLeft.Syntax, rewrittenLeft, initialBindingReceiverIsSubjectToCloning: ThreeState.Unknown, getValueOrDefault);
Lowering\LocalRewriter\LocalRewriter_ObjectCreationExpression.cs (14)
21var constructorInvocation = _dynamicFactory.MakeDynamicConstructorInvocation(node.Syntax, node.Type, loweredArguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt).ToExpression();
28return MakeExpressionWithInitializer(node.Syntax, constructorInvocation, node.InitializerExpressionOpt, node.Type);
99rewrittenObjectCreation = new BoundDefaultExpression(rewrittenObjectCreation.Syntax, rewrittenObjectCreation.Type!);
105node.Syntax,
128return MakeExpressionWithInitializer(node.Syntax, rewrittenObjectCreation, node.InitializerExpressionOpt, node.Type);
173return new BoundSequence(withExpr.Syntax, temps.ToImmutableAndFree(), sideEffects.ToImmutableAndFree(), value, type);
194withExpr.Syntax,
314var rewrittenNewT = MakeNewT(node.Syntax, (TypeParameterSymbol)node.Type);
320return MakeExpressionWithInitializer(node.Syntax, rewrittenNewT, node.InitializerExpressionOpt, rewrittenNewT.Type!);
377_factory.Syntax = node.Syntax;
389newGuid = new BoundBadExpression(node.Syntax, LookupResultKind.NotCreatable, ImmutableArray<Symbol?>.Empty, ImmutableArray<BoundExpression>.Empty, ErrorTypeSymbol.UnknownResultType);
407callGetTypeFromCLSID = new BoundBadExpression(node.Syntax, LookupResultKind.OverloadResolutionFailure, ImmutableArray<Symbol?>.Empty, ImmutableArray<BoundExpression>.Empty, ErrorTypeSymbol.UnknownResultType);
419rewrittenObjectCreation = new BoundBadExpression(node.Syntax, LookupResultKind.OverloadResolutionFailure, ImmutableArray<Symbol?>.Empty, ImmutableArray<BoundExpression>.Empty, node.Type);
429return MakeExpressionWithInitializer(node.Syntax, rewrittenObjectCreation, node.InitializerExpressionOpt, node.Type);
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (10)
124EmbedIfNeedTo(rewrittenReceiver, initializer.ApplicableMethods, initializer.Syntax);
151var syntax = initializer.Syntax;
368result.Add(MakeStaticAssignmentOperator(assignment.Syntax, rewrittenAccess, rewrittenRight, isRef: assignment.IsRef, used: false));
440result.Add(MakeStaticAssignmentOperator(assignment.Syntax, rewrittenAccess, rewrittenRight, false, used: false));
473result.Add(MakeStaticAssignmentOperator(assignment.Syntax, rewrittenAccess, rewrittenRight, false, used: false));
507result.Add(MakeStaticAssignmentOperator(assignment.Syntax, rewrittenAccess, rewrittenRight, isRef: false, used: false));
676return MakeFieldAccess(rewrittenLeft.Syntax, rewrittenReceiver, fieldSymbol, null, rewrittenLeft.ResultKind, fieldSymbol.Type);
684rewrittenLeft.Syntax,
699rewrittenLeft.Syntax,
709return MakeEventAccess(rewrittenLeft.Syntax, rewrittenReceiver, eventSymbol, null, rewrittenLeft.ResultKind, eventSymbol.Type);
Lowering\LocalRewriter\LocalRewriter_Range.cs (11)
46return ConvertToNullable(node.Syntax, node.Type, rangeCreation);
60operand = new BoundDefaultExpression(operand.Syntax, operand.Type.GetNullableUnderlyingType());
95if (!TryGetNullableMethod(node.Syntax, node.Type, SpecialMember.System_Nullable_T__ctor, out MethodSymbol nullableCtor))
97return BadExpression(node.Syntax, node.Type, node);
101BoundExpression consequence = new BoundObjectCreationExpression(node.Syntax, nullableCtor, rangeExpr);
104BoundExpression alternative = new BoundDefaultExpression(node.Syntax, node.Type);
110syntax: node.Syntax,
119syntax: node.Syntax,
135BoundExpression operandHasValue = MakeOptimizedHasValue(tempOperand.Syntax, tempOperand);
144condition = MakeBinaryOperator(node.Syntax, BinaryOperatorKind.BoolAnd, condition, operandHasValue, boolType, method: null, constrainedToTypeOpt: null);
147return MakeOptimizedGetValueOrDefault(tempOperand.Syntax, tempOperand);
Lowering\LocalRewriter\LocalRewriter_StackAlloc.cs (6)
48return new BoundConvertedStackAllocExpression(stackAllocNode.Syntax, elementType, stackSize, initializerOpt, type);
58stackAllocNode.Syntax, elementType, stackSize, initializerOpt, _compilation.CreatePointerTypeSymbol(elementType));
61if (TryGetWellKnownTypeMember(stackAllocNode.Syntax, WellKnownMember.System_Span_T__ctor_Pointer, out MethodSymbol? spanConstructor))
68syntax: stackAllocNode.Syntax,
81var tempAccess = _factory.StoreToTemp(constructorCall, out BoundAssignmentOperator tempAssignment, syntaxOpt: stackAllocNode.Syntax);
85syntax: stackAllocNode.Syntax,
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (3)
149return LowerPartsToString(data, node.Parts, node.Syntax, node.Type);
196var placeholder = new BoundValuePlaceholder(result.Syntax, result.Type);
197result = new BoundNullCoalescingOperator(result.Syntax, result, _factory.StringLiteral(""), leftPlaceholder: placeholder, leftConversion: placeholder, BoundNullCoalescingOperatorResultKind.LeftType, @checked: false, result.Type) { WasCompilerGenerated = true };
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (11)
30: base(node.Syntax, localRewriter, node.SwitchArms.SelectAsArray(arm => arm.Syntax),
48_factory.Syntax = node.Syntax;
73var syntax = (SwitchExpressionSyntax)node.Syntax;
79result.Add(new BoundStepThroughSequencePoint(node.Syntax, span: spanForSwitchBody));
89LocalSymbol resultTemp = _factory.SynthesizedLocal(node.Type, node.Syntax, kind: SynthesizedLocalKind.LoweringTemp);
93_factory.Syntax = arm.Syntax;
95sectionBuilder.AddRange(switchSections[arm.Syntax]);
116result.Add(new BoundScope(arm.Syntax, arm.Locals, statements));
120_factory.Syntax = node.Syntax;
125result.Add(new BoundRestorePreviousSequencePoint(node.Syntax, restorePointForSwitchBody));
142result.Add(new BoundRestorePreviousSequencePoint(node.Syntax, restorePointForEnclosingStatement));
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (23)
71syntax: expr.Syntax,
84tuple.Syntax, sourceTuple: null, wasTargetTyped: true, newArguments, ImmutableArray<string?>.Empty,
106var syntax = boundConversion.Syntax;
162tuple.Syntax, sourceTuple: null, wasTargetTyped: false, newArguments, ImmutableArray<string?>.Empty,
206return new BoundLiteral(expr.Syntax, ConstantValue.Null, expr.Type);
214syntax: expr.Syntax, operand: deferredOperand,
259return new BoundLiteral(left.Syntax, ConstantValue.Create(nullnull.Kind == BinaryOperatorKind.Equal), boolType);
342_factory.Conditional(leftHasValue, innerSequence, MakeBooleanConstant(right.Syntax, boolValue), boolType),
343MakeBooleanConstant(right.Syntax, !boolValue),
359hasValue = MakeBooleanConstant(expr.Syntax, true);
369hasValue = MakeBooleanConstant(expr.Syntax, false);
371value = new BoundDefaultExpression(expr.Syntax, expr.Type.StrippedType());
378hasValue = MakeBooleanConstant(expr.Syntax, true);
411return _factory.MakeNullableHasValue(expr.Syntax, expr);
455syntax: operand.Syntax,
467BoundExpression valueOrDefaultCall = MakeOptimizedGetValueOrDefault(expr.Syntax, expr);
475expr.Syntax, expr, conversion, enclosing.Checked, enclosing.ExplicitCastInCode,
530return MakeTupleFieldAccessAndReportUseSiteDiagnostics(tuple, tuple.Syntax, tuple.Type.TupleElements[i]);
558return _factory.Not(MakeUnaryOperator(UnaryOperatorKind.DynamicFalse, left.Syntax, method: null, constrainedToTypeOpt: null, dynamicResult, boolType));
562return MakeUnaryOperator(UnaryOperatorKind.DynamicTrue, left.Syntax, method: null, constrainedToTypeOpt: null, dynamicResult, boolType);
569return new BoundLiteral(left.Syntax, ConstantValue.Create(operatorKind == BinaryOperatorKind.Equal), boolType);
584result = MakeUnaryOperator(boolOperator.Kind, binary.Syntax, boolOperator.Method, boolOperator.ConstrainedToTypeOpt, convertedBinary, boolType);
610oldNodeOpt: conv, syntax: conv.Syntax, rewrittenOperand: LowerConversions(conv.Operand),
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (13)
59return MakeUnaryOperator(node, node.OperatorKind, node.Syntax, node.MethodOpt, node.ConstrainedToTypeOpt, loweredOperand, node.Type);
434SyntaxNode syntax = node.Syntax;
638SyntaxNode syntax = node.Syntax;
675BoundExpression condition = _factory.MakeNullableHasValue(node.Syntax, boundTemp);
748syntax: node.Syntax,
755MethodSymbol ctor = UnsafeGetNullableMethod(node.Syntax, binaryOperandType, SpecialMember.System_Nullable_T__ctor);
756boundOne = new BoundObjectCreationExpression(node.Syntax, ctor, boundOne);
774return MakeBinaryOperator(node.Syntax, binaryOperatorKind, binaryOperand, boundOne, binaryOperand.Type, method: null, constrainedToTypeOpt: null);
789binOp = MakeDecimalIncDecOperator(node.Syntax, binaryOperatorKind, binaryOperand);
793binOp = MakeLiftedDecimalIncDecOperator(node.Syntax, binaryOperatorKind, binaryOperand);
797binOp = MakeBinaryOperator(node.Syntax, binaryOperatorKind, binaryOperand, boundOne, binaryOperandType, method: null, constrainedToTypeOpt: null);
866return MakePropertyGetAccess(transformedExpression.Syntax, propertyAccess.ReceiverOpt, propertyAccess.PropertySymbol, propertyAccess);
874return MakePropertyGetAccess(transformedExpression.Syntax, indexerAccess.ReceiverOpt, indexerAccess.Indexer, indexerAccess.Arguments, indexerAccess.ArgumentRefKindsOpt);
Lowering\MethodToClassRewriter.cs (7)
246rewrittenMethodSymbol = GetMethodWrapperForBaseNonVirtualCall(rewrittenMethodSymbol, node.Syntax);
390if (TryReplaceWithProxy(node.ParameterSymbol, node.Syntax, out BoundNode? replacement))
406if (TryReplaceWithProxy(node.LocalSymbol, node.Syntax, out BoundNode? replacement))
449return new BoundLocal(node.Syntax, replacementLocal, node.ConstantValueOpt, replacementLocal.Type, node.HasErrors);
527SyntheticBoundNodeFactory factory = new SyntheticBoundNodeFactory(this.CurrentMethod, rewrittenLeft.Syntax, this.CompilationState, this.Diagnostics);
535node.Syntax,
594method = GetMethodWrapperForBaseNonVirtualCall(method, originalArgument.Syntax);
Lowering\SpillSequenceSpiller.cs (27)
84var result = new BoundSpillSequenceBuilder(this.Syntax, value);
162AddStatement(new BoundExpressionStatement(expression.Syntax, expression) { WasCompilerGenerated = true });
236var spiller = new SpillSequenceSpiller(method, body.Syntax, compilationState, tempSubstitution, receiverSubstitution, diagnostics);
296var result = new BoundBlock(statement.Syntax, builder.GetLocals(), builder.GetStatements()) { WasCompilerGenerated = true };
309if (builder.Syntax != null)
310_F.Syntax = builder.Syntax;
626builder = new BoundSpillSequenceBuilder(lastSpill < newList.Length ? (newList[lastSpill] as BoundSpillSequenceBuilder)?.Syntax : null);
720exceptionFilterPrologueOpt = new BoundStatementList(node.Syntax, builder.GetStatements());
751var builder = new BoundSpillSequenceBuilder(node.Syntax);
754_F.Syntax = node.Syntax;
789builder = new BoundSpillSequenceBuilder(indicesBuilder.Syntax);
817var boundsBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
870var leftBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
991var leftBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
1029var receiverBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
1054_F.Syntax = node.Syntax;
1058receiverBuilder.AddStatement(_F.ExpressionStatement(new BoundComplexConditionalReceiver(node.Syntax, cache, _F.Sequence(new[] { _F.AssignmentExpression(cache, receiver) }, cache), receiverType) { WasCompilerGenerated = true }));
1094var invokedExpressionBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
1120if (conditionBuilder == null) conditionBuilder = new BoundSpillSequenceBuilder((consequenceBuilder ?? alternativeBuilder).Syntax);
1121if (consequenceBuilder == null) consequenceBuilder = new BoundSpillSequenceBuilder(alternativeBuilder.Syntax);
1122if (alternativeBuilder == null) alternativeBuilder = new BoundSpillSequenceBuilder(consequenceBuilder.Syntax);
1246var leftBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
1281if (receiverBuilder == null) receiverBuilder = new BoundSpillSequenceBuilder((whenNotNullBuilder ?? whenNullBuilder).Syntax);
1282if (whenNotNullBuilder == null) whenNotNullBuilder = new BoundSpillSequenceBuilder(whenNullBuilder.Syntax);
1283if (whenNullBuilder == null) whenNullBuilder = new BoundSpillSequenceBuilder(whenNotNullBuilder.Syntax);
1431var expressionBuilder = new BoundSpillSequenceBuilder(builder.Syntax);
1464builder = new BoundSpillSequenceBuilder(valueBuilder.Syntax);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (10)
68walker.CaptureVariable(method.ThisParameter, node.Syntax);
220CaptureRefInitializer(variableInitializer, local.SynthesizedKind != SynthesizedLocalKind.UserDefined ? variableInitializer.Syntax : syntax);
289CaptureVariable(node.ParameterSymbol, node.Syntax);
298CaptureVariable(thisSymbol, node.Syntax);
306CaptureVariable(topLevelMethod.ThisParameter, node.Syntax);
312CaptureVariable(topLevelMethod.ThisParameter, node.Syntax);
400Capture(_topLevelMethod.ThisParameter, node.Syntax);
406Capture(_topLevelMethod.ThisParameter, node.Syntax);
412Capture(node.LocalSymbol, node.Syntax);
418Capture(node.ParameterSymbol, node.Syntax);
Lowering\SyntheticBoundNodeFactory.cs (5)
506innerInstrumentation.Syntax,
1214return new BoundThrowExpression(thrown.Syntax, thrown, type) { WasCompilerGenerated = true };
1623return new BoundUnaryOperator(expression.Syntax, UnaryOperatorKind.BoolLogicalNegation, expression, null, null, constrainedToTypeOpt: null, LookupResultKind.Viable, expression.Type);
1675var syntax = argument.Syntax;
1723return new BoundLocal(node.Syntax, temp, constantValueOpt: null, type: node.Type) { WasCompilerGenerated = true };
Operations\CSharpOperationFactory.cs (163)
325return new NoneOperation(children, _semanticModel, boundNode.Syntax, type: type, constantValue, isImplicit: isImplicit);
357boundNode.Syntax,
369boundNode.Syntax,
411builder.Add((IVariableDeclaratorOperation)CreateVariableDeclaratorInternal(decl, decl.Syntax));
422SyntaxNode syntax = boundDeconstructValuePlaceholder.Syntax;
434SyntaxNode syntax = boundDeconstructionAssignmentOperator.Syntax;
443SyntaxNode syntax = boundCall.Syntax;
475SyntaxNode syntax = boundFunctionPointerInvocation.Syntax;
494boundUnconvertedAddressOf.Syntax,
504var invalidOperation = OperationFactory.CreateInvalidOperation(_semanticModel, boundAttribute.Syntax, GetIOperationChildren(boundAttribute), isImplicit: true);
505return new AttributeOperation(invalidOperation, _semanticModel, boundAttribute.Syntax, isAttributeImplicit);
512initializer = new ObjectOrCollectionInitializerOperation(namedArguments, _semanticModel, boundAttribute.Syntax, boundAttribute.GetPublicTypeSymbol(), isImplicit: true);
516var objectCreationOperation = new ObjectCreationOperation(boundAttribute.Constructor.GetPublicSymbol(), initializer, DeriveArguments(boundAttribute), _semanticModel, boundAttribute.Syntax, boundAttribute.GetPublicTypeSymbol(), boundAttribute.ConstantValueOpt, isImplicit: true);
517return new AttributeOperation(objectCreationOperation, _semanticModel, boundAttribute.Syntax, isAttributeImplicit);
556SyntaxNode syntax = boundLocal.Syntax;
576SyntaxNode syntax = boundFieldAccess.Syntax;
604CreateImplicitReceiver(boundObjectInitializerMember.Syntax, boundObjectInitializerMember.ReceiverType);
617SyntaxNode syntax = boundPropertyAccess.Syntax;
627SyntaxNode syntax = boundIndexerAccess.Syntax;
647SyntaxNode syntax = boundEventAccess.Syntax;
658SyntaxNode syntax = boundEventAssignmentOperator.Syntax;
668SyntaxNode syntax = boundParameter.Syntax;
676SyntaxNode syntax = boundLiteral.Syntax;
685SyntaxNode syntax = boundNode.Syntax;
693SyntaxNode syntax = boundAnonymousObjectCreationExpression.Syntax;
704SyntaxNode syntax = boundObjectCreationExpression.Syntax;
741SyntaxNode syntax = boundWithExpression.Syntax;
753SyntaxNode syntax = boundDynamicObjectCreationExpression.Syntax;
765implicitReceiver.Syntax, type: null, isImplicit: true);
769methodGroup.Syntax, methodGroup.GetPublicTypeSymbol(), methodGroup.WasCompilerGenerated);
782SyntaxNode syntax = boundDynamicInvocation.Syntax;
796return CreateImplicitReceiver(boundObjectInitializerMember.Syntax, boundObjectInitializerMember.ReceiverType);
825SyntaxNode syntax = boundDynamicIndexerAccess.Syntax;
834SyntaxNode syntax = boundObjectInitializerExpression.Syntax;
843SyntaxNode syntax = boundCollectionInitializerExpression.Syntax;
852SyntaxNode syntax = boundObjectInitializerMember.Syntax;
907CreateImplicitReceiver(boundObjectInitializerMember.Syntax, boundObjectInitializerMember.ReceiverType);
912IOperation instanceReceiver = CreateImplicitReceiver(boundDynamicObjectInitializerMember.Syntax, boundDynamicObjectInitializerMember.ReceiverType);
916SyntaxNode syntax = boundDynamicObjectInitializerMember.Syntax;
928SyntaxNode syntax = boundCollectionElementInitializer.Syntax;
946boundDynamicMemberAccess.Syntax, boundDynamicMemberAccess.GetPublicTypeSymbol(), boundDynamicMemberAccess.WasCompilerGenerated);
978SyntaxNode syntax = boundCollectionElementInitializer.Syntax;
998SyntaxNode syntax = boundLambda.Syntax;
1010SyntaxNode syntax = boundLocalFunctionStatement.Syntax;
1030SyntaxNode syntax = boundConversion.Syntax;
1058SyntaxNode syntax = boundConversion.Syntax;
1080if (boundOperand.Syntax == boundConversion.Syntax)
1101if (nestedConversion.Syntax == nestedOperand.Syntax && nestedConversion.ExplicitCastInCode &&
1142SyntaxNode syntax = boundAsOperator.Syntax;
1154SyntaxNode syntax = boundDelegateCreationExpression.Syntax;
1165SyntaxNode bindingSyntax = boundMethodGroup.Syntax;
1176SyntaxNode syntax = boundIsOperator.Syntax;
1187SyntaxNode syntax = boundSizeOfOperator.Syntax;
1198SyntaxNode syntax = boundTypeOfOperator.Syntax;
1208SyntaxNode syntax = boundArrayCreation.Syntax;
1211(boundArrayCreation.InitializerOpt?.Syntax == syntax && !boundArrayCreation.InitializerOpt.WasCompilerGenerated);
1218SyntaxNode syntax = boundArrayInitialization.Syntax;
1225SyntaxNode syntax = expr.Syntax;
1271SyntaxNode syntax = element.Syntax;
1286SyntaxNode syntax = boundDefaultLiteral.Syntax;
1294SyntaxNode syntax = boundDefaultExpression.Syntax;
1304SyntaxNode syntax = boundBaseReference.Syntax;
1313SyntaxNode syntax = boundThisReference.Syntax;
1337SyntaxNode syntax = boundAssignmentOperator.Syntax;
1349SyntaxNode syntax = boundAssignmentOperator.Syntax;
1366SyntaxNode syntax = boundCompoundAssignmentOperator.Syntax;
1393SyntaxNode syntax = boundIncrementOperator.Syntax;
1403SyntaxNode syntax = boundBadExpression.Syntax;
1416SyntaxNode syntax = boundNewT.Syntax;
1425SyntaxNode syntax = creation.Syntax;
1436SyntaxNode syntax = boundUnaryOperator.Syntax;
1490SyntaxNode syntax = boundBinaryOperator.Syntax;
1522SyntaxNode syntax = boundBinaryOperator.Syntax;
1566SyntaxNode syntax = boundTupleBinaryOperator.Syntax;
1578SyntaxNode syntax = boundConditionalOperator.Syntax;
1589SyntaxNode syntax = boundNullCoalescingOperator.Syntax;
1608SyntaxNode syntax = boundNode.Syntax;
1618SyntaxNode syntax = boundAwaitExpression.Syntax;
1628SyntaxNode syntax = boundArrayAccess.Syntax;
1639SyntaxNode syntax = boundIndexerAccess.Syntax;
1661SyntaxNode syntax = boundInlineArrayAccess.Syntax;
1671SyntaxNode syntax = boundNameOfOperator.Syntax;
1681SyntaxNode syntax = boundThrowExpression.Syntax;
1690SyntaxNode syntax = boundAddressOfOperator.Syntax;
1699SyntaxNode syntax = boundImplicitReceiver.Syntax;
1709SyntaxNode syntax = boundConditionalAccess.Syntax;
1718SyntaxNode syntax = boundConditionalReceiver.Syntax;
1728SyntaxNode syntax = boundFieldEqualsValue.Syntax;
1737SyntaxNode syntax = boundPropertyEqualsValue.Syntax;
1746SyntaxNode syntax = boundParameterEqualsValue.Syntax;
1755SyntaxNode syntax = boundBlock.Syntax;
1764SyntaxNode syntax = boundContinueStatement.Syntax;
1773SyntaxNode syntax = boundBreakStatement.Syntax;
1781SyntaxNode syntax = boundYieldBreakStatement.Syntax;
1790SyntaxNode syntax = boundGotoStatement.Syntax;
1797SyntaxNode syntax = boundNoOpStatement.Syntax;
1831SyntaxNode syntax = boundIfStatement.Syntax;
1853SyntaxNode syntax = boundWhileStatement.Syntax;
1867SyntaxNode syntax = boundDoStatement.Syntax;
1882SyntaxNode syntax = boundForStatement.Syntax;
1968var declaratorSyntax = boundForEachStatement.IterationVariableType.Syntax;
1989SyntaxNode syntax = boundForEachStatement.Syntax;
2000SyntaxNode syntax = boundTryStatement.Syntax;
2014SyntaxNode syntax = boundCatchBlock.Syntax;
2024SyntaxNode syntax = boundFixedStatement.Syntax;
2042SyntaxNode syntax = boundUsingStatement.Syntax;
2050SyntaxNode syntax = boundThrowStatement.Syntax;
2059SyntaxNode syntax = boundReturnStatement.Syntax;
2067SyntaxNode syntax = boundYieldReturnStatement.Syntax;
2077legacyMode ? null : new SynthesizedLocal((_semanticModel.GetEnclosingSymbol(boundLockStatement.Syntax.SpanStart) as IMethodSymbol).GetSymbol(),
2080syntaxOpt: boundLockStatement.Argument.Syntax).GetPublicSymbol();
2083SyntaxNode syntax = boundLockStatement.Syntax;
2091SyntaxNode syntax = boundBadStatement.Syntax;
2101var node = boundLocalDeclaration.Syntax;
2155SyntaxNode declarationGroupSyntax = boundMultipleLocalDeclarations.Syntax;
2192SyntaxNode syntax = boundLabelStatement.Syntax;
2201SyntaxNode syntax = boundLabeledStatement.Syntax;
2211bool isImplicit = boundExpressionStatement.WasCompilerGenerated || boundExpressionStatement.Syntax == boundExpressionStatement.Expression.Syntax;
2212SyntaxNode syntax = boundExpressionStatement.Syntax;
2219Debug.Assert(boundExpressionStatement.Syntax == sequence.Value.Syntax);
2228SyntaxNode syntax = boundTupleExpression.Syntax;
2264SyntaxNode syntax = boundInterpolatedString.Syntax;
2361builder.Add(new InterpolatedStringTextOperation(valueOperation, _semanticModel, part.Syntax, isImplicit));
2369Debug.Assert(valueOperation.Syntax != part.Syntax);
2371builder.Add(new InterpolationOperation(valueOperation, alignmentOperation, formatOperation, _semanticModel, part.Syntax, isImplicit));
2404SyntaxNode syntax = boundStringInsert.Syntax;
2412SyntaxNode syntax = boundNode.Syntax;
2431conversion.Syntax,
2442return new InterpolatedStringAdditionOperation(left, right, _semanticModel, current.Syntax, current.WasCompilerGenerated);
2470interpolatedString.Syntax,
2483SyntaxNode syntax = placeholder.Syntax;
2510placeholder.Syntax,
2518SyntaxNode syntax = boundConstantPattern.Syntax;
2529SyntaxNode syntax = boundRelationalPattern.Syntax;
2548SyntaxNode syntax = boundDeclarationPattern.Syntax;
2571boundRecursivePattern.Syntax,
2590boundITuplePattern.Syntax,
2601syntax: boundTypePattern.Syntax,
2614boundNode.Syntax,
2628boundNode.Syntax,
2639boundNegatedPattern.Syntax,
2679boundBinaryPattern.Syntax,
2690SyntaxNode syntax = boundSwitchStatement.Syntax;
2701return new SwitchCaseOperation(clauses, body, locals, condition: null, _semanticModel, boundSwitchSection.Syntax, isImplicit: boundSwitchSection.WasCompilerGenerated);
2725boundSwitchExpression.Syntax,
2741boundSwitchExpressionArm.Syntax,
2747SyntaxNode syntax = boundSwitchLabel.Syntax;
2751if (boundSwitchLabel.Syntax.Kind() == SyntaxKind.DefaultSwitchLabel)
2775SyntaxNode syntax = boundIsPatternExpression.Syntax;
2783if (boundQueryClause.Syntax.Kind() != SyntaxKind.QueryExpression)
2790SyntaxNode syntax = boundQueryClause.Syntax;
2807boundNode.Syntax,
2822boundIndex.Syntax,
2837boundRange.Syntax,
2848boundNode.Syntax,
2856SyntaxNode subpatternSyntax = subpattern.Syntax;
2869var nameSyntax = member.Syntax;
2876nameSyntax = member.Syntax;
2934SyntaxNode syntax = placeholder.Syntax;