Exemplo n.º 1
0
 static IMethod GetDummyConstructor(ICompilation compilation)
 {
     // Reuse the same IMethod instance for all dummy constructors
     // so that two occurrences of 'new T()' refer to the same constructor.
     return((IMethod)compilation.CacheManager.GetOrAddShared(
                dummyConstructor, _ => dummyConstructor.CreateResolved(compilation.TypeResolveContext)));
 }
Exemplo n.º 2
0
        internal IMethod GetAccessor(ref IMethod accessorField, IUnresolvedMethod unresolvedAccessor)
        {
            if (unresolvedAccessor == null)
            {
                return(null);
            }
            IMethod result = LazyInit.VolatileRead(ref accessorField);

            if (result != null)
            {
                return(result);
            }
            else
            {
                return(LazyInit.GetOrSet(ref accessorField, (IMethod)unresolvedAccessor.CreateResolved(context)));
            }
        }
Exemplo n.º 3
0
 public IEnumerable <IMethod> GetConstructors(Predicate <IUnresolvedMethod> filter = null, GetMemberOptions options = GetMemberOptions.IgnoreInheritedMembers)
 {
     if ((options & GetMemberOptions.IgnoreInheritedMembers) == GetMemberOptions.IgnoreInheritedMembers)
     {
         if (this.HasDefaultConstructorConstraint || this.HasValueTypeConstraint)
         {
             if (filter == null || filter(dummyConstructor))
             {
                 var     resolvedCtor = (IMethod)dummyConstructor.CreateResolved(compilation.TypeResolveContext);
                 IMethod m            = new SpecializedMethod(this, resolvedCtor, EmptyList <IType> .Instance);
                 return(new [] { m });
             }
         }
         return(EmptyList <IMethod> .Instance);
     }
     else
     {
         return(GetMembersHelper.GetConstructors(this, filter, options));
     }
 }
Exemplo n.º 4
0
		internal IMethod GetAccessor(ref IMethod accessorField, IUnresolvedMethod unresolvedAccessor)
		{
			if (unresolvedAccessor == null)
				return null;
			IMethod result = accessorField;
			if (result != null) {
				LazyInit.ReadBarrier();
				return result;
			} else {
				return LazyInit.GetOrSet(ref accessorField, (IMethod)unresolvedAccessor.CreateResolved(context));
			}
		}
Exemplo n.º 5
0
 protected virtual IMethod CreateResolvedAccessor(IUnresolvedMethod unresolvedAccessor)
 {
     return((IMethod)unresolvedAccessor.CreateResolved(context));
 }
 protected virtual IMethod CreateResolvedAccessor(IUnresolvedMethod unresolvedAccessor)
 {
     return (IMethod)unresolvedAccessor.CreateResolved(context);
 }