• Daniel Martí's avatar
    text/template/parse: simplify Tree.pipeline · 37afd3e3
    Daniel Martí authored
    The pipeline parsing code was unnecessarily complex. It used a for loop
    with a trailing break, a complex switch, and up to seven levels of
    indentation.
    
    Instead, drop the loop in favor of a single named goto with a comment,
    and flatten out the complex switch to be easier to follow. Two lines of
    code are now duplicated, but they're simple and only three lines apart.
    
    While at it, move the pipe initialization further up to remove the need
    for three variables.
    
    Change-Id: I07b29de195f4000336219aadeadeacaaa4285c58
    Reviewed-on: https://go-review.googlesource.com/c/145285Reviewed-by: 's avatarRob Pike <r@golang.org>
    Run-TryBot: Rob Pike <r@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    37afd3e3
parse.go 19.4 KB