diff options
| author | Ian Lance Taylor <iant@golang.org> | 2018-02-05 15:50:29 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2018-02-06 05:00:01 +0000 |
| commit | fd7331a821a6b79d5f2f82075c032ac459670d7d (patch) | |
| tree | 1cc0bc54fd8c5ca07a2fe30bd059b9a5d80cb485 /src/text/template/parse/node.go | |
| parent | f54f780d2f4ed47da4bed87c37f7219df1b9879b (diff) | |
| download | go-fd7331a821a6b79d5f2f82075c032ac459670d7d.tar.xz | |
text/template: revert CL 66410 "add break, continue actions in ranges"
The new break and continue actions do not work in html/template, and
fixing them requires thinking about security issues that seem too
tricky at this stage of the release. We will try again for 1.11.
Original CL description:
text/template: add break, continue actions in ranges
Adds the two range control actions "break" and "continue". They act the
same as the Go keywords break and continue, but are simplified in that
only the innermost range statement can be broken out of or continued.
Fixes #20531
Updates #20531
Updates #23683
Change-Id: Ia7fd3c409163e3bcb5dc42947ae90b15bdf89853
Reviewed-on: https://go-review.googlesource.com/92155
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/text/template/parse/node.go')
| -rw-r--r-- | src/text/template/parse/node.go | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/src/text/template/parse/node.go b/src/text/template/parse/node.go index 7e16349b31..55ff46c17a 100644 --- a/src/text/template/parse/node.go +++ b/src/text/template/parse/node.go @@ -69,8 +69,6 @@ const ( NodeTemplate // A template invocation action. NodeVariable // A $ variable. NodeWith // A with action. - NodeBreak // A break action. - NodeContinue // A continue action. ) // Nodes. @@ -798,68 +796,6 @@ func (r *RangeNode) Copy() Node { return r.tr.newRange(r.Pos, r.Line, r.Pipe.CopyPipe(), r.List.CopyList(), r.ElseList.CopyList()) } -// BreakNode represents a {{break}} action. -type BreakNode struct { - NodeType - Pos - tr *Tree -} - -func (t *Tree) newBreak(pos Pos) *BreakNode { - return &BreakNode{NodeType: NodeBreak, Pos: pos, tr: t} -} - -func (b *BreakNode) Type() NodeType { - return b.NodeType -} - -func (b *BreakNode) String() string { - return "{{break}}" -} - -func (b *BreakNode) Copy() Node { - return b.tr.newBreak(b.Pos) -} - -func (b *BreakNode) Position() Pos { - return b.Pos -} - -func (b *BreakNode) tree() *Tree { - return b.tr -} - -// ContinueNode represents a {{continue}} action. -type ContinueNode struct { - NodeType - Pos - tr *Tree -} - -func (t *Tree) newContinue(pos Pos) *ContinueNode { - return &ContinueNode{NodeType: NodeContinue, Pos: pos, tr: t} -} - -func (c *ContinueNode) Type() NodeType { - return c.NodeType -} - -func (c *ContinueNode) String() string { - return "{{continue}}" -} - -func (c *ContinueNode) Copy() Node { - return c.tr.newContinue(c.Pos) -} - -func (c *ContinueNode) Position() Pos { - return c.Pos -} - -func (c *ContinueNode) tree() *Tree { - return c.tr -} - // WithNode represents a {{with}} action and its commands. type WithNode struct { BranchNode |
