public ReadonlyFieldCollector(IEnumerable <TypeDeclarationTuple> partialTypeDeclarations) { excludedFields = new HashSet <IFieldSymbol>(); assignedAsReadonly = new HashSet <IFieldSymbol>(); foreach (var partialTypeDeclaration in partialTypeDeclarations) { var p = new PartialTypeDeclarationProcessor(partialTypeDeclaration, this); p.CollectFields(); allFields.AddRange(p.AllFields); } }
public ReadonlyFieldCollector(IEnumerable <TypeDeclarationTuple> partialTypeDeclarations) { this.excludedFields = new HashSet <IFieldSymbol>(); this.assignedAsReadonly = new HashSet <IFieldSymbol>(); foreach (var partialTypeDeclaration in partialTypeDeclarations) { var p = new PartialTypeDeclarationProcessor(partialTypeDeclaration, this); p.CollectFields(); this.allFields.AddRange(p.AllFields); } foreach (var attributedField in this.allFields.Where(f => f.Symbol.GetAttributes().Any())) { this.excludedFields.Add(attributedField.Symbol); } }
public ReadonlyFieldCollector(IEnumerable <TypeDeclarationTuple> partialTypeDeclarations) { this.excludedFields = new HashSet <IFieldSymbol>(); this.assignedAsReadonly = new HashSet <IFieldSymbol>(); foreach (var partialTypeDeclaration in partialTypeDeclarations) { var p = new PartialTypeDeclarationProcessor(partialTypeDeclaration, this); p.CollectFields(); this.allFields.AddRange(p.AllFields); } foreach (var attributedField in this.allFields.Where(f => ShouldBeExcluded(f))) { this.excludedFields.Add(attributedField.Symbol); } bool ShouldBeExcluded(FieldTuple fieldTuple) => fieldTuple.Symbol.GetAttributes().Any() || (fieldTuple.Symbol.Type.IsStruct() && fieldTuple.Symbol.Type.SpecialType == SpecialType.None); }
public ReadonlyFieldCollector(IEnumerable<TypeDeclarationTuple> partialTypeDeclarations) { excludedFields = new HashSet<IFieldSymbol>(); assignedAsReadonly = new HashSet<IFieldSymbol>(); foreach (var partialTypeDeclaration in partialTypeDeclarations) { var p = new PartialTypeDeclarationProcessor(partialTypeDeclaration, this); p.CollectFields(); allFields.AddRange(p.AllFields); } }