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); }
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);
protected RestartAlgorithmsClassDeclarationCodeGenerationStrategyBase( PackageStatement packageStatement, NormalFieldStatement normalFieldStatement) : base(packageStatement, normalFieldStatement, BaseClassSpecification.RepeatedParameter) { }
private ElementParameterClassDeclarationCodeGenerationStrategy( PackageStatement packageStatement, NormalFieldStatement normalFieldStatement) : base(packageStatement, normalFieldStatement) { }
internal static ElementParameterClassDeclarationCodeGenerationStrategy Create( PackageStatement packageStatement, NormalFieldStatement normalFieldStatement) => new ElementParameterClassDeclarationCodeGenerationStrategy(packageStatement, normalFieldStatement);