1
0
mirror of https://github.com/golang/go synced 2024-10-04 07:21:22 -06:00
Commit Graph

642 Commits

Author SHA1 Message Date
Ken Thompson
64c3fe05bf string([]int) conversion
R=r
OCL=29466
CL=29466
2009-05-27 15:38:02 -07:00
Russ Cox
18890eebbf fix bug154; tweak bug153 exit status
R=ken
OCL=29448
CL=29448
2009-05-27 10:16:13 -07:00
Russ Cox
a8e4ed6a3d 8g: 64-bit arithmetic and assorted bug fixes;
can run 64-bit sieve and powser.
interfaces are limping along.
next hurdle is floating point.

R=ken
OCL=29418
CL=29423
2009-05-26 21:07:26 -07:00
Ken Thompson
b46e7c4d3c bug 152
R=r
OCL=29419
CL=29419
2009-05-26 19:48:39 -07:00
Ken Thompson
51ddddc67e bug 151
R=r
OCL=29409
CL=29409
2009-05-26 16:30:35 -07:00
Ken Thompson
850cd6a2fe bug 150
R=r
OCL=29405
CL=29405
2009-05-26 15:56:37 -07:00
Russ Cox
021abfbd28 8g: hello world works again
* string format changed
	* files got renamed
	* new files that i forgot to check in last time
updates are all copy and paste from 6g

R=ken
OCL=29385
CL=29400
2009-05-26 14:46:06 -07:00
Ken Thompson
802e1a6104 static init reenabled
R=r
OCL=29358
CL=29358
2009-05-25 19:40:41 -07:00
Ken Thompson
4238b18344 1. check for dups in complex literals
structtype{a:1, a:2}
   maptypetype{"xx":1, "xx":2}
   arraytypetype{5:1, 5:2}
2. bug in registerization concerning
   alias of a struct and one of its elements
3. code optimization of struct.field
   (which exposed bug in 2)

R=r
OCL=29315
CL=29315
2009-05-23 15:34:29 -07:00
Russ Cox
4beac9985b simplifying grammar: delete LBASETYPE and LACONST.
take 2

R=ken
OCL=29304
CL=29306
2009-05-22 22:46:06 -07:00
Russ Cox
ca2fe5d8bd Automated g4 rollback of changelist 29302.
*** Reason for rollback ***

too many files included

*** Original change description ***

simplifying grammar: delete LBASETYPE and LACONST

R=ken
OCL=29303
CL=29303
2009-05-22 22:43:57 -07:00
Russ Cox
2a4dcfffc9 simplifying grammar: delete LBASETYPE and LACONST
R=ken
OCL=29300
CL=29302
2009-05-22 22:42:12 -07:00
Russ Cox
f4d3d22a94 enforce channel direction
R=ken
OCL=29209
CL=29216
2009-05-21 17:32:44 -07:00
Russ Cox
c2fa45b973 allow type name as key to accomodate anonymous fields.
update tests.

R=ken
OCL=29207
CL=29207
2009-05-21 16:31:10 -07:00
Ken Thompson
bba10b3f49 some array init bugs
renamed 6g/(gen|align|obj).c

R=r
OCL=29205
CL=29205
2009-05-21 15:44:06 -07:00
Russ Cox
8b6b380605 stricter rules for assignment.
when assigning a multifield object
(structs or arrays of structs) they
must not contain any fields that could
not be assigned individually.

R=ken
OCL=29192
CL=29194
2009-05-21 14:06:24 -07:00
Ken Thompson
a016081f43 added key:val extension to
structure and array literals

R=r
OCL=29190
CL=29190
2009-05-21 13:46:07 -07:00
Russ Cox
23e62d169f stricter interface conversion rule: i.(T)
must have non-nil i.

R=ken
OCL=29136
CL=29136
2009-05-20 18:23:19 -07:00
Russ Cox
a39bae095a ifaceop was being called with integers
that came from two different enums.
spilt into ifacecvt and ifaceop depending
on which enum the argument is.

R=ken
OCL=29122
CL=29122
2009-05-20 15:09:50 -07:00
Russ Cox
2da5022bcf change representation of interface values.
this is not a user-visible change.

before, all interface values were

	struct Itype {
		Sigt *type;
		Sigi *inter;
		void *method[n];
	}

	struct Iface {
		void *addr;
		Itype *itype;
	}

the itype is basically a vtable, but it's unnecessary
if the static type is interface{ }.
for interface values with static type empty, the
new representation is

	struct Eface {
		void *addr;
		Sigt *type;
	}

this complicates the code somewhat, but
it reduces the number of Itypes that
have to be computed and cached,
it opens up opportunities to avoid function
calls in a few common cases,
and it will make it possible to lay out
interface{} values at compile time,
which i think i'll need for the new reflection.

R=ken
OCL=28701
CL=29121
2009-05-20 14:57:55 -07:00
Russ Cox
47e5152790 fix implicit star for range on *map, *[].
do not update lineno from ONAME nodes,
	because they have declaration lineno not use.
show actual name in top-level statement error.

before
runtime.a:7: x.go:5: walkstate: NAME not a top level statement

after
x.go:14: walkstate: runtime.Goexit not a top level statement

R=ken
OCL=29113
CL=29116
2009-05-20 14:24:23 -07:00
Ken Thompson
b91a043d02 static initialization of slices
R=r
OCL=29016
CL=29016
2009-05-18 22:11:22 -07:00
Ken Thompson
62231e91d0 static initialization with DATA statements
structs and arrays are done
slices and maps are yet to do

R=r
OCL=28977
CL=28977
2009-05-17 19:16:16 -07:00
Ken Thompson
52b0f77bf9 static initialization
structure set up - no change yet

R=r
OCL=28966
CL=28966
2009-05-16 13:29:08 -07:00
Rob Pike
a8db4593ab fix spelling error in message
R=ken
OCL=28814
CL=28814
2009-05-14 09:59:16 -07:00
Russ Cox
d06a79e31b no need for compiler to hard-code definition of runtime.
use the actual go source instead.

R=r
DELTA=90  (66 added, 18 deleted, 6 changed)
OCL=28708
CL=28719
2009-05-12 16:15:52 -07:00
Russ Cox
b3533dfd72 6g:
new type equality restrictions
	better handling of renamed packages
	"sys" is no longer available to programs

R=ken
OCL=28553
CL=28578
2009-05-08 15:40:31 -07:00
Russ Cox
918afd9491 move things out of sys into os and runtime
R=r
OCL=28569
CL=28573
2009-05-08 15:21:41 -07:00
Rob Pike
c367d1b789 Move sys.Reflect and sys.Unreflect into unsafe.
R=rsc
DELTA=19  (4 added, 5 deleted, 10 changed)
OCL=28563
CL=28566
2009-05-08 14:57:56 -07:00
Russ Cox
d4fa253837 eqtype(t1, t2, 0) => eqtype(t1, t2)
R=ken
OCL=28559
CL=28562
2009-05-08 14:40:38 -07:00
Russ Cox
401a95aa83 if a struct s contains an anonymous interface value
with method m, s.m() is ok and m now shows up
in s's method set for interface runtime.

see http://cl/28419-p2 for new test interface10.go.

R=ken
OCL=28420
CL=28423
2009-05-07 13:42:47 -07:00
Russ Cox
88a1aa8e1a 6g: error messages
part 2; missing files

R=ken
OCL=28408
CL=28410
2009-05-07 10:30:22 -07:00
Russ Cox
b5e212ffdd 6g: error messages
replace "shape error across CALL" with more information.

x.go:7: not enough arguments to CALL
	a int, b int
	int
x.go:10: assignment count mismatch: 3 = 2
x.go:12: too many arguments to RETURN
	[no arguments expected]
	int, int, int

also leave type alone after conversion failure,
for later errors:

bug049.go:6: cannot convert nil constant to string
bug049.go:6: illegal types for operand: EQ
	string
	nil		# this used to be blank

R=ken
OCL=28405
CL=28407
2009-05-07 10:29:35 -07:00
Russ Cox
a6ba5ec535 6g: new interface rules (code got simpler!)
R=ken
OCL=28374
CL=28378
2009-05-06 17:05:35 -07:00
Russ Cox
83cd4ee070 6g: generate string data as individual symbols,
so that 6l can discard strings used by dead code.
also, for short strings, generate DUPOK global
symbols so that references to, say, "%s: %s" in
multiple files result in only a single symbol.

R=ken
OCL=28361
CL=28361
2009-05-06 13:47:40 -07:00
Ken Thompson
c4de24981a signs on div and mod
R=r
OCL=28319
CL=28319
2009-05-05 21:19:58 -07:00
Russ Cox
3e9b171b79 6g bug: was dropping assignment of nil to globals
R=ken
OCL=28314
CL=28314
2009-05-05 17:33:51 -07:00
Russ Cox
f821e3c7c3 6g tweaks
* byteastring is no longer used
	* do not generate ODCL, OAS for globals
	  (wasn't generating any code but might
	  save one or two init functions)
	* do not call self from Init function

R=ken
OCL=28309
CL=28309
2009-05-05 16:53:46 -07:00
Ken Thompson
567a7bf664 more code optimization
1. dont clear external and heap objects
2. propagate constant assignment

R=r
OCL=28254
CL=28254
2009-05-04 21:48:46 -07:00
Ken Thompson
49f7494894 code optmization
drip init function if it doesnt do anything

R=r
OCL=28180
CL=28180
2009-05-01 18:55:16 -07:00
Russ Cox
83e976d53e bug146: array/slice conversion before I left missed conversions
R=ken
OCL=28120
CL=28124
2009-04-30 13:49:58 -07:00
Ken Thompson
7a98315c96 allow "defer close(chan)"
bug found by anton

R=r
OCL=28001
CL=28001
2009-04-28 17:20:18 -07:00
Ken Thompson
ad36c39211 bug 145
R=r
OCL=27979
CL=27979
2009-04-28 12:28:31 -07:00
Ken Thompson
b03b541b7a recognize a defined constant
as a new name in a later declaration
(bug 144)

R=r
OCL=27850
CL=27850
2009-04-24 16:43:31 -07:00
Ken Thompson
190a540892 2 minor bugs.
lv context for some [] operations
calling implicit(*map) before walk.

R=r
OCL=27706
CL=27706
2009-04-21 19:52:13 -07:00
Ken Thompson
b5e7562191 supply default indirection to
map indexing - bug 143

R=r
OCL=27695
CL=27695
2009-04-21 17:00:08 -07:00
Ken Thompson
34b6f642de mixed old/new declaration
exact spec:
a) must be a multi-assignment w :=
b) a proper subset of the lhs
   can be declared in same block
   with the same type with no
   "redeclaration" error

R=r
OCL=27610
CL=27610
2009-04-18 13:58:04 -07:00
Russ Cox
3ea8d854a3 make string(array) take []byte only (and thus *[10]byte but not [10]byte)
R=ken
OCL=27581
CL=27585
2009-04-16 23:07:30 -07:00
Russ Cox
1cb3b7d124 panicln: emit just one newline
R=ken
OCL=27537
CL=27545
2009-04-15 22:38:09 -07:00
Russ Cox
65d397f747 compiler implementation of array slice change
R=ken
OCL=27533
CL=27533
2009-04-15 20:27:22 -07:00
Russ Cox
935953a9f8 tweak interface warning heuristic.
some day i will fix this for real.

R=ken
OCL=27468
CL=27468
2009-04-14 19:57:27 -07:00
Russ Cox
a62467af93 fix stringrange test
R=ken
OCL=27353
CL=27353
2009-04-13 05:31:44 -07:00
Ken Thompson
a91a8042b4 range over strings
R=r
OCL=27332
CL=27332
2009-04-10 19:49:31 -07:00
Ken Thompson
3657061550 change representation of strings
R=r
OCL=27293
CL=27293
2009-04-09 18:16:21 -07:00
Russ Cox
f95da9a639 yet another attempt at auto-linking
store only the original import path string (+ .a)
if 6g resolves it to an archive file.
let 6l re-resolve the .a at link time.

this lets libraries build against an archive
in the current directory but get used
against an installed archive.

R=r
OCL=27244
CL=27244
2009-04-08 22:45:33 -07:00
Russ Cox
3067781ab9 func f() (int, int);
x := f();

used to give
	fatal error: dowidth fn struct struct { int; int }

now gives
	assignment count mismatch: 1 = 2

R=ken
OCL=27198
CL=27201
2009-04-07 22:20:37 -07:00
Russ Cox
d50c70d261 set line number for errors produced during walkstate.
R=ken
OCL=27145
CL=27145
2009-04-06 22:17:46 -07:00
Russ Cox
907cb4f1e6 fix both of anton's bugs:
* make([100]int) was being compiled to
	make([]int), kind of.
* []this = [100]that was working for any this, that.

turned up a typo in pipe_test.go

R=ken
OCL=27081
CL=27081
2009-04-03 23:20:51 -07:00
Russ Cox
39436f2a74 special case check for this situation
; cat >http.go
	package main
	import "http"  // intended the library, not this file
	^D
	; 6g http.go
	; 6g http.go
	http.go:4: export/package mismatch: init
	;

new error:

	http.6:7 http.go:3: cannot import package main

R=ken
OCL=27053
CL=27053
2009-04-02 21:46:19 -07:00
Russ Cox
07687705a4 type n t;
was copying a bit too much about t into n,
like whether the signature was queued to be printed.
(bug reported by anton)

was also editing t, meaning you could do
	type T int;
	func (p int) Meth() { }

both fixed.

R=ken
OCL=27052
CL=27052
2009-04-02 21:38:11 -07:00
Russ Cox
416b27548e use _f007·filename for func literals.
this avoids problems people have run into with
multiple closures in the same package.

when preparing filename, only cut off .go, not .anything.
this fixes a bug tgs ran into with foo.pb.go and foo.go
in the same package.

also turn bad identifier chars from filename into
underscores: a-b.pb.go => a_b_pb

R=ken
OCL=27050
CL=27050
2009-04-02 18:32:57 -07:00
Ken Thompson
9efd6b8a3d compiler falut for forgetting
the assignment on a type switch

R=r
OCL=27048
CL=27048
2009-04-02 18:06:43 -07:00
Russ Cox
58f5f4f18d use separate lex buf for better errors:
package main
func main() { func(){}() + + }

x.go:2: syntax error near _f001

becomes

x.go:2: syntax error near func

R=ken
OCL=27047
CL=27047
2009-04-02 17:59:09 -07:00
Russ Cox
6b07021a2b implement some more 8g
package main
	func main() {
		println("hello,", 123);
	}

R=ken
OCL=27043
CL=27043
2009-04-02 16:48:06 -07:00
Ken Thompson
2450c590e9 typeswitch - expression evaluated
twice instead of once.

R=r
OCL=27015
CL=27015
2009-04-01 21:28:59 -07:00
Russ Cox
aacdc25399 fix http://b/1748082
package main
var f = func(a, b int) int { return a + b }

R=ken
OCL=26935
CL=26935
2009-03-30 22:26:00 -07:00
Russ Cox
5e792b6c09 move portable object routines (especially
signature generation) into gc.

R=ken
OCL=26933
CL=26933
2009-03-30 21:31:29 -07:00
Russ Cox
941ed00b1d closure bug: carry along outnamed flag.
R=ken
OCL=26930
CL=26930
2009-03-30 19:21:36 -07:00
Russ Cox
bac922c6e1 move portable code generation (basic statements) to gc.
R=ken
OCL=26929
CL=26929
2009-03-30 19:15:07 -07:00
Russ Cox
d30285a6f5 move some portable pieces of 6g/gsubr.c into gc/subr.c
int	brcom(int);
	int	brrev(int);
	void	setmaxarg(Type*);
	Sig*	lsort(Sig*, int(*)(Sig*, Sig*));
	int	dotoffset(Node*, int*, Node**);
	void	stringpool(Node*);
	void	tempname(Node*, Type*);

R=ken
OCL=26922
CL=26922
2009-03-30 17:52:21 -07:00
Russ Cox
8e54729b5a move alignment calculations into gc
R=ken
OCL=26914
CL=26914
2009-03-30 17:09:28 -07:00
Russ Cox
e224b1ebdb don't crash on
unsafe.Alignof(struct{x float}{0}.x)

R=ken
OCL=26911
CL=26913
2009-03-30 17:07:30 -07:00
Russ Cox
531f242f5d move bits.c from 6g to gc
R=ken
OCL=26909
CL=26909
2009-03-30 16:13:11 -07:00
Russ Cox
a2cbc2998d don't write cmp's output to the c file.
cope better with p4 not found.

R=r
DELTA=3  (0 added, 0 deleted, 3 changed)
OCL=26877
CL=26879
2009-03-30 00:12:56 -07:00
Ken Thompson
b8be809c10 ^ type(const) now inverts "enough" bits
^ signed(const) becomes illegal
^ unsigned(const) becomes legal

R=r
OCL=26697
CL=26697
2009-03-24 16:40:38 -07:00
Russ Cox
5a68303a15 throw away most of the compat.h compatibility layer
in favor of the lib9 compatibility layer.  no need for two.

now that mycreate is gone, .6 files are 0644 not 0755.

TBR=r
OCL=26679
CL=26679
2009-03-24 12:12:57 -07:00
Ken Thompson
79fa5b65cb rewrote switch
fixed bug 141

R=r
OCL=26627
CL=26627
2009-03-22 20:54:21 -07:00
Russ Cox
54aa835b44 range over channels.
also fix multiple-evaluation bug in range over arrays.

R=ken
OCL=26576
CL=26576
2009-03-20 11:32:58 -07:00
Russ Cox
f7772627ad fix b/1722502
BUG=1722502
R=ken
OCL=26526
CL=26526
2009-03-18 19:20:54 -07:00
Ken Thompson
1cdcfda140 remove assignment cases from switch
R=r
OCL=26480
CL=26480
2009-03-18 12:13:42 -07:00
Ken Thompson
1e0c17e294 switch on false error
R=r
OCL=26434
CL=26434
2009-03-17 19:10:32 -07:00
Ken Thompson
0f469a99a3 binary search on type switches.
new feature 'case nil:' in type switch
will match iff the interface is nil.

R=r
OCL=26404
CL=26404
2009-03-17 13:58:38 -07:00
Ken Thompson
5136a9e1f7 change format of Sigt and Sigi
to allow room for type hash
needed for log-time type switch.

R=r
OCL=26354
CL=26354
2009-03-16 15:27:08 -07:00
Russ Cox
5fbadf0bc3 warn -> yyerror in mparith.
close two more bugs.

R=ken
OCL=26226
CL=26226
2009-03-12 19:57:30 -07:00
Russ Cox
8f194bf5ff make 6g constants behave as ken proposes. (i hope.)
various bug fixes and tests involving constants.

test/const1.go is the major new test case.

R=ken
OCL=26216
CL=26224
2009-03-12 19:04:38 -07:00
Ken Thompson
6eb54cb05b chan flags close/closed installed
runtime not finished.

R=r
OCL=26217
CL=26217
2009-03-12 17:55:11 -07:00
Ken Thompson
bb02e481d2 added bitclear operators &^ and &^=
R=r
OCL=26152
CL=26152
2009-03-11 19:59:35 -07:00
Ken Thompson
767845b6fa bug 125
R=r
OCL=26146
CL=26146
2009-03-11 17:37:04 -07:00
Russ Cox
4eb7ceba58 complain when trying to put T into an interface
if T has pointer methods.  this is just a heuristic
but it catches the problem robert ran into and
lets me put the larger interface issues aside for
now.  found one bug in pretty.

R=ken
OCL=26141
CL=26141
2009-03-11 16:06:17 -07:00
Ian Lance Taylor
062d6998ab Add support for a -I option. -I DIR searches for packages in
DIR.

R=ken,rsc
DELTA=49  (41 added, 2 deleted, 6 changed)
OCL=26057
CL=26092
2009-03-10 20:03:31 -07:00
Ken Thompson
d27e9f528d bug086
R=r
OCL=26090
CL=26090
2009-03-10 19:16:31 -07:00
Ken Thompson
0c4f4587d7 bug with interaction of variables
declared in cases and heap allocation

R=r
OCL=26064
CL=26064
2009-03-10 16:49:34 -07:00
Ken Thompson
820f42d977 binary search for constant case statements.
R=r
OCL=25890
CL=25890
2009-03-07 17:33:42 -08:00
Ken Thompson
a4a10ed856 1. type switches
2. fixed fault on bug128
3. got rid of typeof
4. fixed bug in t,ok = I2T

R=r
OCL=25873
CL=25873
2009-03-06 17:50:43 -08:00
Russ Cox
af678a593d new approach for generating sysimport.c
(renamed to avoid any conflict with old p4 copies).

this approach doesn't require auto-generating
files also kept in p4, so it should be easier on
go users who don't sync very often.

this approach will be more work for go developers:
builtin.c needs to be copied to builtin.c.boot in p4
as new functions are added.  mkbuiltin does this
for certain $USERs to help us remember.

R=r
DELTA=343  (176 added, 162 deleted, 5 changed)
OCL=25803
CL=25805
2009-03-05 18:26:12 -08:00
Russ Cox
63985b489b bug085 bug129
R=ken
OCL=25787
CL=25791
2009-03-05 15:57:03 -08:00
Ken Thompson
bf983477a2 new switch implementation
in preparation of type switch.
no functional change (yet).

R=r
OCL=25784
CL=25788
2009-03-05 15:49:34 -08:00
Russ Cox
98b34e5bbd reject invalid map key types at compile time
R=ken
OCL=25720
CL=25720
2009-03-04 17:38:37 -08:00
Russ Cox
955638e2fb disallow ordinary-type.(T), as in spec.
R=ken
OCL=25705
CL=25705
2009-03-04 14:50:25 -08:00
Russ Cox
49cc649e59 back to T{x}, stricter handling of T(x) vs x.(T)
R=ken
DELTA=131  (60 added, 41 deleted, 30 changed)
OCL=25617
CL=25633
2009-03-03 08:41:02 -08:00
Ken Thompson
a665e2924c bug with select :=
R=r
OCL=25278
CL=25278
2009-02-21 12:41:34 -08:00
Russ Cox
ebc10db3e1 allow parens to disambiguate types.
examples:

	chan <- (chan int)
	chan (<- chan int)
	(map[string]func())("a": main)

R=ken
OCL=25151
CL=25151
2009-02-18 10:07:46 -08:00
Ken Thompson
3c0fc400fb fix unsafe.Sizeof("abc")
R=rsc
OCL=25105
CL=25105
2009-02-17 13:10:57 -08:00
Russ Cox
d3d0c256be bug123
R=ken
OCL=25075
CL=25075
2009-02-16 17:44:05 -08:00
Russ Cox
b4af09ab56 embedded interface types in interfaces.
R=ken
OCL=25072
CL=25072
2009-02-16 16:36:18 -08:00
Russ Cox
3b3e63735e bug fix for &x[0] when x is slice
R=ken
OCL=25044
CL=25044
2009-02-15 13:15:46 -08:00
Russ Cox
07244f7c80 add composite literal ( ) syntax.
warn about composite literal { } syntax.

R=ken
OCL=25018
CL=25023
2009-02-13 14:48:16 -08:00
Russ Cox
5f4f5647ef require type assertions when narrowing.
R=ken
OCL=24350
CL=24914
2009-02-11 17:57:29 -08:00
Russ Cox
73dd4a37f9 fix export bug Rob tripped over.
the lexer is already hiding names,
so this clumsy hack is no longer necessary.

R=ken
OCL=24783
CL=24783
2009-02-10 13:57:31 -08:00
Ian Lance Taylor
651972b31f Implement unsafe.Alignof.
R=ken
DELTA=20  (19 added, 0 deleted, 1 changed)
OCL=24719
CL=24771
2009-02-10 11:46:26 -08:00
Russ Cox
a81870badf add error to catch 6g alignment bug.
the fix appears to be to align the
out struct on an 8 boundary, but that
is a bit involved.

R=ken
OCL=24657
CL=24657
2009-02-08 11:19:45 -08:00
Russ Cox
a6c59ce274 gc funarg return fix.
change type (to satisfy OAS) after nodarg:
nodarg uses offset from type too,
and must use correct offset.

R=ken
OCL=24656
CL=24656
2009-02-08 11:01:52 -08:00
Rob Pike
8f2b774ee1 update sysimport.c for unsafe.Offset and Sizeof
R=ken
DELTA=2  (2 added, 0 deleted, 0 changed)
OCL=24643
CL=24643
2009-02-07 14:48:32 -08:00
Ken Thompson
8a70545b57 unsafe.Sizeof and unsafe.Offsetof
R=r
OCL=24639
CL=24639
2009-02-07 12:34:45 -08:00
Russ Cox
0970c46863 closures - 6g support
R=ken
OCL=24501
CL=24566
2009-02-06 13:47:10 -08:00
Russ Cox
b0009bef20 bug064
make f(g()) work when g returns multiple
args with names different than f expects.

func swap(a, b int) (c, d int) {
	return b, a
}

swap(swap(1,2))

R=ken
OCL=24474
CL=24476
2009-02-05 15:22:49 -08:00
Russ Cox
aab26a5248 do not generate Init proto for sys and unsafe.
R=ken
OCL=24455
CL=24455
2009-02-05 14:49:53 -08:00
Russ Cox
5e2c05877d allow methods on funcs.
R=ken
OCL=24442
CL=24442
2009-02-05 13:33:07 -08:00
Russ Cox
360f0aacee fix interface not satisifed message:
x.go:13: T is not I - missing M()

NOT
x.go:13: T is not I - missing Mfunc()

R=ken
OCL=24316
CL=24316
2009-02-04 10:37:11 -08:00
Rob Pike
6e395cfecf slightly better code for the frog fix
R=ken
OCL=24025
CL=24025
2009-01-31 16:44:52 -08:00
Rob Pike
2538cf747b Complain about control characters that are not white space.
Bitten by invisible chars too many times.

R=ken
OCL=24024
CL=24024
2009-01-31 16:42:10 -08:00
Russ Cox
9e735985d4 avoid memcpy(x, x),
which valgrind complains about.

R=ken
OCL=23990
CL=23990
2009-01-30 16:31:26 -08:00
Russ Cox
4a43198390 update compiler to new func rules
R=ken
OCL=23958
CL=23961
2009-01-30 14:39:42 -08:00
Russ Cox
391425ae55 if take address of local, move to heap.
heuristic to not print bogus strings.
fix one error message format.

R=ken
OCL=23849
CL=23851
2009-01-29 17:38:58 -08:00
Russ Cox
282bf8cc8c fix possible infinite recursion in eqtype.
don't use intermediate register to move
32-or-fewer-bit immediate constants
into memory.

R=ken
OCL=23726
CL=23726
2009-01-28 16:42:26 -08:00
Russ Cox
3ec4675220 clean up range grammar
R=ken
OCL=23712
CL=23714
2009-01-28 15:41:50 -08:00
Ken Thompson
4b8e030762 bug 135
R=r
OCL=23646
CL=23646
2009-01-27 18:21:03 -08:00
Russ Cox
743ac07cc3 change dotdotdot interfaces to be structs,
not pointers to structs.

fix defered dotdotdot.

R=r,ken
DELTA=25  (7 added, 5 deleted, 13 changed)
OCL=23620
CL=23625
2009-01-27 15:05:25 -08:00
Ken Thompson
1e1cc4eb57 defer
R=r
OCL=23592
CL=23592
2009-01-27 12:03:53 -08:00
Russ Cox
5b129cda5f assignment count mismatch: 2 = 1.
R=ken
OCL=23534
CL=23534
2009-01-26 17:20:29 -08:00
Russ Cox
f1fe21a08f bug134
R=ken
OCL=23532
CL=23532
2009-01-26 17:06:20 -08:00
Russ Cox
4efad58d0a bug133
R=ken
OCL=23528
CL=23528
2009-01-26 16:57:24 -08:00
Russ Cox
3c5f3a8641 print(map) and print(chan) as pointers.
R=ken
OCL=23520
CL=23520
2009-01-26 15:36:28 -08:00
Ken Thompson
7859ae8a2f removed a:b in range syntax
added another channel test

R=r
OCL=23488
CL=23488
2009-01-26 11:34:38 -08:00
Russ Cox
a7f6d4066e implement new restrictions on what
can be compared/hashed.

R=r
DELTA=351  (201 added, 80 deleted, 70 changed)
OCL=23423
CL=23481
2009-01-26 09:56:42 -08:00
Russ Cox
1f8a40d85c move math routines from package sys to package math,
though they still build in src/runtime.

use cgo instead of hand-written wrappers.

R=r
DELTA=740  (289 added, 300 deleted, 151 changed)
OCL=23326
CL=23331
2009-01-22 16:23:44 -08:00
Russ Cox
61590c4c44 disallow P.t for lowercase t and not our package P.
implement hiding lowercase methods m in
signatures by adding in a hash of the package name
to the type hash code.

remove remaining checks for internally-generated _ names:
they are all gone.

R=ken
OCL=23236
CL=23238
2009-01-21 14:51:57 -08:00
Russ Cox
35e37bbf41 6g: better genembedtramp fatal error,
and don't put inaccessible private methods
   in signature.

R=ken
OCL=23138
CL=23140
2009-01-20 15:36:57 -08:00
Russ Cox
839a68469b delete export
TBR=r
OCL=23121
CL=23127
2009-01-20 14:40:40 -08:00
Russ Cox
0183baaf44 * delete export
* rename init functions

R=ken
OCL=23122
CL=23126
2009-01-20 14:40:00 -08:00
Russ Cox
aec4d3194a disallow other package's names in method calls
R=ken
OCL=22999
CL=22999
2009-01-16 15:35:07 -08:00
Russ Cox
06869eedf9 disallow other package's names in struct field dot.
R=ken
OCL=22996
CL=22996
2009-01-16 15:25:52 -08:00
Russ Cox
360962420c casify, cleanup sys
R=r
OCL=22978
CL=22984
2009-01-16 14:58:14 -08:00
Russ Cox
dec12d3654 re-export of bools was changing
format from hex to decimal, confusing
ar's strcmp-based value comparison.

switched export format to "true" or "false"
to keep bools separate from ints.

R=ken
OCL=22944
CL=22944
2009-01-16 10:45:28 -08:00
Russ Cox
c1e7e270f1 don't crash on:
package main
var x int
type x struct { a int }

R=ken
OCL=22903
CL=22903
2009-01-15 17:32:31 -08:00
Russ Cox
605d0746c5 catch export on func.
print names in message.

R=ken
OCL=22891
CL=22891
2009-01-15 16:43:51 -08:00
Russ Cox
3decb42e6f add warning for export of lowercase too.
R=ken
OCL=22887
CL=22887
2009-01-15 16:20:21 -08:00
Russ Cox
07d344e442 remove export name-list statement.
make package local the default.
warn about name case not matching export keyword.

R=ken
OCL=22881
CL=22886
2009-01-15 16:16:52 -08:00
Russ Cox
a3ed4e716a add sys.caller
R=r
DELTA=139  (101 added, 38 deleted, 0 changed)
OCL=22462
CL=22466
2009-01-09 15:52:43 -08:00
Russ Cox
ae167bf08f clean up automatic indirect, delete some dead code.
R=ken
OCL=22454
CL=22457
2009-01-09 15:21:41 -08:00
Russ Cox
316d377ac2 now that TCHAN, TMAP, and TSTRING are real types,
can do methods on them without pointer worries.

R=ken
OCL=22434
CL=22436
2009-01-09 13:50:58 -08:00
Russ Cox
a91af04c06 6g cleanup suggested by ken.
remove TPTR wrapper around TMAP, TCHAN, TSTRING.

R=ken
OCL=22406
CL=22409
2009-01-09 11:13:39 -08:00
Russ Cox
484ba939d2 update sys.reflect and sys.unreflect to accomodate
the possibility of large objects in interface values.

R=r
DELTA=171  (97 added, 22 deleted, 52 changed)
OCL=22382
CL=22382
2009-01-09 00:17:46 -08:00
Russ Cox
e512481b17 second pass on interface fixes and tests.
R=ken
OCL=22370
CL=22372
2009-01-08 18:06:06 -08:00
Russ Cox
1b7881adb4 fix:
type T []int
	var a []int
	var t = T(a)

R=ken
OCL=22341
CL=22341
2009-01-08 15:01:22 -08:00
Russ Cox
c0b8a7965a typo
R=ken
OCL=22327
CL=22327
2009-01-08 14:31:11 -08:00
Russ Cox
20595ac4b0 many interface bug fixes.
also, after
	func g() (int, int)
	func f(int, int)
allow
	f(g())
and
	func h() (int, int) { return g() }

R=ken
DELTA=356  (252 added, 26 deleted, 78 changed)
OCL=22319
CL=22325
2009-01-08 14:30:00 -08:00
Ken Thompson
eed3addb9d more
R=r
OCL=22240
CL=22240
2009-01-07 15:54:08 -08:00
Ken Thompson
3f135be389 conversion from closed array to slice
R=r
OCL=22236
CL=22236
2009-01-07 15:26:11 -08:00
Ken Thompson
c458c98388 [...] bug
R=r
OCL=22218
CL=22218
2009-01-07 13:20:10 -08:00
Russ Cox
855495eab6 iscomposite test in OCONV is unnecessary
now that OCOMP exists

R=ken
OCL=22216
CL=22216
2009-01-07 12:39:48 -08:00
Ken Thompson
179af0bb19 clear automatic arrays created with literals
R=r
OCL=22215
CL=22215
2009-01-07 12:28:23 -08:00
Ken Thompson
b0f627a6e1 closed arrays including [...]
R=r
OCL=22182
CL=22182
2009-01-06 17:31:24 -08:00
Russ Cox
84953bdaa8 fix newfn
R=ken
OCL=22173
CL=22173
2009-01-06 15:39:28 -08:00
Russ Cox
dabdfa6cce new new &Point{1,2}
R=ken
OCL=22168
CL=22168
2009-01-06 15:24:12 -08:00
Ken Thompson
88b5c5f0f8 make for slice/map/chan
new for pointers

R=r
OCL=22158
CL=22158
2009-01-06 14:52:26 -08:00
Russ Cox
859ba57bbb make acid build with bison.
ask for bison explicitly in cc, gc to try to
avoid problems with other yaccs that
might be installed.

R=r
DELTA=29  (10 added, 2 deleted, 17 changed)
OCL=22110
CL=22113
2009-01-06 09:53:30 -08:00
Russ Cox
2d259c817a add comments and delete dead code
R=ken
OCL=22078
CL=22080
2009-01-05 17:32:23 -08:00
Ken Thompson
b2dfd787d7 allow slices (open arrays) to be
receivers in methods.
put back original code for hilbert/bignum

R=r
OCL=21910
CL=21920
2008-12-30 14:02:20 -08:00
Ken Thompson
85815fe0ad diagnostic to catch pointer to
rvalue promoted to method receiver.
fixes to bignum that failed.

R=r
OCL=21827
CL=21827
2008-12-26 14:42:20 -08:00
Russ Cox
af5e16cfd9 fix new(T) if type T []int.
make sure type of expr is T not just []int

R=ken
OCL=21688
CL=21688
2008-12-20 16:30:44 -08:00
Russ Cox
c3077f7606 [] and struct in interfaces.
other [] cleanup.

convert() is gone.

R=r
DELTA=352  (144 added, 68 deleted, 140 changed)
OCL=21660
CL=21662
2008-12-19 17:11:54 -08:00
Ken Thompson
6fa74e0973 portability bug
cant assign to closed array

R=r
OCL=21634
CL=21634
2008-12-19 14:04:25 -08:00
Russ Cox
cd40cd2435 fix new(bool) error message
R=ken
OCL=21616
CL=21616
2008-12-19 12:18:44 -08:00
Russ Cox
eee50ae1ac chan and map of [] and struct
R=r
DELTA=192  (145 added, 8 deleted, 39 changed)
OCL=21609
CL=21614
2008-12-19 12:05:22 -08:00
Russ Cox
cbff09d666 g4 open sysimport.c before writing it
R=r
DELTA=1  (1 added, 0 deleted, 0 changed)
OCL=21577
CL=21603
2008-12-19 09:03:44 -08:00
Russ Cox
c4416ac06b new error messages
x.go:11: illegal types for operand: AS
	*I
	*T
	(*interface vs *struct)

R=r
DELTA=10  (8 added, 0 deleted, 2 changed)
OCL=21457
CL=21602
2008-12-19 09:03:24 -08:00
Russ Cox
dc7b2e98d2 compiler changes for *chan -> chan; *map -> map; new(T) -> new(*T)
mainly a syntactic change: the compiler representations don't change
(chan and map are now hidden pointers like string).

R=ken
OCL=21578
CL=21582
2008-12-19 03:05:54 -08:00
Russ Cox
d47d888ba6 convert *[] to [].
R=r
OCL=21563
CL=21571
2008-12-18 22:37:22 -08:00
Ken Thompson
9786f69f74 print(array)
R=r
OCL=21570
CL=21570
2008-12-18 22:17:05 -08:00
Russ Cox
f38d2b80a4 new []int literal
R=ken
OCL=21568
CL=21568
2008-12-18 21:59:12 -08:00
Ken Thompson
dcc064fe94 cmp [] to nil
R=r
OCL=21567
CL=21567
2008-12-18 21:33:45 -08:00
Russ Cox
78fc888e64 another [] fix
R=ken
OCL=21566
CL=21566
2008-12-18 21:15:26 -08:00
Russ Cox
92f74ca7e2 [] fixes
R=ken
OCL=21565
CL=21565
2008-12-18 21:11:56 -08:00
Ken Thompson
4026500d18 arrays
R=r
OCL=21564
CL=21564
2008-12-18 20:06:28 -08:00
Russ Cox
697cb17b30 trailing white space
R=r
DELTA=1  (0 added, 0 deleted, 1 changed)
OCL=21403
CL=21415
2008-12-17 10:14:29 -08:00
Russ Cox
e53d5ad620 fix type/name thing, again
R=r
DELTA=8  (7 added, 0 deleted, 1 changed)
OCL=21379
CL=21379
2008-12-16 17:45:28 -08:00
Russ Cox
99435cac09 another "want type got name" error case
R=ken
OCL=21377
CL=21377
2008-12-16 17:37:07 -08:00
Ken Thompson
ae5a475e20 range clause must have = or :=
:= illegal in for-increment

R=r
OCL=21204
CL=21204
2008-12-15 13:44:27 -08:00
Ken Thompson
42d89ac02c even more code improvement
R=r
OCL=21160
CL=21160
2008-12-14 18:45:00 -08:00
Ken Thompson
e683fb7a54 bug104
R=r
OCL=21082
CL=21082
2008-12-12 13:10:36 -08:00
Ken Thompson
c7ab332744 restrict declarations of type map/chan/string
(they must be pointers)

R=r
OCL=21009
CL=21009
2008-12-11 16:09:45 -08:00
Russ Cox
73653841af reject struct to interface conversion for now
R=ken
OCL=21007
CL=21007
2008-12-11 15:56:13 -08:00
Russ Cox
fa945d5bf8 fix race with fresh perforce checkouts
R=r
DELTA=15  (9 added, 0 deleted, 6 changed)
OCL=20977
CL=20981
2008-12-11 11:58:45 -08:00
Russ Cox
cb64ec5bb6 only generate non-trivial signatures in the
file in which they occur.  avoids duplicate
trampoline generation across multiple files.

R=ken
OCL=20976
CL=20980
2008-12-11 11:54:33 -08:00
Ken Thompson
5f1a3be9dd bug120
R=r
OCL=20921
CL=20921
2008-12-10 14:17:24 -08:00
Ken Thompson
7dd62cb3bc 2 minor bugs
R=r
OCL=20906
CL=20906
2008-12-10 12:38:16 -08:00
Ken Thompson
57bd0da375 bug126
R=r
OCL=20879
CL=20879
2008-12-09 18:31:31 -08:00
Ken Thompson
8bce3b5658 bug127
R=r
OCL=20874
CL=20874
2008-12-09 17:52:41 -08:00
Ken Thompson
92a1190c6c robs bug converting unsafe.pointer
R=r
OCL=20834
CL=20834
2008-12-09 13:00:50 -08:00