1
0
mirror of https://github.com/golang/go synced 2024-11-19 06:04:39 -07:00
go/src/text
Daniel Martí 37afd3e311 text/template/parse: simplify Tree.pipeline
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/145285
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-29 12:20:11 +00:00
..
scanner text/scanner: don't allow Float exponents with no mantissa 2018-08-20 17:01:34 +00:00
tabwriter text/tabwriter: fix BenchmarkPyramid and BenchmarkRagged again 2018-06-04 17:32:17 +00:00
template text/template/parse: simplify Tree.pipeline 2018-10-29 12:20:11 +00:00