コード例 #1
0
 public GetAccessorSymbol(SynthesizedRecordPropertySymbol property, string paramName)
 {
     _property = property;
     Name      = SourcePropertyAccessorSymbol.GetAccessorName(
         paramName,
         getNotSet: true,
         isWinMdOutput: false /* unused for getters */);
 }
コード例 #2
0
            public InitAccessorSymbol(
                SynthesizedRecordPropertySymbol property,
                string paramName,
                DiagnosticBag diagnostics)
            {
                _property = property;
                Name      = SourcePropertyAccessorSymbol.GetAccessorName(
                    paramName,
                    getNotSet: false,
                    // https://github.com/dotnet/roslyn/issues/44684
                    isWinMdOutput: false);

                var comp         = property.DeclaringCompilation;
                var type         = TypeWithAnnotations.Create(comp.GetSpecialType(SpecialType.System_Void));
                var initOnlyType = Binder.GetWellKnownType(
                    comp,
                    WellKnownType.System_Runtime_CompilerServices_IsExternalInit,
                    diagnostics,
                    property.Location);
                var modifiers = ImmutableArray.Create <CustomModifier>(CSharpCustomModifier.CreateRequired(initOnlyType));

                ReturnTypeWithAnnotations = type.WithModifiers(modifiers);
            }