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

202 Commits

Author SHA1 Message Date
Russ Cox
c715b58dad gc: fix import name resolution
Fixes #403.

R=ken2
https://golang.org/cl/180052
2009-12-15 16:44:28 -08:00
Russ Cox
101f499fa5 gc: allow ... in method lists
R=ken2
https://golang.org/cl/179070
2009-12-15 16:20:37 -08:00
Russ Cox
d122bb2193 gc: double-check usage of ...
Fixes #423.

R=ken2
https://golang.org/cl/180045
2009-12-15 14:26:50 -08:00
Russ Cox
978c3e96d1 gc: fix comment
R=gri
CC=golang-dev
https://golang.org/cl/174077
2009-12-13 12:11:56 -08:00
Russ Cox
3997495dc3 gc: semicolons
Fixes #89.
Fixes #92.
Fixes #118.
Fixes #182.
Fixes #328.
Fixes #340.

R=ken2, ken3
CC=golang-dev
https://golang.org/cl/172049
2009-12-11 15:59:41 -08:00
Russ Cox
e733766dda gc: minor import grammar bug fixes
Fixes #364.

R=ken2
https://golang.org/cl/164092
2009-12-03 00:10:32 -08:00
Russ Cox
652f55672d x[lo:] - gc and runtime.
* add runtime sliceslice1 for x[lo:]
  * remove runtime arraytoslice, rewriting &arr into arr[0:len(arr)].
  * port cgen_inline into 8g, 5g.
  * use native memmove in maps

R=ken2
https://golang.org/cl/157106
2009-11-20 09:11:46 -08:00
Russ Cox
a338231526 gc: five bug fixes, one better error.
* check for struct literal assignment to private fields.
* record, fix crash involving parallel map assignment.
* avoid infinite recursion in exportassignok.
* make floating point bounds check precise.
* avoid crash on invalid receiver.

* add context to error about implicit assignment.

Fixes #86.
Fixes #88.
Fixes #158.
Fixes #174.
Fixes #201.
Fixes #204.

R=ken2
https://golang.org/cl/154144
2009-11-15 12:57:09 -08:00
Russ Cox
593ccd1d44 yet another attempt to avoid conflicts with
<stdio.h>, which we weren't even #including

R=r
https://golang.org/cl/154108
2009-11-12 23:38:48 -08:00
Russ Cox
9f42ccb781 error rewording suggested by robert.
update comment.

R=ken
http://go/go-review/1025031
2009-11-09 15:25:18 -08:00
Russ Cox
62c4818ee0 bug136
R=ken
OCL=35902
CL=35904
2009-10-19 20:39:18 -07:00
Russ Cox
22a5c78f44 rename sys functions to runtime,
because they are in package runtime.

another step to enforcing package boundaries.

R=r
DELTA=732  (114 added, 93 deleted, 525 changed)
OCL=35811
CL=35824
2009-10-15 23:10:49 -07:00
Russ Cox
2372408189 sort errors by line number
turn off testdclstack and "not used" errors
when there are syntax errors.

BUG=2181825
R=ken
OCL=35606
CL=35608
2009-10-12 11:03:48 -07:00
Russ Cox
fd76b4f385 new builtin.c.boot from arm.
node printing fixes.
silence incorrect redeclaration error.

R=ken
OCL=35602
CL=35602
2009-10-12 10:12:37 -07:00
Russ Cox
d515063588 better handling of mistaken top-level variable
references during the parsing of :=.  the base
problem is that when reading

	a,b,c,d

the parser makes those refer to existing variables,
which might create a few stub top-level ones
for undefined names, but then if a := is the next
token, we need to undo those stubs.

this was causing problems in multifile packages
in which one file used a := variable named rpc
and the other imported a package named rpc.

R=ken
OCL=35446
CL=35446
2009-10-07 14:55:12 -07:00
Russ Cox
6f1698774d undo 35108 (disallow parens around type in struct literal).
allow parens around [...]int in struct literal.

R=ken
OCL=35112
CL=35130
2009-09-29 21:21:14 -07:00
Russ Cox
9c3c140984 disallow parens around type in struct literal syntax,
per discussion with gri.

R=ken
OCL=35108
CL=35108
2009-09-29 16:05:44 -07:00
Russ Cox
7743ffead4 disallow interface { x, y() }
R=ken
OCL=35042
CL=35044
2009-09-28 14:05:34 -07:00
Russ Cox
73e52ae971 check for unused imports
R=ken
OCL=34732
CL=34756
2009-09-17 16:42:10 -07:00
Russ Cox
aaaa1fc69b make 6g match spec:
no semicolon allowd after package clause.
	semicolon allowed after import statement.
	no doubled semicolons allowed

R=ken
OCL=34674
CL=34674
2009-09-15 17:29:08 -07:00
Russ Cox
59914723df declared and not used error, but disabled.
fix some bugs involving _.

R=ken
OCL=34621
CL=34621
2009-09-14 18:38:30 -07:00
Russ Cox
aa6e81dd71 a few more blank tests
R=ken
OCL=34500
CL=34500
2009-09-09 16:59:41 -07:00
Russ Cox
e780fa8669 defining package block names must override
universe block names.

BUG=2097244
R=ken
OCL=34295
CL=34473
2009-09-09 01:01:39 -07:00
Russ Cox
5d16d23362 update type switch to match spec.
R=ken
OCL=34471
CL=34471
2009-09-09 00:18:16 -07:00
Russ Cox
27c4e7e74e catch package net import "net" for release
R=ken
OCL=34205
CL=34207
2009-09-01 14:12:09 -07:00
Russ Cox
5600435fe4 produce diagnostic for
import "fmt"
var fmt = 1

R=ken
OCL=33556
CL=33561
2009-08-19 17:27:08 -07:00
Russ Cox
38df5ec58d try to do better line number reporting
in the presence of yacc lookahead.
better but still not perfect

R=ken
OCL=33541
CL=33541
2009-08-19 15:18:08 -07:00
Russ Cox
a92610208e delete code for forward type declarations
R=ken
OCL=33108
CL=33113
2009-08-12 14:41:13 -07:00
Russ Cox
66bb399fdd whole-package compilation
R=ken
OCL=33063
CL=33095
2009-08-12 13:18:19 -07:00
Russ Cox
b648716ee9 forward declarations not necessary.
still to do:
	* initializer cycle detection
	* nicer error for type checking cycles

R=ken
OCL=32855
CL=32880
2009-08-07 12:50:26 -07:00
Russ Cox
2609731736 delay range processing. old2new is gone
R=ken
OCL=32780
CL=32780
2009-08-05 02:33:30 -07:00
Russ Cox
54b403723b delay := processing
R=ken
OCL=32772
CL=32772
2009-08-05 00:42:44 -07:00
Russ Cox
a121410541 make Syms smaller.
collapse a lot of duplication in dcl.c
switch to NodeList* from Dcl*

R=ken
OCL=32770
CL=32770
2009-08-04 22:59:23 -07:00
Russ Cox
aa347c4a0d move various bits of code around
and delete some dead code.
no actual changes here.

R=ken
OCL=32764
CL=32764
2009-08-04 18:43:32 -07:00
Russ Cox
dbe004efe4 delayed evaluation of var blocks
R=ken
OCL=32750
CL=32753
2009-08-04 16:53:06 -07:00
Russ Cox
9dc22b6d6f more 6g reorg; checkpoint.
typecheck.c is now responsible for all type checking
except for assignment and function argument "..."

R=ken
OCL=32661
CL=32667
2009-08-03 11:58:52 -07:00
Russ Cox
ff3a73b407 typechecking checkpoint.
started to move typechecking to another file.
can build entire tree still, but lots of work
is duplicated.  much to clean up.

R=ken
OCL=32536
CL=32543
2009-07-30 16:53:08 -07:00
Russ Cox
056940d84b convert walkexpr to take Node**; drop indir
R=ken
OCL=32421
CL=32421
2009-07-29 12:00:34 -07:00
Russ Cox
0b2683d1ee do not insert implicit "return;" in empty function body
R=ken
OCL=32239
CL=32239
2009-07-27 14:36:32 -07:00
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
Russ Cox
903d28bd1e ANY is already checked separately,
so remove code from go.y.

show original types in badtype; don't remove pointers.
not sure why this was here but it confuses things
if the bad part involves two named pointer types
with different names but the same pointed-at type.

R=ken
OCL=31369
CL=31369
2009-07-08 16:39:19 -07:00
Russ Cox
7af032b87b fix forward struct declarations
R=ken
OCL=31230
CL=31230
2009-07-06 18:05:11 -07:00
Russ Cox
53ebd163c6 more precise error message
package main

func main() {
       var x interface {} = 42;
       switch x := x.(type) {
       case int:
       case foo:
       }
}

before:
x.go:7: non-type case in type switch
x.go:7: inappropriate case for a type switch

now:
x.go:7: foo: undefined

R=ken
OCL=31221
CL=31221
2009-07-06 16:29:28 -07:00
Russ Cox
5d5904bb4d bug163 bug164 bug166
R=ken
OCL=30889
CL=30889
2009-06-29 17:46:22 -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
0aef57e37f fix a 6g crash after type errors.
do not bother warning about marks left
on stack after syntax errors.

leave OCONV nodes in tree to avoid type errors
arising from multiple walks.

R=ken
OCL=30639
CL=30662
2009-06-23 15:30:59 -07:00