private static ClassFieldModifier ToClassFieldModifier(StructFieldModifier modifier)
        {
            switch (modifier)
            {
            case StructFieldModifier.None:
                return(ClassFieldModifier.None);

            case StructFieldModifier.ReadOnly:
                return(ClassFieldModifier.ReadOnly);

            case StructFieldModifier.Static:
                return(ClassFieldModifier.Static);

            case StructFieldModifier.StaticReadOnly:
                return(ClassFieldModifier.StaticReadOnly);

            case StructFieldModifier.StaticVolatile:
                return(ClassFieldModifier.StaticVolatile);

            case StructFieldModifier.Volatile:
                return(ClassFieldModifier.Volatile);

            default:
                throw new NotSupportedException();
            }
        }
 public WriteStructFieldModifier(StructFieldModifier modifier)
 {
     Modifier = modifier;
 }
Exemplo n.º 3
0
        internal static void AddStructFieldModifierSteps(this List <ISourceCodeBuilderStep> steps, StructFieldModifier modifier)
        {
            switch (modifier)
            {
            case StructFieldModifier.None:
                return;

            case StructFieldModifier.StaticReadOnly:
                steps.Add(new WriteStructFieldModifier(StructFieldModifier.Static));
                steps.Add(new WriteWhitespace());
                steps.Add(new WriteStructFieldModifier(StructFieldModifier.ReadOnly));
                break;

            case StructFieldModifier.StaticVolatile:
                steps.Add(new WriteStructFieldModifier(StructFieldModifier.Static));
                steps.Add(new WriteWhitespace());
                steps.Add(new WriteStructFieldModifier(StructFieldModifier.Volatile));
                break;

            default:
                steps.Add(new WriteStructFieldModifier(modifier));
                break;
            }

            steps.Add(new WriteWhitespace());
        }