Skip to content

Instantly share code, notes, and snippets.

@spoenemann
Created May 24, 2017 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spoenemann/877a0eb30289b216b82ab8977eb8881e to your computer and use it in GitHub Desktop.
Save spoenemann/877a0eb30289b216b82ab8977eb8881e to your computer and use it in GitHub Desktop.
Example code that constructs a traced generator subtree
val n = trace(expression)
val receiverVar = expression.receiver?.generateExpression(n, scope)
val resultVar = scope.nextVarName
n.append(generateType(expression.feature?.type))
n.append(' ')
n.append(resultVar)
...
n.append(' = ')
n.append(receiverVar ?: 'this')
n.append('->')
n.append(feature.name)
...
n.append(';')
parent.append(n)
parent.appendNewLine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment