Ejemplo n.º 1
0
        internal CoreTypes(MetadataLoadContext loader, string?coreAssemblyName)
        {
            int numCoreTypes = (int)CoreType.NumCoreTypes;

            RoType?[]    coreTypes    = new RoType[numCoreTypes];
            Exception?[] exceptions   = new Exception[numCoreTypes];
            RoAssembly?  coreAssembly = loader.TryGetCoreAssembly(coreAssemblyName, out Exception? e);

            if (coreAssembly == null)
            {
                // If the core assembly was not found, don't continue.
                throw e !;
            }
            else
            {
                for (int i = 0; i < numCoreTypes; i++)
                {
                    ((CoreType)i).GetFullName(out byte[] ns, out byte[] name);
                    RoType?type = coreAssembly.GetTypeCore(ns, name, ignoreCase: false, out e);
                    coreTypes[i] = type;
                    if (type == null)
                    {
                        exceptions[i] = e;
                    }
                }
            }
            _coreTypes  = coreTypes;
            _exceptions = exceptions;
        }