You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
instruction_tree: Build source in PackedStringArray
From an efficiency point of view, repeatedly appending to an immutable
string probably involves repeatedly copying the string. (Some languages
have an optimisation where if `s` is the only reference to a string,
then `s += "foo"` modifies `s` in place; I don't know if GDScript
has that.)
From a clarity perspective, it is strange for the output buffer to be an
instance variable of the InstructionTree – it is a transient buffer used
during a call to generate_text().
Replace it with a PackedStringArray, passed through the recursive calls,
containing lines of code. Join it to produce the generated code as a
whole.
0 commit comments