nitc :: CodeWriter :: defaultinit
# Store generated lines
#
# Instances are added to `file.writers` at construction.
class CodeWriter
# Parent `CodeFile`
var file: CodeFile
# Main lines of code (written at the bottom of the body)
var lines = new Array[String]
# Lines of code for declarations (written at the top of the body)
var decl_lines = new Array[String]
# Add a line in the main lines of code (to `lines`)
fun add(s: String) do self.lines.add(s)
# Add a declaration line (to `decl_lines`)
#
# Used for local and global declaration.
fun add_decl(s: String) do self.decl_lines.add(s)
init
do
file.writers.add(self)
end
end
src/compiler/abstract_compiler.nit:1293,1--1318,3