summaryrefslogtreecommitdiff
path: root/src/pkg/go/ast/scope.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/go/ast/scope.go')
-rw-r--r--src/pkg/go/ast/scope.go11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/pkg/go/ast/scope.go b/src/pkg/go/ast/scope.go
index b966f786f..92e366980 100644
--- a/src/pkg/go/ast/scope.go
+++ b/src/pkg/go/ast/scope.go
@@ -12,7 +12,6 @@ import (
"go/token"
)
-
// A Scope maintains the set of named language entities declared
// in the scope and a link to the immediately surrounding (outer)
// scope.
@@ -22,14 +21,12 @@ type Scope struct {
Objects map[string]*Object
}
-
// NewScope creates a new scope nested in the outer scope.
func NewScope(outer *Scope) *Scope {
const n = 4 // initial scope capacity
return &Scope{outer, make(map[string]*Object, n)}
}
-
// Lookup returns the object with the given name if it is
// found in scope s, otherwise it returns nil. Outer scopes
// are ignored.
@@ -38,7 +35,6 @@ func (s *Scope) Lookup(name string) *Object {
return s.Objects[name]
}
-
// Insert attempts to insert a named object obj into the scope s.
// If the scope already contains an object alt with the same name,
// Insert leaves the scope unchanged and returns alt. Otherwise
@@ -51,7 +47,6 @@ func (s *Scope) Insert(obj *Object) (alt *Object) {
return
}
-
// Debugging support
func (s *Scope) String() string {
var buf bytes.Buffer
@@ -66,7 +61,6 @@ func (s *Scope) String() string {
return buf.String()
}
-
// ----------------------------------------------------------------------------
// Objects
@@ -91,13 +85,11 @@ type Object struct {
Type interface{} // place holder for type information; may be nil
}
-
// NewObj creates a new object of a given kind and name.
func NewObj(kind ObjKind, name string) *Object {
return &Object{Kind: kind, Name: name}
}
-
// Pos computes the source position of the declaration of an object name.
// The result may be an invalid position if it cannot be computed
// (obj.Decl may be nil or not correct).
@@ -137,7 +129,6 @@ func (obj *Object) Pos() token.Pos {
return token.NoPos
}
-
// ObKind describes what an object represents.
type ObjKind int
@@ -152,7 +143,6 @@ const (
Lbl // label
)
-
var objKindStrings = [...]string{
Bad: "bad",
Pkg: "package",
@@ -163,5 +153,4 @@ var objKindStrings = [...]string{
Lbl: "label",
}
-
func (kind ObjKind) String() string { return objKindStrings[kind] }