Beispiel #1
0
        public void WriteTo(TranslationBuffer buffer)
        {
            if (_hasVariables)
            {
                foreach (var parametersByType in _variables)
                {
                    parametersByType.Key.WriteTo(buffer);
                    buffer.WriteSpaceToTranslation();
                    parametersByType.Value.WriteTo(buffer);
                    buffer.WriteToTranslation(';');
                    buffer.WriteNewLineToTranslation();
                }

                switch (_statements[0].NodeType)
                {
                case Conditional when !ConditionalTranslation.IsTernary(_statements[0].Expression):
                case Switch:
                    buffer.WriteNewLineToTranslation();
                    break;
                }
            }

            for (var i = 0; ;)
            {
                _statements[i].WriteTo(buffer);

                if (++i == _statementCount)
                {
                    break;
                }

                buffer.WriteNewLineToTranslation();
            }
        }
Beispiel #2
0
 private bool WriteBlankLineBefore()
 {
     return((NodeType == Label) ||
            ((NodeType == Conditional) && !ConditionalTranslation.IsTernary(Expression)));
 }