aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/nodes.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2017-02-01 09:35:27 -0500
committerRuss Cox <rsc@golang.org>2017-02-01 09:47:23 -0500
commit47ce87877b1e2d4f34bb93fe6c7d88785b318cd5 (patch)
treec1ae026247c210cad5f4d3614f7763ddc103cea3 /src/cmd/compile/internal/syntax/nodes.go
parentc47df7ae171b1470f8304c6759caf68f3f37ea90 (diff)
parentec63158d7104ab6eb3765f7d4ea48744f97d9ff9 (diff)
downloadgo-47ce87877b1e2d4f34bb93fe6c7d88785b318cd5.tar.gz
go-47ce87877b1e2d4f34bb93fe6c7d88785b318cd5.zip
all: merge dev.inline into master
Change-Id: I7715581a04e513dcda9918e853fa6b1ddc703770
Diffstat (limited to 'src/cmd/compile/internal/syntax/nodes.go')
-rw-r--r--src/cmd/compile/internal/syntax/nodes.go29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/cmd/compile/internal/syntax/nodes.go b/src/cmd/compile/internal/syntax/nodes.go
index 34524e5c09..b788efb3ec 100644
--- a/src/cmd/compile/internal/syntax/nodes.go
+++ b/src/cmd/compile/internal/syntax/nodes.go
@@ -4,11 +4,13 @@
package syntax
+import "cmd/internal/src"
+
// ----------------------------------------------------------------------------
// Nodes
type Node interface {
- Line() uint32
+ Pos() src.Pos
aNode()
init(p *parser)
}
@@ -16,19 +18,18 @@ type Node interface {
type node struct {
// commented out for now since not yet used
// doc *Comment // nil means no comment(s) attached
- pos uint32
- line uint32
+ pos src.Pos
}
-func (*node) aNode() {}
-
-func (n *node) Line() uint32 {
- return n.line
+func (n *node) Pos() src.Pos {
+ return n.pos
}
+func (*node) aNode() {}
+
+// TODO(gri) we may be able to get rid of init here and in Node
func (n *node) init(p *parser) {
- n.pos = uint32(p.pos)
- n.line = uint32(p.line)
+ n.pos = p.pos()
}
// ----------------------------------------------------------------------------
@@ -38,7 +39,7 @@ func (n *node) init(p *parser) {
type File struct {
PkgName *Name
DeclList []Decl
- Lines int
+ Lines uint
node
}
@@ -103,7 +104,7 @@ type (
Type *FuncType
Body []Stmt // nil means no body (forward declaration)
Pragma Pragma // TODO(mdempsky): Cleaner solution.
- EndLine uint32 // TODO(mdempsky): Cleaner solution.
+ EndLine uint // TODO(mdempsky): Cleaner solution.
decl
}
)
@@ -143,8 +144,8 @@ type (
CompositeLit struct {
Type Expr // nil means no literal type
ElemList []Expr
- NKeys int // number of elements with keys
- EndLine uint32 // TODO(mdempsky): Cleaner solution.
+ NKeys int // number of elements with keys
+ EndLine uint // TODO(mdempsky): Cleaner solution.
expr
}
@@ -158,7 +159,7 @@ type (
FuncLit struct {
Type *FuncType
Body []Stmt
- EndLine uint32 // TODO(mdempsky): Cleaner solution.
+ EndLine uint // TODO(mdempsky): Cleaner solution.
expr
}