예제 #1
0
        internal static void AddIndexerInheritanceModifierSteps(
            this List <ISourceCodeBuilderStep> steps,
            IndexerInheritanceModifier inheritanceModifer)
        {
            switch (inheritanceModifer)
            {
            case IndexerInheritanceModifier.None:
                return;

            case IndexerInheritanceModifier.New:
            case IndexerInheritanceModifier.Override:
            case IndexerInheritanceModifier.Virtual:
                steps.Add(new WriteIndexerInheritanceModifier(inheritanceModifer));
                break;

            case IndexerInheritanceModifier.NewVirtual:
                steps.Add(new WriteIndexerInheritanceModifier(IndexerInheritanceModifier.New));
                steps.Add(new WriteWhitespace());
                steps.Add(new WriteIndexerInheritanceModifier(IndexerInheritanceModifier.Virtual));
                break;

            case IndexerInheritanceModifier.SealedOverride:
                steps.Add(new WriteSealed());
                steps.Add(new WriteWhitespace());
                steps.Add(new WriteIndexerInheritanceModifier(IndexerInheritanceModifier.Override));
                break;
            }

            steps.Add(new WriteWhitespace());
        }
 public WriteIndexerInheritanceModifier(IndexerInheritanceModifier inheritanceModifier)
 {
     InheritanceModifier = inheritanceModifier;
 }
예제 #3
0
 public static SyntaxTokenList WithIndexerInheritanceModifier(
     this SyntaxTokenList tokens,
     IndexerInheritanceModifier modifier)
 {
     return(tokens.WithClassMemberInheritanceModifier(indexerModifierMap.First(entry => entry.Value == modifier).Key));
 }