示例#1
0
        protected override void ExitNormalFieldStatement(NormalFieldStatement statement)
        {
            void Reduce(ICompilationUnitDictionary dictionary, CompilationUnitSyntax compilationUnit)
            {
                ClassCount++;
                PrivateParameterNumbers.Add(statement.Number);
                dictionary.Add(NewGuid(), compilationUnit);
            }

            Stack.TryReduce(
                (ref ICompilationUnitDictionary a, ProtoTypeParameterClassDeclarationCodeGenerationStrategy b) => Reduce(a, b)
                );

            Stack.TryReduce(
                (ref ICompilationUnitDictionary a, ElementParameterClassDeclarationCodeGenerationStrategy b) => Reduce(a, b)
                );

            Stack.TryReduce(
                (ref ICompilationUnitDictionary a, RestartAlgorithmsClassDeclarationCodeGenerationStrategy b) => Reduce(a, b)
                );

            Stack.TryReduce(
                (ref ICompilationUnitDictionary a, DefaultRestartAlgorithmsClassDeclarationCodeGenerationStrategy b) => Reduce(a, b)
                );
        }
        protected override void VisitNormalFieldStatement(NormalFieldStatement statement)
        {
            EnterNormalFieldStatement(statement);

            base.VisitNormalFieldStatement(statement);

            ExitNormalFieldStatement(statement);
        }
示例#3
0
        protected override void EnterNormalFieldStatement(NormalFieldStatement statement)
        {
            // For shorthand throughout.
            var x = statement;

            /* Originally was thinking there needed to be specialized cases depending on the
             * LabelKind, but at this point, I think it is just simpler to trap there here. */
            switch (x.FieldType)
            {
            case IVariant <ProtoType> _:

                // ReSharper disable once InconsistentNaming
                const string default_restart_algorithms = nameof(default_restart_algorithms);

                switch (x.Name)
                {
                case Identifier identifier when identifier.Equals(default_restart_algorithms):
                    Stack.PushBack(
                        DefaultRestartAlgorithmsClassDeclarationCodeGenerationStrategy.Create(PackageStatement, x)
                        );

                    break;

                default:
                    Stack.PushBack(
                        ProtoTypeParameterClassDeclarationCodeGenerationStrategy.Create(PackageStatement, x)
                        );
                    break;
                }

                break;

            case IVariant <ElementTypeIdentifierPath> _:

                // ReSharper disable once InconsistentNaming
                const string restart_algorithms = nameof(restart_algorithms);

                switch (x.Name)
                {
                case Identifier identifier when identifier.Equals(restart_algorithms):
                    Stack.PushBack(
                        RestartAlgorithmsClassDeclarationCodeGenerationStrategy.Create(PackageStatement, x)
                        );

                    break;

                default:
                    Stack.PushBack(
                        ElementParameterClassDeclarationCodeGenerationStrategy.Create(PackageStatement, x)
                        );
                    break;
                }

                break;
            }
        }
 internal static RestartAlgorithmsClassDeclarationCodeGenerationStrategy Create(
     PackageStatement packageStatement, NormalFieldStatement normalFieldStatement)
 => new RestartAlgorithmsClassDeclarationCodeGenerationStrategy(packageStatement, normalFieldStatement);
 private RestartAlgorithmsClassDeclarationCodeGenerationStrategy(
     PackageStatement packageStatement, NormalFieldStatement normalFieldStatement)
     : base(packageStatement, normalFieldStatement)
 {
 }
 protected abstract void ExitNormalFieldStatement(NormalFieldStatement statement);
示例#7
0
 protected RestartAlgorithmsClassDeclarationCodeGenerationStrategyBase(
     PackageStatement packageStatement, NormalFieldStatement normalFieldStatement)
     : base(packageStatement, normalFieldStatement, BaseClassSpecification.RepeatedParameter)
 {
 }
示例#8
0
 private ElementParameterClassDeclarationCodeGenerationStrategy(
     PackageStatement packageStatement, NormalFieldStatement normalFieldStatement)
     : base(packageStatement, normalFieldStatement)
 {
 }
示例#9
0
 internal static ElementParameterClassDeclarationCodeGenerationStrategy Create(
     PackageStatement packageStatement, NormalFieldStatement normalFieldStatement)
 => new ElementParameterClassDeclarationCodeGenerationStrategy(packageStatement, normalFieldStatement);