3 writes to Compilation
Microsoft.CodeAnalysis.CSharp (3)
Binder\Binder.cs (3)
34this.Compilation = compilation; 42this.Compilation = next.Compilation; 55this.Compilation = next.Compilation;
343 references to Compilation
Microsoft.CodeAnalysis.CSharp (343)
Binder\Binder.cs (8)
42this.Compilation = next.Compilation; 55this.Compilation = next.Compilation; 137return result == OverflowChecks.Enabled || result == OverflowChecks.Implicit && Compilation.Options.CheckOverflow; 159internal bool UseUpdatedEscapeRules => Compilation.SourceModule.UseUpdatedEscapeRules; 264!csTree.IsGeneratedCode(this.Compilation.Options.SyntaxTreeOptionsProvider, CancellationToken.None), 283switch (Compilation.Options.NullableContextOptions) 294throw ExceptionUtilities.UnexpectedValue(Compilation.Options.NullableContextOptions); 833return new CompoundUseSiteInfo<AssemblySymbol>(futureDestination, Compilation.Assembly);
Binder\Binder.IdentifierUsedAsValueFinder.cs (1)
183enclosingBinder.Compilation,
Binder\Binder.ValueChecks.cs (5)
882var getItemOrSliceHelper = (MethodSymbol)Compilation.GetWellKnownTypeMember(elementAccess.GetItemOrSliceHelper); 961Compilation.GetWellKnownType(WellKnownType.System_Range), 1008else if (this.IsDirectlyInIterator && Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync)) 1400(Compilation.FeatureStrictEnabled 1727if (setMethod.DeclaringCompilation != this.Compilation)
Binder\Binder.WithQueryLambdaParametersBinder.cs (1)
90new ExtendedErrorTypeSymbol(this.Compilation, "", 0, info));
Binder\Binder_AnonymousTypes.cs (1)
105AnonymousTypeManager manager = this.Compilation.AnonymousTypeManager;
Binder\Binder_Attributes.cs (9)
296return new SourceAttributeData(Compilation, (AttributeSyntax)boundAttribute.Syntax, attributeType, attributeConstructor, hasErrors); 334Compilation, 403if (!paramType.Type.IsValidAttributeParameterType(Compilation)) 539if (setMethod.IsInitOnly && setMethod.DeclaringCompilation != this.Compilation) 669if (!namedArgumentType.IsValidAttributeParameterType(Compilation)) 840var typedConstantKind = node.Type.GetAttributeParameterTypedConstantKind(_binder.Compilation); 877var typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation); 927var typedConstantKind = operandType.GetAttributeParameterTypedConstantKind(_binder.Compilation); 982var typedConstantKind = type.GetAttributeParameterTypedConstantKind(_binder.Compilation);
Binder\Binder_Await.cs (1)
40TypeSymbol awaitExpressionType = info.GetResult?.ReturnType ?? (hasErrors ? CreateErrorType() : Compilation.DynamicType);
Binder\Binder_Constraints.cs (1)
321if (!Compilation.Assembly.RuntimeSupportsByRefLikeGenerics)
Binder\Binder_Conversions.cs (11)
423if (Compilation.SourceModule != method.ContainingModule) 427if (!Compilation.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces) 435Compilation.SourceModule != method.ContainingModule) 443if (!Compilation.Assembly.RuntimeSupportsInlineArrayTypes) 457if (destination.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions)) 472Debug.Assert(destination.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Span_T), TypeCompareKind.AllIgnoreOptions)); 590if (LocalRewriter.IsAllocatingRefStructCollectionExpression(node, collectionTypeKind, elementType, Compilation)) 631if (targetType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Collections_Immutable_ImmutableArray_T), TypeCompareKind.ConsiderEverything)) 808Debug.Assert(parameterType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions)); 813new ConstraintsHelper.CheckConstraintsArgs(Compilation, Conversions, syntax.Location, diagnostics)); 996var elementPlaceholder = new BoundValuePlaceholder(syntax, Compilation.DynamicType) { WasCompilerGenerated = true };
Binder\Binder_Crefs.cs (2)
966Debug.Assert(!this.Compilation.ContainsSyntaxTree(typeSyntax.SyntaxTree) || 967this.Compilation.GetBinderFactory(typeSyntax.SyntaxTree).GetBinder(typeSyntax).Flags ==
Binder\Binder_Deconstruct.cs (6)
46.CheckFeatureAvailability(diagnostics, Compilation, node.Location); 55.CheckFeatureAvailability(diagnostics, Compilation, node.Location); 329GenerateImplicitConversionError(diagnostics, Compilation, single.Syntax, nestedConversion, tupleOrDeconstructedTypes[i], single.Type); 537compilation: Compilation, 580bool disallowInferredNames = this.Compilation.LanguageVersion.DisallowInferredTupleElementNames(); 585tupleNames, this.Compilation,
Binder\Binder_Expressions.cs (59)
227return new ExtendedErrorTypeSymbol(this.Compilation, name, arity: 0, errorInfo: null, unreported: false); 319SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, trueSymbol, falseSymbol); 972bool disallowInferredNames = this.Compilation.LanguageVersion.DisallowInferredTupleElementNames(); 981Compilation, 1060bool disallowInferredNames = this.Compilation.LanguageVersion.DisallowInferredTupleElementNames(); 1063this.Compilation, syntax: node, diagnostics: diagnostics, shouldCheckConstraints: true, 1068NamedTypeSymbol.VerifyTupleTypePresent(elements.Length, node, this.Compilation, diagnostics); 1218TypeSymbol typedReferenceType = this.Compilation.GetSpecialType(SpecialType.System_TypedReference); 1266TypeSymbol typedReferenceType = this.Compilation.GetSpecialType(SpecialType.System_TypedReference); 1427bool typeHasErrors = type.IsErrorType() || CheckManagedAddr(Compilation, type, node.Location, diagnostics); 1928this.Compilation, name: "var", arity: 0, errorInfo: null, variableUsedBeforeDeclaration: true); 1991this.Compilation, name: "var", arity: 0, errorInfo: null, variableUsedBeforeDeclaration: true); 2007this.Compilation, name: "var", arity: 0, errorInfo: null, variableUsedBeforeDeclaration: true); 2292TypeSymbol hostObjectType = Compilation.GetHostObjectTypeSymbol(); 2726SymbolDistinguisher distinguisher1 = new SymbolDistinguisher(this.Compilation, operand.Type, targetType); 2801SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, operand.Type, targetType); 2975if (Compilation.FeatureStrictEnabled || !isDelegateCreation) 3293if (!hadLangVersionError && !Compilation.LanguageVersion.AllowNonTrailingNamedArguments()) 3369if (!Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) 4046var arrayType = ArrayTypeSymbol.CreateCSharpArray(Compilation.Assembly, TypeWithAnnotations.Create(bestType), rank); 4068CheckManagedAddr(Compilation, bestType, node.Location, diagnostics, errorForManaged: true); 4280this.Compilation.CreateArrayTypeSymbol(GetSpecialType(SpecialType.System_Object, diagnostics, node)), 4426hasErrors = hasErrors || CheckManagedAddr(Compilation, elementType.Type, elementTypeSyntax.Location, diagnostics, errorForManaged: true); 4488if (requiredVersion > Compilation.LanguageVersion) 6163initializerType.ContainingModule != Compilation.SourceModule) 6509Debug.Assert((object)this.Compilation.Assembly != null); 6510return IsSymbolAccessibleConditional(constructor, this.Compilation.Assembly, ref useSiteInfo); 6857SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, coClassType, interfaceType); 7479type: Compilation.DynamicType, 7779Compilation.LanguageVersion < MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion()) 8006TypeSymbol.Equals(namedType, Compilation.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncAction), TypeCompareKind.ConsiderEverything2) || 8007TypeSymbol.Equals(namedType, Compilation.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncActionWithProgress_T), TypeCompareKind.ConsiderEverything2) || 8008TypeSymbol.Equals(namedType, Compilation.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncOperation_T), TypeCompareKind.ConsiderEverything2) || 8009TypeSymbol.Equals(namedType, Compilation.GetWellKnownType(WellKnownType.Windows_Foundation_IAsyncOperationWithProgress_T2), TypeCompareKind.ConsiderEverything2); 8279if ((object)methodGroup.Methods[i].ReduceExtensionMethod(left.Type, this.Compilation) == null) 8508if ((object)Compilation.SourceModule != fieldSymbol.OriginalDefinition.ContainingModule && 8512if (!Compilation.Assembly.RuntimeSupportsByRefFields) 8614if (!Compilation.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces && Compilation.SourceModule != symbol.ContainingModule) 8626else if (!Compilation.Assembly.RuntimeSupportsDefaultInterfaceImplementation && Compilation.SourceModule != symbol.ContainingModule) 9085if (!Compilation.Assembly.RuntimeSupportsInlineArrayTypes) 9098resultType = Compilation.GetWellKnownType( 9121int? constIndex = InferConstantIndexFromSystemIndex(Compilation, convertedIndex, length, out location); 9809TypeSymbol.Equals(argType, Compilation.GetWellKnownType(WellKnownType.System_Index), TypeCompareKind.ConsiderEverything) ? ThreeState.True : 9810TypeSymbol.Equals(argType, Compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.ConsiderEverything) ? ThreeState.False : 9942var intPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax, Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true }; 10013var startArgumentPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax, Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true }; 10014var lengthArgumentPlaceholder = new BoundImplicitIndexerValuePlaceholder(syntax, Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true }; 10411if (m.ReduceExtensionMethod(receiver.Type, Compilation) is { } reduced && 10459if (Compilation.LanguageVersion < LanguageVersion.CSharp13) 10521var reduced = substituted.ReduceExtensionMethod(receiver.Type, Compilation, out bool wasFullyInferred); 10584new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, location: NoLocation.Singleton, diagnostics: null), 10657var delegateType = Compilation.GetWellKnownType(wkDelegateType); 10662if (checkConstraints(Compilation, Conversions, delegateType, typeArguments)) 10688return Compilation.AnonymousTypeManager.ConstructAnonymousDelegateSymbol(typeDescr); 10802resultIsUsed = (((SimpleLambdaExpressionSyntax)parent).Body != node) || MethodOrLambdaRequiresValue(ContainingMemberOrLambda, Compilation); 10806resultIsUsed = (((ParenthesizedLambdaExpressionSyntax)parent).Body != node) || MethodOrLambdaRequiresValue(ContainingMemberOrLambda, Compilation); 10810resultIsUsed = (((ArrowExpressionClauseSyntax)parent).Expression != node) || MethodOrLambdaRequiresValue(ContainingMemberOrLambda, Compilation);
Binder\Binder_Flags.cs (1)
100var withoutUnsafe = isIteratorBody && this.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync);
Binder\Binder_Initializers.cs (1)
254if (binder.Compilation.IsSubmission)
Binder\Binder_InterpolatedString.cs (8)
32if (startText.StartsWith("@$\"") && !Compilation.IsFeatureEnabled(MessageID.IDS_FeatureAltInterpolatedVerbatimStrings)) 53var newLinesInInterpolationsAllowed = this.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNewLinesInInterpolations); 85this.Compilation.LanguageVersion.ToDisplayString(), 281var interpolatedStringHandlerType = Compilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_DefaultInterpolatedStringHandler); 312var interpolatedStringHandlerType = Compilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_DefaultInterpolatedStringHandler); 526else if (!Compilation.IsFeatureEnabled(MessageID.IDS_FeatureImprovedInterpolatedStrings) && diagnostics.AccumulatesDiagnostics) 860var expected = builderPatternExpectsBool == true ? Compilation.GetSpecialType(SpecialType.System_Boolean) : Compilation.GetSpecialType(SpecialType.System_Void);
Binder\Binder_Invocation.cs (18)
384CheckRestrictedTypeReceiver(result, this.Compilation, diagnostics); 491type: Compilation.DynamicType, 503if (!Compilation.LanguageVersion.AllowNonTrailingNamedArguments()) 998(typeArgumentsOpt.IsDefault || ((MethodSymbol)(object)result.Member).CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, syntax.Location, candidateDiagnostics)))) 1393if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_UnknownWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol) 1402if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Runtime_InteropServices_DispatchWrapper__ctor, diagnostics, syntax: syntax) is MethodSymbol methodSymbol) 1411if (GetWellKnownTypeMember(Compilation, WellKnownMember.System_Type__Missing, diagnostics, syntax: syntax) is FieldSymbol fieldSymbol) 1628defaultValue = new BoundLiteral(syntax, ConstantValue.Create(line), Compilation.GetSpecialType(SpecialType.System_Int32)) { WasCompilerGenerated = true }; 1632string path = callerSourceLocation.SourceTree.GetDisplayPath(callerSourceLocation.SourceSpan, Compilation.Options.SourceReferenceResolver); 1633defaultValue = new BoundLiteral(syntax, ConstantValue.Create(path), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1638defaultValue = new BoundLiteral(syntax, ConstantValue.Create(memberName), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1642&& Conversions.ClassifyBuiltInConversion(Compilation.GetSpecialType(SpecialType.System_String), parameterType, isChecked: false, ref discardedUseSiteInfo).Exists 1647defaultValue = new BoundLiteral(syntax, ConstantValue.Create(argument.Syntax.ToString()), Compilation.GetSpecialType(SpecialType.System_String)) { WasCompilerGenerated = true }; 1669TypeSymbol constantType = Compilation.GetSpecialType(defaultConstantValue.SpecialType); 1736if (Compilation.SourceModule != paramsParameter.ContainingModule) 1994var returnType = GetCommonTypeOrReturnType(methods) ?? new ExtendedErrorTypeSymbol(this.Compilation, string.Empty, arity: 0, errorInfo: null); 2224TypeSymbol returnType = new ExtendedErrorTypeSymbol(this.Compilation, string.Empty, arity: 0, errorInfo: null); 2299return new BoundNameOfOperator(node, boundArgument, ConstantValue.Create(name), Compilation.GetSpecialType(SpecialType.System_String));
Binder\Binder_Lambda.cs (3)
188ReportUseSiteDiagnosticForSynthesizedAttribute(Compilation, 383bool allowShadowingNames = binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNameShadowingInNestedFunctions); 403binder.Compilation,
Binder\Binder_Lookup.cs (28)
262bool isSubmissionTree = Compilation.IsSubmissionSyntaxTree(declarationSyntax.SyntaxTree); 265for (CSharpCompilation submission = Compilation; submission != null; submission = submission.PreviousSubmission) 269var isCurrentSubmission = submission == Compilation; 283submissionImports = ((SourceNamespaceSymbol)Compilation.SourceModule.GlobalNamespace).GetImports(declarationSyntax, basesBeingResolved); 317submissionImports = Imports.ExpandPreviousSubmissionImports(submissionImports, Compilation); 393Compilation.MarkImportDirectiveAsUsed(directive); 714if (Compilation.IsEqualOrDerivedFromWellKnownClass(namedType, WellKnownType.System_Attribute, ref useSiteInfo)) 840var error = new ExtendedErrorTypeSymbol(this.Compilation, name, arity, diagInfo, unreported: true); 852currentType = currentType.GetNextBaseTypeNoUseSiteDiagnostics(basesBeingResolved, this.Compilation, ref visited); 959idictSymbol = Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IDictionary_KV); 960iroDictSymbol = Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IReadOnlyDictionary_KV); 961iListSymbol = Compilation.GetWellKnownType(WellKnownType.System_Collections_IList); 962iCollectionSymbol = Compilation.GetWellKnownType(WellKnownType.System_Collections_ICollection); 963inccSymbol = Compilation.GetWellKnownType(WellKnownType.System_Collections_Specialized_INotifyCollectionChanged); 964inpcSymbol = Compilation.GetWellKnownType(WellKnownType.System_ComponentModel_INotifyPropertyChanged); 1161this.LookupMembersInClass(tmp, this.Compilation.GetSpecialType(SpecialType.System_Object), name, arity, basesBeingResolved, options, originalBinder, type, diagnose, ref useSiteInfo); 1253if (!IsDerivedType(baseType: hiddenContainer, derivedType: hidingSym.ContainingType, basesBeingResolved, this.Compilation, useSiteInfo: ref useSiteInfo) && 1350if ((object)symbol.DeclaringCompilation != this.Compilation 1407else if (!this.Compilation.SourceModule.Equals(unwrappedSymbol.ContainingModule) && unwrappedSymbol.IsHiddenByCodeAnalysisEmbeddedAttribute()) 1462diagInfo = new CSDiagnosticInfo(ErrorCode.ERR_FriendRefNotEqualToThis, unwrappedSymbol.ContainingAssembly.Identity.ToString(), AssemblyIdentity.PublicKeyToString(this.Compilation.Assembly.PublicKey)); 1510var assemblyName = this.Compilation.AssemblyName; 1521ImmutableArray<byte> publicKey = this.Compilation.Assembly.PublicKey; 1647return !IsEffectivelyPrivate(symbol) || symbol.ContainingAssembly == this.Compilation.Assembly; 1891for (CSharpCompilation submission = Compilation; submission != null; submission = submission.PreviousSubmission) 1898bool isCurrentSubmission = submission == Compilation; 1906submissionImports = Imports.ExpandPreviousSubmissionImports(submissionImports, Compilation); 2012type = type.GetNextBaseTypeNoUseSiteDiagnostics(null, this.Compilation, ref visited); 2029this.AddMemberLookupSymbolsInfoInClass(result, Compilation.GetSpecialType(SpecialType.System_Object), options, originalBinder, accessThroughType);
Binder\Binder_NameConflicts.cs (1)
100bool allowShadowing = Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNameShadowingInNestedFunctions);
Binder\Binder_Operators.cs (14)
64var finalDynamicConversion = this.Compilation.Conversions.ClassifyConversionFromExpression(placeholder, left.Type, isChecked: CheckOverflowAtRuntime, ref useSiteInfo); 77Compilation.DynamicType), 292if (!eventSymbol.OriginalDefinition.IsFromCompilation(this.Compilation)) 419type: Compilation.DynamicType, 882return type is NamedTypeSymbol namedType && Compilation.IsReadOnlySpanType(namedType) && 1066var booleanType = Compilation.GetSpecialType(SpecialType.System_Boolean); 1379operatorMethod.ContainingModule != Compilation.SourceModule) 2394if (Compilation.SourceModule != methodOpt.ContainingModule) 2398if (!Compilation.Assembly.RuntimeSupportsStaticAbstractMembersInInterfaces) 2422if (Compilation.SourceModule != methodOpt.ContainingModule) 2540hasErrors = CheckManagedAddr(Compilation, operandType, managedKind, node.Location, diagnostics); 3824bool hasErrors = ReportAsOperatorConversionDiagnostics(node, diagnostics, this.Compilation, operandType, targetType, conversion.Kind, operand.ConstantValueOpt); 4434if (Compilation.Assembly.RuntimeSupportsNumericIntPtr) 4450if (Compilation.Assembly.RuntimeSupportsNumericIntPtr)
Binder\Binder_Patterns.cs (17)
59this.Compilation, pattern.Syntax, expression, innerPattern, whenTrueLabel: whenTrueLabel, whenFalseLabel: whenFalseLabel, diagnostics); 363hasErrors |= !TryGetSpecialTypeMember(Compilation, SpecialMember.System_Array__Length, node, diagnostics, out PropertySymbol lengthProperty); 632if (Compilation.LanguageVersion < requiredVersion && !patternExpressionConversion.IsImplicit) 654if (MessageID.IDS_FeatureSpanCharConstantPattern.CheckFeatureAvailability(diagnostics, Compilation, node.Location)) 774if (requiredVersion > Compilation.LanguageVersion) 778Compilation.LanguageVersion.ToDisplayString(), 1114var objectType = Compilation.GetSpecialType(SpecialType.System_Object); 1141var objectType = Compilation.GetSpecialType(SpecialType.System_Object); 1246if (Compilation.LanguageVersion < MessageID.IDS_FeatureRecursivePatterns.RequiredVersion()) 1251iTupleType = Compilation.GetWellKnownType(WellKnownType.System_Runtime_CompilerServices_ITuple); 1260if (declType != (object)Compilation.GetSpecialType(SpecialType.System_Object) && 1261declType != (object)Compilation.DynamicType && 1269iTupleGetLength = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Length); 1270iTupleGetItem = (MethodSymbol?)Compilation.GetWellKnownTypeMember(WellKnownMember.System_Runtime_CompilerServices_ITuple__get_Item); 1287var result = Compilation.Conversions.ClassifyBuiltInConversion(type, possibleBaseInterface, isChecked: CheckOverflowAtRuntime, ref useSiteInfo).IsImplicit; 1324|| (inputType.IsPointerType() && Compilation.LanguageVersion < MessageID.IDS_FeatureRecursivePatterns.RequiredVersion())) 1357var declType = TypeWithState.ForType(inputType).ToTypeWithAnnotations(Compilation);
Binder\Binder_Query.cs (1)
813AnonymousTypeManager manager = this.Compilation.AnonymousTypeManager;
Binder\Binder_QueryErrors.cs (4)
89var ienumerable_t = Compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T); 90var iqueryable_t = Compilation.GetWellKnownType(WellKnownType.System_Linq_IQueryable_T); 127var ienumerable = Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerable); 128var iqueryable = Compilation.GetWellKnownType(WellKnownType.System_Linq_IQueryable);
Binder\Binder_Statements.cs (18)
173if (!this.Compilation.Options.AllowUnsafe) 269else if (InUnsafeRegion && Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefUnsafeInIteratorAsync)) 395if (Compilation.LanguageVersion < MessageID.IDS_FeatureSwitchExpression.RequiredVersion()) 412if ((object)type == null || !type.IsErrorType() && !Compilation.IsExceptionType(type.EffectiveType(ref useSiteInfo), ref useSiteInfo)) 638return method.ReturnsVoid || method.IsIterator || method.IsAsyncEffectivelyReturningTask(this.Compilation); 1309if (CheckManagedAddr(Compilation, elementType, initializerSyntax.Location, diagnostics)) 1374GenerateImplicitConversionError(diagnostics, this.Compilation, initializerSyntax, elementConversionClassification, pointerType, declType); 1985var reason = Conversions.IsAnonymousFunctionCompatibleWithType(anonymousFunction, targetType, this.Compilation); 2155SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, lambdaParameterType, delegateParameterType); 2401GenerateImplicitConversionError(diagnostics, this.Compilation, syntax, conversion, sourceType, targetType, operand.ConstantValueOpt); 2849return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningTask(this.Compilation); 2855return symbol?.Kind == SymbolKind.Method && ((MethodSymbol)symbol).IsAsyncEffectivelyReturningGenericTask(this.Compilation); 2864return method.IsAsyncReturningIAsyncEnumerable(this.Compilation) || 2865method.IsAsyncReturningIAsyncEnumerator(this.Compilation); 3164if (!Compilation.IsExceptionType(effectiveType, ref useSiteInfo)) 3217else if (TypeSymbol.Equals(previousType, Compilation.GetWellKnownType(WellKnownType.System_Exception), TypeCompareKind.ConsiderEverything2) && 3218Compilation.SourceAssembly.RuntimeCompatibilityWrapNonExceptionThrows) 3688initializerInvocation = BindImplicitConstructorInitializer((MethodSymbol)this.ContainingMember(), diagnostics, Compilation);
Binder\Binder_Symbols.cs (37)
350return symbol.ContainingNamespaceOrType() ?? this.Compilation.Assembly.GlobalNamespace; 357return this.Compilation.GlobalNamespaceAlias; 544TypeWithAnnotations constructedType = typeArgument.SetIsAnnotated(Compilation); 550diagnostics.Add(new LazyUseSiteDiagnosticsInfoForNullableType(Compilation.LanguageVersion, constructedType), syntax.GetLocation()); 557type.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: true, location, diagnostics)); 559else if (GetNullableUnconstrainedTypeParameterDiagnosticIfNecessary(Compilation.LanguageVersion, constructedType) is { } diagnosticInfo) 598CheckManagedAddr(Compilation, elementType.Type, node.Location, diagnostics); 669var array = ArrayTypeSymbol.CreateCSharpArray(this.Compilation.Assembly, type, rankSpecifier.Rank); 722ReportMissingTupleElementNamesAttributesIfNeeded(Compilation, syntax.GetLocation(), diagnostics); 733bool includeNullability = Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes); 740this.Compilation, 834return TypeWithAnnotations.Create(new ExtendedErrorTypeSymbol(qualifierOpt ?? this.Compilation.Assembly.GlobalNamespace, string.Empty, arity: 0, errorInfo: null)); 861Compilation.Assembly.GlobalNamespace, identifierValueText, 0, 889bindingResult = Compilation.DynamicType; 931if (Compilation.LanguageVersion < MessageID.IDS_FeatureDynamic.RequiredVersion()) 1043if (!Compilation.HasDynamicEmitAttributes(bag, node.Location)) 1331return new ExtendedErrorTypeSymbol(this.Compilation, name, arity, diagnosticInfo, unreported: false); 1358var binder = !Compilation.IsFeatureEnabled(MessageID.IDS_FeatureUsingTypeAlias) 1529if (method.ReduceExtensionMethod(receiverType, Compilation) is not null) 1563bool includeNullability = Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNullableReferenceTypes); 1564type.CheckConstraintsForNamedType(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability, typeSyntax.Location, diagnostics), 1633return GetSpecialType(this.Compilation, typeId, node, diagnostics); 1658return GetSpecialTypeMember(this.Compilation, member, diagnostics, syntax); 1761return GetWellKnownType(this.Compilation, type, diagnostics, location); 1787NamedTypeSymbol typeSymbol = this.Compilation.GetWellKnownType(type); 1795return GetWellKnownTypeMember(Compilation, member, diagnostics, location, syntax, isOptional); 1904if (container is object && container != Compilation.Assembly && container != Compilation.Assembly.CorLibrary) 2129if (ns.ContainingAssembly == Compilation.Assembly) 2141Debug.Assert(arg2.ContainingAssembly == Compilation.Assembly); 2184Compilation.IsAttributeType((NamedTypeSymbol)first) && 2185Compilation.IsAttributeType((NamedTypeSymbol)second)) 2243((SourceModuleSymbol)this.Compilation.SourceModule).AnyReferencedAssembliesAreLinked) 2298return new ExtendedErrorTypeSymbol(qualifierOpt ?? Compilation.Assembly.GlobalNamespace, simpleName, arity, info); 2460var compilation = this.Compilation; 2562if (ReferenceEquals(qualifierOpt, Compilation.GlobalNamespace)) 2619Compilation.Assembly.Modules[0].GetReferencedAssemblySymbols())
Binder\Binder_TupleOperators.cs (2)
194TypeSymbol dynamicType = hasError ? CreateErrorType() : Compilation.DynamicType; 243var compilation = this.Compilation;
Binder\Binder_Unsafe.cs (1)
65else if (this.IsIndirectlyInIterator && MessageID.IDS_FeatureRefUnsafeInIteratorAsync.GetFeatureAvailabilityDiagnosticInfo(Compilation) is { } unsafeInIteratorDiagnosticInfo)
Binder\BinderFactory.BinderFactoryVisitor.cs (2)
913container = outer.Compilation.GlobalNamespace; 921outer = AddInImportsBinders((SourceNamespaceSymbol)outer.Compilation.SourceModule.GetModuleNamespace(ns), namespaceDecl, outer, inUsing);
Binder\BuckStopsHereBinder.cs (1)
70return IsSymbolAccessibleConditional(symbol, Compilation.Assembly, ref useSiteInfo);
Binder\ForEachLoopBinder.cs (16)
242messageId.CheckFeatureAvailability(diagnostics, Compilation, collectionExpr.Syntax.Location); 489SymbolDistinguisher distinguisher = new SymbolDistinguisher(this.Compilation, inferredType.Type, iterationVariableType.Type); 570IsIEnumerableT(builder.CollectionType.OriginalDefinition, IsAsync, Compilation) || 1060this.Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerable_T) : 1061this.Compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T)); 1084getEnumeratorMethod = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerable_T__GetAsyncEnumerator, 1120Debug.Assert(enumeratorType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerator_T))); 1130currentPropertyGetter = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__get_Current, diagnostics, errorLocationSyntax.Location, isOptional: false); 1258NamedTypeSymbol targetInterface = isAsync ? this.Compilation.GetWellKnownType(WellKnownType.System_IAsyncDisposable) : this.Compilation.GetSpecialType(SpecialType.System_IDisposable); 1268enumeratorType.ContainingModule != Compilation.SourceModule) 1304TypeSymbol.Equals(builder.GetEnumeratorInfo.Method.ReturnType, this.Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerator), TypeCompareKind.ConsiderEverything2)); 1734return type.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerable_T)); 1757NamedTypeSymbol implementedIEnumerable = GetIEnumerableOfT(type, isAsync, Compilation, ref useSiteInfo, out foundMultiple, out bool needSupportForRefStructInterfaces); 1766var implementedNonGeneric = this.Compilation.GetSpecialType(SpecialType.System_Collections_IEnumerable); 1775if (implementedIEnumerable is not null && needSupportForRefStructInterfaces && type.ContainingModule != Compilation.SourceModule)
Binder\HostObjectModeBinder.cs (1)
24TypeSymbol result = this.Compilation.GetHostObjectTypeSymbol();
Binder\InContainerBinder.cs (2)
48return ((object)merged != null) ? merged.GetConstituentForCompilation(this.Compilation) : _container; 94return TypeWithAnnotations.Create(this.Compilation.GetSpecialType(SpecialType.System_Object));
Binder\InMethodBinder.cs (1)
138var elementType = GetIteratorElementTypeFromReturnType(Compilation, refKind, returnType, errorLocation: null, diagnostics: null);
Binder\InSubmissionClassBinder.cs (3)
41for (var submission = this.Compilation; submission != null; submission = submission.PreviousSubmission) 60internal override ImmutableArray<AliasAndExternAliasDirective> ExternAliases => ((SourceNamespaceSymbol)Compilation.SourceModule.GlobalNamespace).GetExternAliases(_declarationSyntax); 62internal override ImmutableArray<AliasAndUsingDirective> UsingAliases => ((SourceNamespaceSymbol)Compilation.SourceModule.GlobalNamespace).GetUsingAliases(_declarationSyntax, basesBeingResolved: null);
Binder\LockBinder.cs (2)
46if (expr.ConstantValueOpt != ConstantValue.Null || Compilation.FeatureStrictEnabled) // Dev10 allows the null literal. 52else if (!exprType.IsReferenceType && (exprType.IsValueType || Compilation.FeatureStrictEnabled))
Binder\Semantics\Conversions\Conversions.cs (3)
25: base(binder.Compilation.Assembly.CorLibrary, currentRecursionDepth, includeNullability, otherNullabilityOpt) 36protected override CSharpCompilation Compilation { get { return _binder.Compilation; } } 254GetDelegateOrFunctionPointerArguments(source.Syntax, analyzedArguments, delegateInvokeMethodOpt.Parameters, binder.Compilation);
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (1)
380TypeSymbol systemDelegateType = _binder.Compilation.GetSpecialType(SpecialType.System_Delegate);
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (2)
294binder.Compilation, 1485Conversions.GetDelegateOrFunctionPointerArguments(source.Syntax, analyzedArguments, delegateParameters, binder.Compilation);
Binder\Semantics\OverloadResolution\OverloadResolution.cs (9)
40get { return _binder.Compilation; } 55bool value = _binder.Compilation.FeatureStrictEnabled; 1185(binder.Compilation.LanguageVersion > LanguageVersion.CSharp12 || member.ContainingModule == binder.Compilation.SourceModule))) 1204var collectionTypeKind = ConversionsBase.GetCollectionExpressionTypeKind(binder.Compilation, type, out elementType); 2798if (_binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureImprovedInterpolatedStrings) && 3615if (argRefKind == RefKind.Ref && binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) 3625else if (AreRefsCompatibleForMethodConversion(candidateMethodParameterRefKind: paramRefKind, delegateParameterRefKind: argRefKind, binder.Compilation)) 4046_binder.Compilation,
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (5)
323if (HadConstructedParameterFailedConstraintCheck(binder.Conversions, binder.Compilation, diagnostics, location)) 1254!(refArg == RefKind.Ref && refParameter == RefKind.In && binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) && 1265else if (refArg == RefKind.Ref && refParameter == RefKind.In && !binder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureRefReadonlyParameters)) 1273binder.Compilation.LanguageVersion.ToDisplayString(), 1343SymbolDistinguisher distinguisher = new SymbolDistinguisher(binder.Compilation, displayArg, unwrapIfParamsCollection(badArg, parameter, isLastParameter));
Binder\SwitchBinder_Patterns.cs (1)
46compilation: this.Compilation,
Binder\SwitchExpressionBinder.cs (1)
63decisionDag = DecisionDagBuilder.CreateDecisionDagForSwitchExpression(this.Compilation, node, boundInputExpression, switchArms, defaultLabel, diagnostics);
Binder\UsingStatementBinder.cs (5)
204MessageID.IDS_FeatureDisposalPattern.CheckFeatureAvailability(diagnostics, originalBinder.Compilation, syntax.Location); 247awaitableType = originalBinder.Compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_ValueTask); 290(fromExpression ? expressionOpt!.Type : declarationTypeOpt)!.ContainingModule != originalBinder.Compilation.SourceModule) 301? originalBinder.Compilation.GetWellKnownType(WellKnownType.System_IAsyncDisposable) 302: originalBinder.Compilation.GetSpecialType(SpecialType.System_IDisposable);
Binder\WithExternAndUsingAliasesBinder.cs (1)
178foreach (var declaration in ((SourceNamespaceSymbol)Compilation.SourceModule.GlobalNamespace).MergedDeclaration.Declarations)
BoundTree\UnboundLambda.cs (10)
147var compilation = Binder.Compilation; 226var useSiteInfo = withDependencies ? new CompoundUseSiteInfo<AssemblySymbol>(binder.Compilation.Assembly) : CompoundUseSiteInfo<AssemblySymbol>.DiscardedDependencies; 319binder.Compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task); 334binder.Compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task_T); 761returnType = TypeWithAnnotations.Create(Binder.Compilation.GetSpecialType(SpecialType.System_Void)); 785var compilation = Binder.Compilation; 851if (Binder.MethodOrLambdaRequiresValue(lambdaSymbol, this.Binder.Compilation)) 888Binder.Compilation, 963? TypeWithAnnotations.Create(this.Binder.Compilation.GetSpecialType(SpecialType.System_Void)) 1211? this.Binder.Compilation.GetSpecialType(SpecialType.System_Void)
Compilation\CSharpSemanticModel.cs (3)
4579binder.Compilation); 4594binder.Compilation); 4639binder.Compilation);
Compiler\MethodCompiler.cs (1)
1793var compilation = bodyBinder.Compilation;
Errors\LazyMissingNonNullTypesContextDiagnosticInfo.cs (1)
75var code = tree.IsGeneratedCode(binder.Compilation.Options.SyntaxTreeOptionsProvider, CancellationToken.None)
FlowAnalysis\NullableWalker.cs (4)
1561binder.Compilation, 1634var compilation = binder.Compilation; 4589var walker = new NullableWalker(binder.Compilation, 4630reportRemainingWarnings: false, reportTopLevelWarnings: false).ToTypeWithAnnotations(binder.Compilation);
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (1)
26CallingConvention callingConvention = getCallingConvention(typeBinder.Compilation, syntax.CallingConvention, customModifiers, diagnostics);
Symbols\FunctionTypeSymbol.cs (1)
88if (_binder.Compilation.TestOnlyCompilationData is InferredDelegateTypeData data &&
Symbols\Source\LocalFunctionSymbol.cs (1)
43Debug.Assert(containingSymbol.DeclaringCompilation == binder.Compilation);
Symbols\Source\ParameterHelpers.cs (1)
212bool allowShadowingNames = withTypeParametersBinder.Compilation.IsFeatureEnabled(MessageID.IDS_FeatureNameShadowingInNestedFunctions) &&
Symbols\Source\SourceDelegateMethodSymbol.cs (2)
79if (binder.Compilation.GetSpecialType(SpecialType.System_IAsyncResult).TypeKind != TypeKind.Error && 80binder.Compilation.GetSpecialType(SpecialType.System_AsyncCallback).TypeKind != TypeKind.Error &&
Symbols\Source\SourceLocalSymbol.cs (1)
53Debug.Assert(containingSymbol.DeclaringCompilation == scopeBinder.Compilation);
Symbols\Source\SourceParameterSymbol.cs (1)
52Binder.ReportUseSiteDiagnosticForSynthesizedAttribute(context.Compilation,
Symbols\Symbol_Attributes.cs (1)
864if (!boundAttribute.HasErrors && ValidateAttributeUsage(boundAttribute, attributeSyntax, binder.Compilation, symbolPart, diagnostics, uniqueAttributeTypes))