public SynthesizedRecordEqualityContractProperty(NamedTypeSymbol containingType, bool isOverride)
 {
     ContainingType      = containingType;
     IsVirtual           = !isOverride;
     IsOverride          = isOverride;
     TypeWithAnnotations = TypeWithAnnotations.Create(containingType.DeclaringCompilation.GetWellKnownType(WellKnownType.System_Type), NullableAnnotation.NotAnnotated);
     GetMethod           = new GetAccessorSymbol(this);
 }
コード例 #2
0
        public SynthesizedRecordEqualityContractProperty(NamedTypeSymbol containingType, bool isOverride)
        {
            ContainingType      = containingType;
            IsOverride          = isOverride;
            TypeWithAnnotations = TypeWithAnnotations.Create(containingType.DeclaringCompilation.GetWellKnownType(WellKnownType.System_Type), NullableAnnotation.NotAnnotated);
            var overriddenProperty = OverriddenProperty;

            if (overriddenProperty is object)
            {
                TypeWithAnnotations = overriddenProperty.TypeWithAnnotations;
            }
            var getAccessorName = overriddenProperty?.GetMethod?.Name ??
                                  SourcePropertyAccessorSymbol.GetAccessorName(PropertyName, getNotSet: true, isWinMdOutput: false /* unused for getters */);

            GetMethod = new GetAccessorSymbol(this, getAccessorName);
        }
コード例 #3
0
        public SynthesizedRecordPropertySymbol(
            NamedTypeSymbol containingType,
            ParameterSymbol backingParameter,
            DiagnosticBag diagnostics)
            : base(backingParameter.Locations[0])
        {
            ContainingType    = containingType;
            _backingParameter = backingParameter;
            string name = backingParameter.Name;

            BackingField = new SynthesizedBackingFieldSymbol(
                this,
                GeneratedNames.MakeBackingFieldName(name),
                isReadOnly: true,
                isStatic: false,
                hasInitializer: true);
            GetMethod = new GetAccessorSymbol(this, name);
            SetMethod = new InitAccessorSymbol(this, name, diagnostics);
        }