Skip to content

Commit

Permalink
Go: add a couple of words to document some variables and overridable …
Browse files Browse the repository at this point in the history
…methods
  • Loading branch information
Mingun committed Apr 20, 2024
1 parent 2191070 commit db49bf5
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class GoTranslator(out: StringLanguageOutputWriter, provider: TypeProvider, impo

import io.kaitai.struct.languages.GoCompiler._

/**
* Dummy return value that should be returned in case of error just because
* we cannot return nothing.
*/
var returnRes: Option[String] = None

override def translate(v: Ast.expr, extPrec: Int): String = resToStr(translateExpr(v, extPrec))
Expand Down Expand Up @@ -521,6 +525,10 @@ class GoTranslator(out: StringLanguageOutputWriter, provider: TypeProvider, impo

def localVarName(n: Int) = s"tmp$n"

/**
* Puts to the output code to check variable `err` for error value and emit
* a premature return with value of error.
*/
def outAddErrCheck(): Unit = {
out.puts("if err != nil {")
out.inc
Expand Down

0 comments on commit db49bf5

Please sign in to comment.