diff options
author | Russ Cox <rsc@golang.org> | 2008-10-07 12:31:31 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2008-10-07 12:31:31 -0700 |
commit | 2e35ca6c33cd9c089b6536e9405e2f90a8ec101c (patch) | |
tree | 133422e9724c37fc7aac2fcf9f1c52b230af51ef /usr/gri/gosrc/compilation.go | |
parent | 5cff795078a27a56b69a1fa878b3b72be12b60a6 (diff) | |
download | golang-2e35ca6c33cd9c089b6536e9405e2f90a8ec101c.tar.gz |
update code to follow new semicolon rules:
* 1. all statements and declarations are terminated by semicolons
* 2. semicolons can be omitted at top level.
* 3. semicolons can be omitted before and after the closing ) or }
* on a list of statements or declarations.
/home/rsc/bin/addsemi and then diff+tweak.
R=r,gri
OCL=16620
CL=16643
Diffstat (limited to 'usr/gri/gosrc/compilation.go')
-rw-r--r-- | usr/gri/gosrc/compilation.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/usr/gri/gosrc/compilation.go b/usr/gri/gosrc/compilation.go index d8a78be10..595c4f108 100644 --- a/usr/gri/gosrc/compilation.go +++ b/usr/gri/gosrc/compilation.go @@ -29,12 +29,12 @@ func ReadImport(comp* Globals.Compilation, filename string, update bool) (data s if ok { return data, ok; } - + if filename[0] == '/' { // absolute path panic(`don't know how to handle absolute import file path "` + filename + `"`); } - + // relative path // try relative to the $GOROOT/pkg directory std_filename := Platform.GOROOT + "/pkg/" + filename; @@ -42,11 +42,11 @@ func ReadImport(comp* Globals.Compilation, filename string, update bool) (data s if ok { return data, ok; } - + if !update { return "", false; } - + // TODO BIG HACK - fix this! // look for a src file // see if it just works @@ -58,13 +58,13 @@ func ReadImport(comp* Globals.Compilation, filename string, update bool) (data s return data, ok; } } - + return "", false; } export func Import(comp *Globals.Compilation, pkg_file string) *Globals.Package { - data, ok := ReadImport(comp, pkg_file, comp.flags.update_packages) + data, ok := ReadImport(comp, pkg_file, comp.flags.update_packages); var pkg *Globals.Package; if ok { pkg = Importer.Import(comp, data); @@ -88,14 +88,14 @@ export func Compile(comp *Globals.Compilation, src_file string) { print("cannot open ", src_file, "\n"); return; } - + if comp.flags.verbosity > 0 { print(src_file, "\n"); } scanner := new(Scanner.Scanner); scanner.Open(src_file, src); - + var tstream *chan *Scanner.Token; if comp.flags.token_chan { tstream = new(chan *Scanner.Token, 100); @@ -109,16 +109,16 @@ export func Compile(comp *Globals.Compilation, src_file string) { if parser.S.nerrors > 0 { return; } - + if !comp.flags.ast { return; } - + Verifier.Verify(comp); - + if comp.flags.print_interface { Printer.PrintObject(comp, comp.pkg_list[0].obj, false); } - + Export(comp, src_file); } |