static void GenerateProcessingHelpers(CodeTypeDeclaration type)
        {
            var builderFieldDef = type.AddField <StringBuilder> ("builder").WithReference(out var builder);
            var sessionFieldDef = type.AddField <IDictionary <string, object> > ("session");

            type.AddPropertyGetSet("Session", sessionFieldDef).AsVirtual();

            type.AddProperty <StringBuilder> ("GenerationEnvironment")
            .WithSet(builder)
            .WithGetLazyInitialize(builder, builderFieldDef.Type.New());

            AddErrorHelpers(type);
            AddIndentHelpers(type);
            AddWriteHelpers(type);
        }
        static void GenerateHostProperty(CodeTypeDeclaration type, Type hostType)
        {
            hostType ??= typeof(ITextTemplatingEngineHost);

            type.AddPropertyGetSet("Host", type.AddField("hostValue", TypeReference.Global(hostType)));
        }