aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/exp/eval/scope.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2011-01-21 18:19:03 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-01-21 18:19:03 +0000
commitff5f50c52c421d75940ef9392211e3ab24d71332 (patch)
tree27d8768fb1d25696d3c40b42535eb5e073c278da /libgo/go/exp/eval/scope.go
parentd6ed1c8903e728f4233122554bab5910853338bd (diff)
downloadgcc-ff5f50c52c421d75940ef9392211e3ab24d71332.zip
gcc-ff5f50c52c421d75940ef9392211e3ab24d71332.tar.gz
gcc-ff5f50c52c421d75940ef9392211e3ab24d71332.tar.bz2
Remove the types float and complex.
Update to current version of Go library. Update testsuite for removed types. * go-lang.c (go_langhook_init): Omit float_type_size when calling go_create_gogo. * go-c.h: Update declaration of go_create_gogo. From-SVN: r169098
Diffstat (limited to 'libgo/go/exp/eval/scope.go')
-rw-r--r--libgo/go/exp/eval/scope.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/libgo/go/exp/eval/scope.go b/libgo/go/exp/eval/scope.go
index 8eee38e..66305de 100644
--- a/libgo/go/exp/eval/scope.go
+++ b/libgo/go/exp/eval/scope.go
@@ -15,11 +15,11 @@ import (
// A definition can be a *Variable, *Constant, or Type.
type Def interface {
- Pos() token.Position
+ Pos() token.Pos
}
type Variable struct {
- token.Position
+ VarPos token.Pos
// Index of this variable in the Frame structure
Index int
// Static type of this variable
@@ -30,10 +30,18 @@ type Variable struct {
Init Value
}
+func (v *Variable) Pos() token.Pos {
+ return v.VarPos
+}
+
type Constant struct {
- token.Position
- Type Type
- Value Value
+ ConstPos token.Pos
+ Type Type
+ Value Value
+}
+
+func (c *Constant) Pos() token.Pos {
+ return c.ConstPos
}
// A block represents a definition block in which a name may not be
@@ -111,12 +119,12 @@ func (b *block) ChildScope() *Scope {
return sub.scope
}
-func (b *block) DefineVar(name string, pos token.Position, t Type) (*Variable, Def) {
+func (b *block) DefineVar(name string, pos token.Pos, t Type) (*Variable, Def) {
if prev, ok := b.defs[name]; ok {
return nil, prev
}
v := b.defineSlot(t, false)
- v.Position = pos
+ v.VarPos = pos
b.defs[name] = v
return v, nil
}
@@ -135,11 +143,11 @@ func (b *block) defineSlot(t Type, temp bool) *Variable {
b.scope.maxVars = index + 1
}
}
- v := &Variable{token.Position{}, index, t, nil}
+ v := &Variable{token.NoPos, index, t, nil}
return v
}
-func (b *block) DefineConst(name string, pos token.Position, t Type, v Value) (*Constant, Def) {
+func (b *block) DefineConst(name string, pos token.Pos, t Type, v Value) (*Constant, Def) {
if prev, ok := b.defs[name]; ok {
return nil, prev
}
@@ -148,7 +156,7 @@ func (b *block) DefineConst(name string, pos token.Position, t Type, v Value) (*
return c, nil
}
-func (b *block) DefineType(name string, pos token.Position, t Type) Type {
+func (b *block) DefineType(name string, pos token.Pos, t Type) Type {
if _, ok := b.defs[name]; ok {
return nil
}