LGTM On Fri, Oct 5, 2012 at 2:43 PM, <r@golang.org> wrote: > Reviewers: golang-dev_googlegroups.com, > ...
11 years, 5 months ago
(2012-10-05 22:02:39 UTC)
#2
LGTM
On Fri, Oct 5, 2012 at 2:43 PM, <r@golang.org> wrote:
> Reviewers: golang-dev_googlegroups.com,
>
> Message:
> Hello golang-dev@googlegroups.com,
>
> I'd like you to review this change to
> https://code.google.com/p/go/
>
>
> Description:
> text/template: add an unexported method to Node
> Protects the package a little against undesirable clients.
>
> Please review this at
http://codereview.appspot.com/**6624054/<http://codereview.appspot.com/6624054/>
>
> Affected files:
> M src/pkg/text/template/parse/**node.go
>
>
> Index: src/pkg/text/template/parse/**node.go
> ==============================**==============================**=======
> --- a/src/pkg/text/template/parse/**node.go
> +++ b/src/pkg/text/template/parse/**node.go
> @@ -13,7 +13,9 @@
> "strings"
> )
>
> -// A node is an element in the parse tree. The interface is trivial.
> +// A Node is an element in the parse tree. The interface is trivial.
> +// The interface contains an unexported method so that only
> +// types local to this package can satisfy it.
> type Node interface {
> Type() NodeType
> String() string
> @@ -22,6 +24,8 @@
> // CopyXxx methods that return *XxxNode.
> Copy() Node
> Position() Pos // byte position of start of node in full original
> input string
> + // Make sure only functions in this package can create Nodes.
> + unexported()
> }
>
> // NodeType identifies the type of a parse tree node.
> @@ -35,6 +39,11 @@
> return p
> }
>
> +// unexported keeps Node implementations local to the package.
> +// All implementations embed Pos, so this takes care of it.
> +func (Pos) unexported() {
> +}
> +
> // Type returns itself and provides an easy default implementation
> // for embedding in a Node. Embedded in all non-trivial Nodes.
> func (t NodeType) Type() NodeType {
>
>
>
Issue 6624054: code review 6624054: text/template: add an unexported method to Node
(Closed)
Created 11 years, 5 months ago by r
Modified 11 years, 5 months ago
Reviewers:
Base URL:
Comments: 0