/// <summary> /// Returns null if there are no synthesized fields. /// </summary> public IEnumerable <Cci.IFieldDefinition> GetSynthesizedFields(TNamedTypeSymbol container) { SynthesizedDefinitions defs = GetCacheOfSynthesizedDefinitions(container, addIfNotFound: false); if (defs != null) { return(defs.Fields); } return(null); }
public ImmutableArray <Cci.ITypeDefinitionMember> GetSynthesizedMembers(Cci.ITypeDefinition container) { SynthesizedDefinitions defs = GetCacheOfSynthesizedDefinitions((TNamedTypeSymbol)container, addIfNotFound: false); if (defs == null) { return(ImmutableArray <Cci.ITypeDefinitionMember> .Empty); } return(defs.GetAllMembers()); }
public ITypeDefinitionMember[] GetSynthesizedMembers(ITypeDefinition container) { SynthesizedDefinitions defs = GetCacheOfSynthesizedDefinitions((TNamedTypeSymbol)container, addIfNotFound: false); if (defs == null) { return(new ITypeDefinitionMember[0]); } return(defs.GetAllMembers()); }
public void AddSynthesizedDefinition(TNamedTypeSymbol container, Cci.IFieldDefinition field) { Debug.Assert(field != null); SynthesizedDefinitions defs = GetCacheOfSynthesizedDefinitions(container); if (defs.Fields == null) { Interlocked.CompareExchange(ref defs.Fields, new ConcurrentQueue <Cci.IFieldDefinition>(), null); } defs.Fields.Enqueue(field); }
public void AddSynthesizedDefinition(TNamedTypeSymbol container, Cci.IPropertyDefinition property) { Debug.Assert(property != null); SynthesizedDefinitions defs = GetCacheOfSynthesizedDefinitions(container); if (defs.Properties == null) { Interlocked.CompareExchange(ref defs.Properties, new ConcurrentQueue <Cci.IPropertyDefinition>(), null); } defs.Properties.Enqueue(property); }
public void AddSynthesizedDefinition(TNamedTypeSymbol container, Cci.INestedTypeDefinition nestedType) { Debug.Assert(nestedType != null); SynthesizedDefinitions defs = GetOrAddSynthesizedDefinitions(container); if (defs.NestedTypes == null) { Interlocked.CompareExchange(ref defs.NestedTypes, new ConcurrentQueue <Cci.INestedTypeDefinition>(), null); } defs.NestedTypes.Enqueue(nestedType); }
public void AddSynthesizedDefinition(TNamedTypeSymbol container, Cci.IMethodDefinition method) { Debug.Assert(method != null); SynthesizedDefinitions defs = GetOrAddSynthesizedDefinitions(container); if (defs.Methods == null) { Interlocked.CompareExchange(ref defs.Methods, new ConcurrentQueue <Cci.IMethodDefinition>(), null); } defs.Methods.Enqueue(method); }
private SynthesizedDefinitions GetCacheOfSynthesizedDefinitions(TNamedTypeSymbol container, bool addIfNotFound = true) { Debug.Assert(((INamedTypeSymbol)container).IsDefinition); if (addIfNotFound) { SynthesizedDefinitions result; if (!_synthesizedDefs.TryGetValue(container, out result)) { result = new SynthesizedDefinitions(); _synthesizedDefs.Add(container, result); } return(result); } SynthesizedDefinitions defs; _synthesizedDefs.TryGetValue(container, out defs); return(defs); }
/// <summary> /// Returns null if there are no compiler generated types. /// </summary> public IEnumerable <Cci.INestedTypeDefinition> GetSynthesizedTypes(TNamedTypeSymbol container) { IEnumerable <Cci.INestedTypeDefinition> declareTypes = GetSynthesizedNestedTypes(container); IEnumerable <Cci.INestedTypeDefinition> compileEmitTypes = null; SynthesizedDefinitions defs = GetCacheOfSynthesizedDefinitions(container, addIfNotFound: false); if (defs != null) { compileEmitTypes = defs.NestedTypes; } if (declareTypes == null) { return(compileEmitTypes); } if (compileEmitTypes == null) { return(declareTypes); } return(declareTypes.Concat(compileEmitTypes)); }