public GotoNamedLabelTranslation(GotoExpression @goto, ITranslationContext context) { Type = @goto.Type; _labelName = @goto.Target.Name; TranslationSize = "goto ".Length + _labelName.Length + ";".Length; FormattingSize = context.GetControlStatementFormattingSize(); }
public TerminatedGotoTranslation( Expression @goto, string statement, ITranslationContext context) { Type = @goto.Type; _statement = statement; TranslationSize = statement.Length + ";".Length; FormattingSize = context.GetControlStatementFormattingSize(); }
public LoopTranslation(LoopExpression loop, ITranslationContext context) { Type = loop.Type; _loopBodyTranslation = context.GetCodeBlockTranslationFor(loop.Body).WithTermination().WithBraces(); TranslationSize = _loopBodyTranslation.TranslationSize + 10; FormattingSize = context.GetControlStatementFormattingSize() + // <- for 'while' context.GetKeywordFormattingSize() + // <- for 'true' _loopBodyTranslation.FormattingSize; }
private void CalculateSizes() { var translationSize = _translation.TranslationSize; var formattingSize = _translation.FormattingSize; if (_ensureReturnKeyword) { translationSize += 10; formattingSize += _context.GetControlStatementFormattingSize(); } if (_writeBraces) { translationSize += 10; } TranslationSize = translationSize; FormattingSize = formattingSize; }
public ReturnValueTranslation(GotoExpression @goto, ITranslationContext context) { _returnValueTranslation = context.GetCodeBlockTranslationFor(@goto.Value); TranslationSize = _returnValueTranslation.TranslationSize + "return ".Length; FormattingSize = context.GetControlStatementFormattingSize(); }