コード例 #1
0
        void IGenerator.GetText(Scope keyScope, TextWriter writer, Scope contextScope)
        {
            Dictionary <string, object> arguments = _arguments.GetArguments(keyScope, contextScope);
            IEnumerable <NestedContext> contexts  = _definition.GetChildContext(writer, keyScope, arguments, contextScope);
            List <IGenerator>           generators;

            if (_definition.ShouldGeneratePrimaryGroup(arguments))
            {
                generators = _primaryGenerators;
            }
            else
            {
                generators = new List <IGenerator>();
                if (_subGenerator != null)
                {
                    generators.Add(_subGenerator);
                }
            }
            foreach (NestedContext context in contexts)
            {
                foreach (IGenerator generator in generators)
                {
                    generator.GetText(context.KeyScope ?? keyScope, context.Writer ?? writer, context.ContextScope);
                    if (context.WriterNeedsConsidated)
                    {
                        writer.Write(_definition.ConsolidateWriter(context.Writer ?? writer, arguments));
                    }
                }
            }
        }
コード例 #2
0
        void IGenerator.GetText(Scope scope, TextWriter writer, Scope context)
        {
            Dictionary <string, object> arguments;

            if (_definition.IsSetter)
            {
                arguments = _arguments.GetArgumentKeyNames();
            }
            else
            {
                arguments = _arguments.GetArguments(scope, context);
            }
            _definition.GetText(writer, arguments, context);
        }