Robert Griesemer [Tue, 7 Jul 2009 17:03:42 +0000 (10:03 -0700)]
- removed implementation restrictions for creation of small
Natural, Integer, and Rational numbers
- added Value() methods to access small Natural and Integers
as uint64 or int64 respectively, and to get the components
of Rational numbers
- fixed a bug with Integer creation
- removed some _'s from names
- added more comments in places
- added test cases
* give genwrapper and genembedtramp the same signature.
* move duint8, duint16, duint32, duint64, duintptr into gc.
* tidy genwrapper.
* bug involving struct field symbols in signature list.
(hash-order dependent so hard to trigger)
* new Type print format %#-T like %#T but omits
names on function arguments.
new reflect library data structures and code declarations
* use structs instead of interfaces
* compiler lays out data structures ahead of time,
so no more parsing of strings.
* unified reflect data structures with interface
runtime data structures.
* richer data structures should enable reflection
on chans and maps, but not implemented here.
Robert Griesemer [Mon, 6 Jul 2009 18:39:48 +0000 (11:39 -0700)]
- bug fix: do not strip lower-case parameter and result names in signatures
- display: show '...' if a struct/interface has fields/methods removed; show
struct/interface w/o {}'s if all fields/methods were removed; and show the
{}'s if the struct/interface was empty to begin with
Robert Griesemer [Mon, 6 Jul 2009 17:37:33 +0000 (10:37 -0700)]
- ast.FilterExports: strips all non-exported nodes from an AST
- use FilterExports instead of the various predicates in printer.go and doc.go
which simplifies a lot of code and makes it easier to deal with complex cases
Ian Lance Taylor [Thu, 2 Jul 2009 22:54:57 +0000 (15:54 -0700)]
Recognize gccgo error messages.
(Amusing side note: the GNU coding standards say: Please do
not use the term "illegal" to refer to erroneous input to a
computer program. Please use "invalid" for this, and reserve
the term "illegal" for activities prohibited by law.)
indirect1.go:35:3: error: argument must be string or array or slice or map
indirect1.go:36:3: error: argument must be string or array or slice or map
indirect1.go:38:3: error: argument must be string or array or slice or map
indirect1.go:41:3: error: argument must be string or array or slice or map
indirect1.go:42:3: error: argument must be string or array or slice or map
indirect1.go:44:3: error: argument must be string or array or slice or map
indirect1.go:55:3: error: argument must be string or array or slice or map
indirect1.go:56:3: error: argument must be string or array or slice or map
indirect1.go:58:3: error: argument must be string or array or slice or map
indirect1.go:61:3: error: argument must be array or slice
indirect1.go:62:3: error: argument must be array or slice
indirect1.go:64:3: error: argument must be array or slice
Rob Pike [Thu, 2 Jul 2009 16:22:30 +0000 (09:22 -0700)]
simplify decoders. error checking is done higher up.
if there is an error, we will write one more value into the struct but in return
we do fewer tests in the decode.
in preparation for changing 6g's behavior to
align the output args separately from the input args,
change cgo2c to insert the necessary padding
when the two arg lists are concatenated in the c
translation.
for example, there is a runtime
func indexstring(s string, i int32) (b byte)
right now in 6g those arguments are aligned in one
struct with s at offset 0, i at 16, and b at 20.
soon the b byte will be in its own struct and structs
are 8 aligned, so it will be b at 24.
right now cgo2c generates:
void indexstring(string s, int32 i, byte b)
this CL makes it generate, in --6g mode:
void indexstring(string s, int32 i, uint32, byte b)
this is valid 6c input, although not valid gcc input.
(the code is being generated for 6c only anyway.)
also, allow C code to be mixed in among the Go funcs.
every instance of the token `func' is expected to start
a new go func.
Russ Cox [Mon, 29 Jun 2009 22:13:37 +0000 (15:13 -0700)]
allow forward declaration of struct in another file
(in the same package).
allow forward method declaration to be satisfied
by implementation in another file (in the same package).
all methods must be declared in the same file
as the receiver type.
Kai Backman [Sat, 27 Jun 2009 05:04:30 +0000 (22:04 -0700)]
working on bgen
- removed smallint optimizations
- lifted raddr from 5c
- add back %R, was used in gc/* causing -g to crash
- changed naddr OREGISTER to emit D_REG instead of D_OREG
Rob Pike [Sat, 27 Jun 2009 03:28:41 +0000 (20:28 -0700)]
Getenv: almost no one wants the error, so make it return a string that may be empty.
Getenverror is the new name for the old routine that returns an error too.
Rob Pike [Sat, 27 Jun 2009 03:28:06 +0000 (20:28 -0700)]
the first time a structure type appears when printing, identify it by name:
type Foo struct { a int; next *Foo }
produces
"Foo = struct { a int; next Foo }"
Russ Cox [Thu, 25 Jun 2009 23:32:33 +0000 (16:32 -0700)]
better error; clean up lineno in a few places
wreck.mtv=; cat x.go
package main
var x = string.Split()
wreck.mtv=; 6g x.go
x.go:2: type string used as expression
x.go:2: undefined DOT Split on string
x.go:3: illegal types for operand: AS
undefined
wreck.mtv=;
Russ Cox [Thu, 25 Jun 2009 23:22:46 +0000 (16:22 -0700)]
disable "any" except during canned imports.
new flag -A enables it during mkbuiltin.
avoids mysterious errors in programs
that refer to any accidentally.
Russ Cox [Thu, 25 Jun 2009 21:43:55 +0000 (14:43 -0700)]
Allow indexing of slice types, but not pointer to slice type.
Allow indexing of string type, but not pointer to string type.
Do not allow indexing of pointer to map type.