コード例 #1
0
        public void Generate(IEnumerableCollectionProcessor processor, ModuleDefinition mainModule, ModuleDefinition systemModule, ModuleDefinition unityModule)
        {
            var array = processor.EnabledNameCollection.Intersect(Api.NameCollection).ToArray();

            if (!Api.ShouldDefine(array))
            {
                return;
            }
            TypeDefinition @static;

            mainModule.Types.Add(@static = mainModule.DefineStatic(nameof(AggregateValue1Function) + "Helper"));

            if (Api.TryGetEnabled("TEnumerable", out var genericEnabled) && genericEnabled)
            {
                GenerateGeneric(@static, mainModule, systemModule);
            }

            foreach (var name in array)
            {
                if (!processor.IsSpecialType(name, out var isSpecial))
                {
                    throw new KeyNotFoundException();
                }
                if (!Api.TryGetEnabled(name, out var apiEnabled) || !apiEnabled)
                {
                    continue;
                }
                GenerateEach(name, isSpecial, @static, mainModule, systemModule);
            }
        }
コード例 #2
0
        public void Generate(IEnumerableCollectionProcessor processor, ModuleDefinition mainModule, ModuleDefinition systemModule, ModuleDefinition unityModule)
        {
            if (!processor.TryGetEnabled(Api.Name, out var enabled) || !enabled)
            {
                return;
            }
            var array = processor.EnabledNameCollection.Intersect(Api.NameCollection).ToArray();

            if (!Api.ShouldDefine(array))
            {
                return;
            }
            TypeDefinition @static;

            mainModule.Types.Add(@static = mainModule.DefineStatic(Api.Name + Api.Description + "Helper"));
            TypeReference elementTypeReference;

            switch (elementTypeName)
            {
            case "Double":
                elementTypeReference = mainModule.TypeSystem.Double;
                break;

            case "Single":
                elementTypeReference = mainModule.TypeSystem.Single;
                break;

            case "Int32":
                elementTypeReference = mainModule.TypeSystem.Int32;
                break;

            case "UInt32":
                elementTypeReference = mainModule.TypeSystem.UInt32;
                break;

            case "Int64":
                elementTypeReference = mainModule.TypeSystem.Int64;
                break;

            case "UInt64":
                elementTypeReference = mainModule.TypeSystem.UInt64;
                break;

            default: throw new ArgumentException();
            }
            foreach (var name in array)
            {
                if (!processor.IsSpecialType(name, out var isSpecial))
                {
                    throw new KeyNotFoundException();
                }
                if (!Api.TryGetEnabled(name, out var apiEnabled) || !apiEnabled)
                {
                    continue;
                }
                GenerateEach(name, isSpecial, @static, mainModule, systemModule, elementTypeReference);
            }
        }
コード例 #3
0
        public void Generate(IEnumerableCollectionProcessor processor, ModuleDefinition mainModule, ModuleDefinition systemModule, ModuleDefinition unityModule)
        {
            var array = processor.EnabledNameCollection.Intersect(Api.NameCollection).ToArray();

            if (!Api.ShouldDefine(array))
            {
                return;
            }
            var @static = mainModule.GetType("UniNativeLinq", "NativeEnumerable");

            foreach (var name in array)
            {
                if (!processor.IsSpecialType(name, out var isSpecial))
                {
                    throw new KeyNotFoundException();
                }
                if (!Api.TryGetEnabled(name, out var apiEnabled) || !apiEnabled)
                {
                    continue;
                }
                GenerateEach(name, isSpecial, @static, mainModule, systemModule);
            }
        }
コード例 #4
0
 public void Generate(IEnumerableCollectionProcessor processor, ModuleDefinition mainModule, ModuleDefinition systemModule, ModuleDefinition unityModule)
 {
     if (!processor.TryGetEnabled(Name + keyName, out var enabled) || !enabled) return;
     var array = processor.EnabledNameCollection.Intersect(Api.NameCollection).ToArray();
     if (!Api.ShouldDefine(array)) return;
     TypeDefinition @static;
     mainModule.Types.Add(@static = mainModule.DefineStatic(Name + "RefFunc" + keyName + "Helper"));
     TypeReference keyType;
     switch (keyName)
     {
         case "Double":
             keyType = mainModule.TypeSystem.Double;
             break;
         case "Single":
             keyType = mainModule.TypeSystem.Single;
             break;
         case "Int32":
             keyType = mainModule.TypeSystem.Int32;
             break;
         case "UInt32":
             keyType = mainModule.TypeSystem.UInt32;
             break;
         case "Int64":
             keyType = mainModule.TypeSystem.Int64;
             break;
         case "UInt64":
             keyType = mainModule.TypeSystem.UInt64;
             break;
         default: throw new ArgumentOutOfRangeException();
     }
     foreach (var name in array)
     {
         if (!processor.IsSpecialType(name, out var isSpecial)) throw new KeyNotFoundException();
         if (!Api.TryGetEnabled(name, out var apiEnabled) || !apiEnabled) continue;
         GenerateEach(name, isSpecial, @static, mainModule, systemModule, keyType);
     }
 }