/// <summary> /// Gets or initializes static constructor symbol. /// </summary> public MethodSymbol /*!*/ EnsureStaticCtor(TypeSymbol container) { Contract.ThrowIfNull(container); //if (container is NamedTypeSymbol) //{ // var cctors = ((NamedTypeSymbol)container).StaticConstructors; // if (!cctors.IsDefaultOrEmpty) // { // return cctors[0]; // } //} // var members = EnsureList(container); // var cctor = members.OfType <SynthesizedCctorSymbol>().FirstOrDefault(); if (cctor == null) { cctor = new SynthesizedCctorSymbol(container); members.Add(cctor); } // return(cctor); }
/// <summary> /// Gets or initializes static constructor symbol. /// </summary> public MethodSymbol /*!*/ EnsureStaticCtor(Cci.ITypeDefinition container) { Contract.ThrowIfNull(container); //if (container is NamedTypeSymbol) //{ // var cctors = ((NamedTypeSymbol)container).StaticConstructors; // if (!cctors.IsDefaultOrEmpty) // { // return cctors[0]; // } //} // var members = EnsureList(container); lock (members) { // var cctor = members.OfType <SynthesizedCctorSymbol>().FirstOrDefault(); if (cctor == null) { cctor = new SynthesizedCctorSymbol(container, DeclaringCompilation.SourceModule); members.Add(cctor); } return(cctor); } // }