コード例 #1
0
 public static bool IsSameAssemblyOrHasFriendAccessTo(this IAssemblySymbol assembly, IAssemblySymbol toAssembly)
 {
     return
         Equals(assembly, toAssembly) ||
         (assembly.IsInteractive && toAssembly.IsInteractive) ||
         toAssembly.GivesAccessTo(assembly);
 }
コード例 #2
0
 public static bool IsSameAssemblyOrHasFriendAccessTo(this IAssemblySymbol assembly, IAssemblySymbol toAssembly)
 {
     return
         (Equals(assembly, toAssembly) ||
          (assembly.IsInteractive && toAssembly.IsInteractive) ||
          toAssembly.GivesAccessTo(assembly));
 }
コード例 #3
0
 public static bool IsSameAssemblyOrHasFriendAccessTo(this IAssemblySymbol assembly, IAssemblySymbol toAssembly)
 {
     return
         (SymbolEqualityComparer.IncludeNullability.Equals(assembly, toAssembly) ||
          (assembly.IsInteractive && toAssembly.IsInteractive) ||
          toAssembly.GivesAccessTo(assembly));
 }
コード例 #4
0
        public static bool IsSameAssemblyOrHasFriendAccessTo(this IAssemblySymbol assembly, IAssemblySymbol toAssembly)
        {
            var areEquals = assembly.Equals(toAssembly);

            if (areEquals == false && toAssembly == null)
            {
                return(false);
            }

            return
                (areEquals ||
                 (assembly.IsInteractive && toAssembly.IsInteractive) ||
                 toAssembly.GivesAccessTo(assembly));
        }
コード例 #5
0
        public static string GetAccessModifiers(this ISourceGenerationDescription sourceGenerationDescription)
        {
            // Access must be protected unless this assembly has InternalsVisibleTo access to Unity.Entities,
            // in which case it should be `protected internal`
            IAssemblySymbol currentAssembly =
                sourceGenerationDescription.Context.Compilation.Assembly;
            IAssemblySymbol entitiesAssembly =
                currentAssembly
                .Modules
                .First()
                .ReferencedAssemblySymbols
                .First(asm => asm.Name == "Unity.Entities");

            return(entitiesAssembly.GivesAccessTo(currentAssembly) ? "protected internal" : "protected");
        }