- 08 Apr, 2011 13 commits
-
-
Russ Cox authored
R=gri CC=golang-dev https://golang.org/cl/4343047
-
Russ Cox authored
* add -diff command line option * use scoping information in refersTo, isPkgDot, isPtrPkgDot. * add new scoping-based helpers countUses, rewriteUses, assignsTo, isTopName. * rename rewrite to walk, add walkBeforeAfter. * add toy typechecker, a placeholder for go/types R=gri CC=golang-dev https://golang.org/cl/4285053
-
Russ Cox authored
Type is now an interface that implements all the possible type methods. Instead of a type switch on a reflect.Type t, switch on t.Kind(). If a method is invoked on the wrong kind of type (for example, calling t.Field(0) when t.Kind() != Struct), the call panics. There is one method renaming: t.(*ChanType).Dir() is now t.ChanDir(). Value is now a struct value that implements all the possible value methods. Instead of a type switch on a reflect.Value v, switch on v.Kind(). If a method is invoked on the wrong kind of value (for example, calling t.Recv() when t.Kind() != Chan), the call panics. Since Value is now a struct, not an interface, its zero value cannot be compared to nil. Instead of v != nil, use v.IsValid(). Instead of other uses of nil as a Value, use Value{}, the zero value. Many methods have been renamed, most due to signature conflicts: OLD NEW v.(*ArrayValue).Elem v.Index v.(*BoolValue).Get v.Bool v.(*BoolValue).Set v.SetBool v.(*ChanType).Dir v.ChanDir v.(*ChanValue).Get v.Pointer v.(*ComplexValue).Get v.Complex v.(*ComplexValue).Overflow v.OverflowComplex v.(*ComplexValue).Set v.SetComplex v.(*FloatValue).Get v.Float v.(*FloatValue).Overflow v.OverflowFloat v.(*FloatValue).Set v.SetFloat v.(*FuncValue).Get v.Pointer v.(*InterfaceValue).Get v.InterfaceData v.(*IntValue).Get v.Int v.(*IntValue).Overflow v.OverflowInt v.(*IntValue).Set v.SetInt v.(*MapValue).Elem v.MapIndex v.(*MapValue).Get v.Pointer v.(*MapValue).Keys v.MapKeys v.(*MapValue).SetElem v.SetMapIndex v.(*PtrValue).Get v.Pointer v.(*SliceValue).Elem v.Index v.(*SliceValue).Get v.Pointer v.(*StringValue).Get v.String v.(*StringValue).Set v.SetString v.(*UintValue).Get v.Uint v.(*UintValue).Overflow v.OverflowUint v.(*UintValue).Set v.SetUint v.(*UnsafePointerValue).Get v.Pointer v.(*UnsafePointerValue).Set v.SetPointer Part of the motivation for this change is to enable a more efficient implementation of Value, one that does not allocate memory during most operations. To reduce the size of the CL, this CL's implementation is a wrapper around the old API. Later CLs will make the implementation more efficient without changing the API. Other CLs to be submitted at the same time as this one add support for this change to gofix (4343047) and update the Go source tree (4353043). R=gri, iant, niemeyer, r, rog, gustavo, r2 CC=golang-dev https://golang.org/cl/4281055
-
Russ Cox authored
Rewrite only if we understood all the flags we saw. R=r CC=golang-dev https://golang.org/cl/4376046
-
Alex Brainman authored
R=golang-dev, peterGo, rsc1 CC=Joe Poirier, golang-dev https://golang.org/cl/4370048
-
Robert Griesemer authored
R=rsc CC=golang-dev https://golang.org/cl/4369050
-
Robert Griesemer authored
R=rsc CC=golang-dev https://golang.org/cl/4358043
-
Robert Griesemer authored
This CL defines a new, more Go-like representation of Go types (different structs for different types as opposed to a single Type node). It also implements an ast.Importer for object/archive files generated by the gc compiler tool chain. Besides the individual type structs, the main difference is the handling of named types: In the old world, a named type had a non-nil *Object pointer but otherwise looked no different from other types. In this new model, named types have their own representation types.Name. As a result, resolving cycles is a bit simpler during construction, at the cost of having to deal with types.Name nodes explicitly later. It remains to be seen if this is a good approach. Nevertheless, code involving types reads more nicely and benefits from full type checking. Also, the representation seems to more closely match the spec wording. Credits: The original version of the gc importer was written by Evan Shaw (chickencha@gmail.com). The new version in this CL is based largely on Evan's original code but contains bug fixes, a few simplifications, some restructuring, and was adjusted to use the new type hierarchy. I have added a comprehensive test that imports all packages found under $GOROOT/pkg (with a 3s time-out to limit the run-time of the test). Run gotest -v for details. The original version of ExportData (exportdata.go) was written by Russ Cox (rsc@golang.org). The current version is returning the internal buffer positioned at the beginning of the export data instead of printing the export data to stdout. With the new types package, the existing in-progress typechecker package is deprecated. I will delete it once all functionality has been brought over. R=eds, rog, rsc CC=golang-dev https://golang.org/cl/4314054
-
Robert Griesemer authored
R=rsc CC=golang-dev https://golang.org/cl/4373048
-
John DeNero authored
A codewalk through a simple program that illustrates several aspects of Go functions: function objects, higher-order functions, variadic functions, tail recursion, etc. The example program simulates the game of Pig, a dice game with simple rules but a nontrivial solution. R=adg, rsc, iant2, r CC=golang-dev https://golang.org/cl/4306045
-
Alex Brainman authored
R=golang-dev, rsc1 CC=golang-dev https://golang.org/cl/4366043
-
Alex Brainman authored
R=golang-dev, rsc1 CC=golang-dev, vcc https://golang.org/cl/4374044
-
Alex Brainman authored
Thanks to fhs. R=golang-dev, r2 CC=ality, fhs, golang-dev https://golang.org/cl/4375044
-
- 07 Apr, 2011 10 commits
-
-
Russ Cox authored
Fixes #1674. R=ken2 CC=golang-dev https://golang.org/cl/4368057
-
Russ Cox authored
TBR=r CC=golang-dev https://golang.org/cl/4380042
-
Russ Cox authored
R=r CC=golang-dev https://golang.org/cl/4386042
-
Mikio Hara authored
R=golang-dev, r CC=golang-dev https://golang.org/cl/4368050
-
Mikkel Krautz authored
Fixes #1658. R=rsc CC=golang-dev https://golang.org/cl/4344066
-
Mikkel Krautz authored
Fixes #1559. R=rsc CC=golang-dev, peterGo, rog https://golang.org/cl/4356046
-
Russ Cox authored
I love Python. Write once, crash anywhere. TBR=r CC=golang-dev https://golang.org/cl/4382043
-
Russ Cox authored
Right now if a Go developer makes a patch on one machine and then clpatches it onto another machine, changes subsequently made to the description are kept only locally, under the assumption that you are running clpatch because someone else wrote the CL, so you don't have permission to update the web. This change makes clpatch discard the "this was a clpatch" information from the metadata when you clpatch your own CLs from one machine to another. This should eliminate some confusion (for example in CL 4314054) but will no doubt introduce other confusion. R=golang-dev, r2 CC=golang-dev https://golang.org/cl/4387041
-
Dave Cheney authored
R=rsc CC=golang-dev https://golang.org/cl/4377043
-
Russ Cox authored
R=adg CC=golang-dev https://golang.org/cl/4385042
-
- 06 Apr, 2011 11 commits
-
-
Russ Cox authored
* tweak mksyscall*.pl to be more gofmt-compatible. * add mkall.sh -syscalls option. * add sys/mman.h constants on OS X R=r, eds, niemeyer CC=golang-dev https://golang.org/cl/4369044
-
Albert Strasheim authored
R=rsc, agl1 CC=golang-dev https://golang.org/cl/4370041
-
Russ Cox authored
Moved the details of how to read a directory and how to parse the results behind the new syscall functions ReadDirent and ParseDirent. Now os needs just one copy of Readdirnames for the three Unix variants, and it no longer imports "unsafe". R=r, r2 CC=golang-dev https://golang.org/cl/4368048
-
Rob Pike authored
relationship to os.Process. R=golang-dev, rsc1 CC=golang-dev https://golang.org/cl/4384041
-
Russ Cox authored
TBR=r CC=golang-dev https://golang.org/cl/4378042
-
Russ Cox authored
Not committed to this but it sure makes the output easier to skim. With this CL: $ make install runtime install sync/atomic install sync install unicode install utf16 install syscall install os ... install ../cmd/govet install ../cmd/goyacc install ../cmd/hgpatch $ make test test archive/tar test archive/zip test asn1 test big test bufio ... test path test path/filepath TEST FAIL reflect gotest rm -f _test/reflect.a 6g -o _gotest_.6 deepequal.go type.go value.go rm -f _test/reflect.a gopack grc _test/reflect.a _gotest_.6 all_test.go:210: invalid type assertion: reflect.NewValue(tt.i).(*StructValue) (non-interface type reflect.Value on left) all_test.go:217: cannot type switch on non-interface value v (type reflect.Value) all_test.go:218: undefined: IntValue all_test.go:221: cannot use 132 (type int) as type reflect.Value in function argument all_test.go:223: cannot use 8 (type int) as type reflect.Value in function argument all_test.go:225: cannot use 16 (type int) as type reflect.Value in function argument all_test.go:227: cannot use 32 (type int) as type reflect.Value in function argument all_test.go:229: cannot use 64 (type int) as type reflect.Value in function argument all_test.go:231: undefined: UintValue all_test.go:234: cannot use 132 (type int) as type reflect.Value in function argument all_test.go:234: too many errors gotest: "/Users/rsc/g/go/bin/6g -I _test -o _xtest_.6 all_test.go tostring_test.go" failed: exit status 1 make[1]: *** [test] Error 2 make: *** [reflect.test] Error 1 R=r, r2 CC=golang-dev https://golang.org/cl/4343046
-
Rob Pike authored
- used to be only for standard log, not for user-built. - there were no getters. Also rearrange the code a little so we can avoid allocating a buffer on every call. Logging is expensive but we should avoid unnecessary cost. This should have no effect on existing code. R=rsc CC=golang-dev https://golang.org/cl/4363045
-
Adam Langley authored
R=golang-dev, rsc1 CC=golang-dev https://golang.org/cl/4365041
-
Adam Langley authored
The CRT is symmetrical in the case of two variables and I picked a different form from PKCS#1. R=golang-dev, rsc1 CC=golang-dev https://golang.org/cl/4381041
-
Alex Brainman authored
Fixes #1107. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/4374041
-
Andrew Gerrand authored
R=bradfitz, bradfitzwork CC=golang-dev https://golang.org/cl/4368041
-
- 05 Apr, 2011 6 commits
-
-
Adam Langley authored
This speeds up private key operations by 3.5x (for a 2048-bit modulus). R=golang-dev, r, rsc1 CC=golang-dev https://golang.org/cl/4348053
-
Dmitry Chestnykh authored
R=golang-dev, agl1 CC=golang-dev https://golang.org/cl/4316057
-
Russ Cox authored
R=agl1 CC=golang-dev https://golang.org/cl/4346054
-
Rob Pike authored
R=rsc CC=golang-dev https://golang.org/cl/4339055
-
Rob Pike authored
R=golang-dev, rsc1, r2, bradfitzgo, gri CC=golang-dev https://golang.org/cl/4344068
-
Rob Pike authored
If the command couldn't be found, argv[0] would be wiped. Also, fix a print statement not to refer to make - it was a vestige of a prior form. R=rsc, gri CC=golang-dev https://golang.org/cl/4360048
-