Exemple #1
0
        private void RegisterTypeReader(INamedTypeSymbol symbol, string systemTypeMetadataName)
        {
            var readerMechanism = new TypeReaderMechanism(_modelBuilder, symbol, systemTypeMetadataName);

            switch (symbol.TypeKind)
            {
            case TypeKind.Class:
            case TypeKind.Delegate:
                _results.Add(new ClassReader(readerMechanism));
                break;

            case TypeKind.Interface:
                _results.Add(new InterfaceReader(readerMechanism));
                break;

            case TypeKind.Struct:
                _results.Add(new StructReader(readerMechanism));
                break;

            case TypeKind.Enum:
                _results.Add(new EnumReader(readerMechanism));
                break;

            default:
                throw new NotImplementedException($"{symbol.TypeKind} '{symbol.Name}'");
            }
        }
Exemple #2
0
 public InterfaceReader(TypeReaderMechanism mechanism)
 {
     _mechanism = mechanism;
 }
Exemple #3
0
 public ClassReader(TypeReaderMechanism mechanism)
 {
     _mechanism = mechanism;
     _mechanism.MemberBuilder.TypeKind = TypeMemberKind.Class;
 }
Exemple #4
0
 public StructReader(TypeReaderMechanism mechanism)
 {
     _mechanism = mechanism;
     _mechanism.MemberBuilder.TypeKind = TypeMemberKind.Struct;
 }
Exemple #5
0
 public EnumReader(TypeReaderMechanism mechanism)
 {
     _mechanism = mechanism;
     _mechanism.MemberBuilder.TypeKind = TypeMemberKind.Enum;
 }