Ejemplo n.º 1
0
        private TypeInfo CreateEnumerationType(EnumerationDataType enumerationType)
        {
            //here enumeration has the same name as it's defining type (there will be duplication)
            //not sure this is the right approach. Doesn't it get messy with extensions?
            var typeInfo = new EnumerationTypeInfo(CurrentDeclaringSymbol);

            if (enumerationType.BasedOn != null)
            {
                throw new NotImplementedException();
            }

            if (enumerationType.IsExtensible)
            {
                throw new NotImplementedException();
            }

            foreach (var item in enumerationType.Items)
            {
                var info = new EnumerationInfo(item.Name, typeInfo);

                symbols_.Add(item, info);

                typeInfo.AddEnumeration(info);
            }

            return(typeInfo);
        }
Ejemplo n.º 2
0
        internal void AddEnumeration(EnumerationInfo enumerationInfo)
        {
            if (enumerationInfo.DeclaringType != this)
            {
                throw new InvalidOperationException();
            }

            items_.Add(enumerationInfo);
        }