1
0
mirror of https://github.com/golang/go synced 2024-10-04 01:31:25 -06:00
Commit Graph

123 Commits

Author SHA1 Message Date
Russ Cox
35e5906f91 another baby step.
excluding import data,
no yacc node has type Type* anymore.

0 reduce/reduce conflicts.

R=ken
OCL=31793
CL=31795
2009-07-17 14:42:14 -07:00
Russ Cox
db508ccbff baby step: const decls can refer to future
consts in the same factored block

	const (
		X = Y;
		Y = 2;
	)

R=ken
OCL=31782
CL=31782
2009-07-17 13:38:16 -07:00
Russ Cox
e52e9ca82e another step toward eliminating forward declarations.
introduce NodeList* type in compiler to replace OLIST.
this clarifies where lists can and cannot occur.
list append and concatenation are now cheap.
the _r rules are gone from yacc.
rev and unrev are gone.
no more lists of lists.

the representation of assignments is a bit clunkier.
split into OAS (1=1) and OAS2 (2 or more on one side).

delete dead chanrecv3 code.

delay construction of func types.

R=ken
OCL=31745
CL=31762
2009-07-17 01:00:44 -07:00
Russ Cox
be16caf872 step toward no function prototypes.
delay evaluation of most types (all but func)
from parse time to type check time.

R=ken
OCL=31585
CL=31585
2009-07-13 23:38:39 -07:00
Russ Cox
0dadc4fe4f cleanup in preparation for new scoping.
walkstate -> walkstmt
walktype -> walkexpr; stmts moved to walkstmt

walktype and friends have a final Node **init
argument that can have side effects appended,
making it more explicit when they do and do not happen.
this replaces the old global addtop and addtotop.

delete switch map and interface conversion cases
(dropped from the language months ago).

R=ken
OCL=31465
CL=31468
2009-07-10 16:29:26 -07:00
Ken Thompson
ed124a971e segfault
R=rsc
OCL=31467
CL=31467
2009-07-10 16:12:21 -07:00
Ken Thompson
a68b1da3cc another nil reference
R=rsc
OCL=31373
CL=31373
2009-07-08 17:58:15 -07:00
Russ Cox
a1b64821f8 bug167
R=ken
OCL=31295
CL=31295
2009-07-07 11:48:22 -07:00
Russ Cox
ef4ddd63f8 another piece for cross-file forward struct declarations.
R=ken
OCL=31233
CL=31233
2009-07-06 21:39:18 -07:00
Russ Cox
9435dc2bdf 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.

R=ken
OCL=30864
CL=30869
2009-06-29 15:13:37 -07:00
Russ Cox
480f51243c bug165
R=ken
OCL=30783
CL=30783
2009-06-25 21:02:39 -07:00
Russ Cox
fa6df47986 package main
const foo = []int{1,2}

x.go:3: expression must be a constant

instead of

x.go:3: fatal error: gettype: addtop

R=ken
OCL=30767
CL=30767
2009-06-25 16:42:08 -07:00
Russ Cox
4bce6d455f package main
func foo(y) { }

was:
x.go:2: NONAME-y G0 u(1) a(1) l(77) x(-1000000000) is not a type

now:
x.go:2: y is not a type

R=ken
OCL=30764
CL=30764
2009-06-25 16:25:06 -07:00
Ken Thompson
466dd8da4e 6g crash re mail from gri jun 18.
R=r
OCL=30719
CL=30719
2009-06-24 17:50:25 -07:00
Russ Cox
30a28aec25 b/1909731
package main
func f(a *c.b) {}
func main() {}

BUG=1909731
R=ken
OCL=30322
CL=30322
2009-06-15 20:15:59 -07:00
Russ Cox
8f4af6d205 gc: grammar cleanup:
* no longer distinguishes const, var, type, package names.
  * all the predefined names are not tokens anymore.

R=ken
OCL=29326
CL=29985
2009-06-06 12:46:38 -07:00
Russ Cox
2f2577a4f6 bug161, fixed
R=ken
OCL=29907
CL=29907
2009-06-04 16:18:13 -07:00
Ken Thompson
e2613711aa detect recursive initialization
R=r
OCL=29544
CL=29544
2009-05-28 16:00:55 -07:00
Russ Cox
e81d97ea84 clean up gmove:
* conversions all in one place.
	* no separate load, store phases;
	  direct memory addressing when possible
	  (this is the x86 after all!).
	  avoids extra registers, extra MOVQs.
	* fixes int32 -> uint64 bug
	  (was zero-extending)

R=ken
OCL=29482
CL=29484
2009-05-27 23:55:14 -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
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
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
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
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
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
a6ba5ec535 6g: new interface rules (code got simpler!)
R=ken
OCL=28374
CL=28378
2009-05-06 17:05:35 -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
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
Ken Thompson
3657061550 change representation of strings
R=r
OCL=27293
CL=27293
2009-04-09 18:16:21 -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
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
941ed00b1d closure bug: carry along outnamed flag.
R=ken
OCL=26930
CL=26930
2009-03-30 19:21:36 -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
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
3c0fc400fb fix unsafe.Sizeof("abc")
R=rsc
OCL=25105
CL=25105
2009-02-17 13:10:57 -08:00
Russ Cox
b4af09ab56 embedded interface types in interfaces.
R=ken
OCL=25072
CL=25072
2009-02-16 16:36:18 -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
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
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
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
f1fe21a08f bug134
R=ken
OCL=23532
CL=23532
2009-01-26 17:06:20 -08:00