diff options
author | Austin Clements <aclements@csail.mit.edu> | 2009-07-20 17:41:40 -0700 |
---|---|---|
committer | Austin Clements <aclements@csail.mit.edu> | 2009-07-20 17:41:40 -0700 |
commit | 97372a16273a7236466b2f09dc2a7112fb78e3db (patch) | |
tree | 139c63f8c334e89d77b4da65cd6aee2ff27ca0ab /usr/austin/eval/value.go | |
parent | 5a3adba2edfc2468c660d79c71477a02030d50d5 (diff) | |
download | golang-97372a16273a7236466b2f09dc2a7112fb78e3db.tar.gz |
Implement array types and index expressions.
Some cleanup. Elem() on PtrType is now just Elem and matches
with ArrayType. Generators now switch over the result type
instead of the operand type. Delete unused diag function.
R=rsc
APPROVED=rsc
DELTA=281 (219 added, 18 deleted, 44 changed)
OCL=31876
CL=31891
Diffstat (limited to 'usr/austin/eval/value.go')
-rw-r--r-- | usr/austin/eval/value.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/usr/austin/eval/value.go b/usr/austin/eval/value.go index 5849c16d8..7f58b55f6 100644 --- a/usr/austin/eval/value.go +++ b/usr/austin/eval/value.go @@ -442,6 +442,33 @@ func (t *stringType) value(v string) StringValue { } /* + * Array + */ + +type arrayV []Value + +func (*arrayV) Type() Type { + panic("Not implemented"); +} + +func (v *arrayV) String() string { + return fmt.Sprint(*v); +} + +func (v *arrayV) Get() ArrayValue { + return v; +} + +func (v *arrayV) Elem(i int64) Value { + return (*v)[i]; +} + +func (t *ArrayType) value(v []Value) ArrayValue { + res := arrayV(v); + return &res; +} + +/* * Pointer */ |