summaryrefslogtreecommitdiff
path: root/src/pkg/go/printer/nodes.go
AgeCommit message (Collapse)AuthorFilesLines
2011-09-13Imported Upstream version 60upstream/60Ondřej Surý1-0/+1510
2011-09-13Imported Upstream version 60Ondřej Surý1-1561/+0
2011-08-03Imported Upstream version 59upstream/59Ondřej Surý1-2/+8
2011-06-30Imported Upstream version 58upstream/58Ondřej Surý1-47/+136
2011-04-26Imported Upstream version 2011.04.13upstream/2011.04.13Ondřej Surý1-71/+43
2011-02-14Imported Upstream version 2011-02-01.1upstream/2011-02-01.1Ondřej Surý1-43/+47
2011-01-17Imported Upstream version 2011.01.12upstream/2011.01.12Ondřej Surý1-110/+147
2010-06-08go/printer: deleted dead codeRobert Griesemer1-21/+12
(remains of the semicolon conversion) R=rsc CC=golang-dev http://codereview.appspot.com/1623041
2010-06-08go/parser: correct position of empty statement ';'Robert Griesemer1-3/+3
(caused certain files to not be idempotent under gofmt) - corrected golden files for go/printer - slightly simplified some code in nodes.go (no impact on formatting) - these changes have no impact on gofmt output of .go files under src, misc fallthrough statement considered harmful! R=rsc CC=golang-dev http://codereview.appspot.com/1593042
2010-05-21go/printer, gofmt: fix printing of labels,Robert Griesemer1-6/+9
apply gofmt to src, misc Fixes issue 752. R=rsc CC=golang-dev http://codereview.appspot.com/1240044 Committer: Robert Griesemer <gri@golang.org>
2010-05-14go/printer (gofmt): don't lose mandatory semicolonsRobert Griesemer1-16/+20
Fixes issue 779. R=r CC=golang-dev http://codereview.appspot.com/1218042
2010-04-27gofmt: fine-tune stripping of parenthesesRobert Griesemer1-2/+13
(composite literals in control clauses only need parentheses if the literals start with a type name) R=rsc CC=golang-dev http://codereview.appspot.com/962045
2010-04-27gofmt: don't strip mandatory ()'s around composite literals in control clausesRobert Griesemer1-6/+11
Fixes issue 748. R=rsc CC=golang-dev http://codereview.appspot.com/946043
2010-03-30go/printer: follow-up on CL 802043Robert Griesemer1-6/+6
- more test cases - comment fixes - minor unrelated changes as part of investigation of issue 702 R=rsc CC=golang-dev http://codereview.appspot.com/860041
2010-03-30Gofmt preserves newlines in multiline selector expressions.Risto Jaakko Saarelma1-6/+85
This is for making the fluent interface idiom usable with gofmt. R=gri CC=golang-dev http://codereview.appspot.com/802043 Committer: Robert Griesemer <gri@golang.org>
2010-03-25godoc: don't convert multi-line functions into one-liners by defaultRobert Griesemer1-19/+33
- new heuristic: if both the opening { and closing } braces are on the same line, and the function body doesn't contain comments or is other- wise too long (e.g. signature too long), it is formatted as a one-line function - related cleanups along the way - gofmt -w src misc led to no additional changes as expected R=rsc, rsc1 CC=golang-dev, ken2, r http://codereview.appspot.com/758041
2010-03-16gofmt: more consistent formatting of const/var declsRobert Griesemer1-27/+19
- gofmt -w src misc - only manually modified file: src/pkg/go/printer/nodes.go R=rsc CC=golang-dev, r http://codereview.appspot.com/606041
2010-03-12go/printer: fix a couple of hidden crashes that becomeRobert Griesemer1-3/+12
visible only when enabling internal debug mode: - in rare cases expression depth can underflow - when printing a single labeled statement, indentation may underflow if not setup correctly R=rsc CC=golang-dev http://codereview.appspot.com/484041
2010-03-04gofmt: modified algorithm for alignment of multi-line composite/list entriesRobert Griesemer1-24/+69
- only manual changes are in src/pkg/go/printer/nodes.go - use a heuristic to determine "outliers" such that not entire composites are forced to align with them - improves several places that were not unligned before due too simple heuristic - unalignes some cases that contain "outliers" - gofmt -w src misc Fixes issue 644. R=rsc, r CC=golang-dev http://codereview.appspot.com/241041
2010-03-02gofmt: fix alignment of multi-line var declarationsRobert Griesemer1-19/+26
- gofmt -w src misc R=rsc, r CC=golang-dev http://codereview.appspot.com/223101
2010-03-02gofmt: experiment: align values in map composites where possibleRobert Griesemer1-3/+13
- gofmt -w src misc - looking for feedback R=rsc, r CC=golang-dev http://codereview.appspot.com/223076
2010-02-25go/printer, gofmt: align comments in multi-line expression listsRobert Griesemer1-19/+22
- gofmt -w src misc - improves several lists and fixes minor degradation introduced with the fix for issue 628 - removed some dead code (stringList) R=rsc CC=golang-dev http://codereview.appspot.com/223058
2010-02-25strings: delete Runes, BytesRuss Cox1-2/+1
gofmt -w -r 'strings.Bytes(a) -> []byte(a)' src/cmd src/pkg test/bench gofmt -w -r 'strings.Runes(a) -> []int(a)' src/cmd src/pkg test/bench delete unused imports R=r CC=golang-dev http://codereview.appspot.com/224062
2010-02-24go/ast: streamline representation of field listsRobert Griesemer1-21/+20
- always include position information about opening/closing parens/braces - replace uses of []*ast.Field with *ast.FieldList Fixes issue 473. R=rsc CC=golang-dev http://codereview.appspot.com/223043
2010-02-24gofmt: don't print ()'s around function-typed results (not needed anymore)Robert Griesemer1-9/+3
- add extra test cases to go/printer tests - apply gofmt to src and misc R=rsc CC=golang-dev http://codereview.appspot.com/223041
2010-02-24go/printer: use general comment intersperse mechanism everywhereRobert Griesemer1-51/+39
- remove several TODOs - as a side-effect, comment stylers are now used always and comments will be properly colored in godoc pkg documentation pages (and not only when looking at source text) R=rsc CC=golang-dev http://codereview.appspot.com/222041
2010-02-22go/printer (gofmt): remove more residue from semicolon transitionRobert Griesemer1-79/+14
minor unrelated cleanups R=rsc CC=golang-dev http://codereview.appspot.com/217086
2010-02-19go/ast: use a slice instead of a linked list for the list of commentsRobert Griesemer1-5/+5
(this will simplify some further changes) removed several TODOs R=rsc CC=golang-dev http://codereview.appspot.com/216059
2010-02-19- removed exp/parser (support for old semicolon syntax)Robert Griesemer1-6/+3
- go/ast: removed StringList (not needed anymore) - go/ast: changed import path and field list tag to a single string - updated all dependencies R=rsc CC=golang-dev http://codereview.appspot.com/217056
2010-02-16Don't print ()'s around a range clause's expression.Robert Griesemer1-1/+2
Fixes issue 605. R=rsc CC=golang-dev http://codereview.appspot.com/207108
2010-01-28support for ...T parameters (go/* packages)Robert Griesemer1-0/+3
R=rsc CC=golang-dev http://codereview.appspot.com/194126
2010-01-15 Steps towards tracking scopes for identifiers.Robert Griesemer1-1/+1
- Identifiers refer now to the language entity (Object) that they denote. At the moment this is at best an approximation. - Initial data structures for language entities (Objects) and expression types (Type) independent of the actual type notations. - Initial support for declaring and looking up identifiers. - Updated various dependent files and added support functions. - Extensively tested to avoid breakage. This is an AST change. R=rsc CC=golang-dev, rog http://codereview.appspot.com/189080
2010-01-11Remove -oldprinter flag from gofmt; all code isRobert Griesemer1-57/+21
now printed using the semicolon-free style. Removed NoSemis flag and mechanism dealing with optional semicolons from go/printer. Updated all go/printer output files using the semi-colon free style. Changes have no formatting impact on checked in go code under src and misc. R=rsc, r CC=golang-dev http://codereview.appspot.com/184068
2010-01-11Partial work-around for gofmt bug.Robert Griesemer1-22/+26
Addresses some cases and respects position of closing parenthesis; but doesn't work yet in all cases. Heuristic; will need to be replaced by a real solution eventually. Does not cause existing code to be reformatted. R=r CC=golang-dev, rsc http://codereview.appspot.com/186043
2009-12-151) Change default gofmt default settings forRobert Griesemer1-398/+398
parsing and printing to new syntax. Use -oldparser to parse the old syntax, use -oldprinter to print the old syntax. 2) Change default gofmt formatting settings to use tabs for indentation only and to use spaces for alignment. This will make the code alignment insensitive to an editor's tabwidth. Use -spaces=false to use tabs for alignment. 3) Manually changed src/exp/parser/parser_test.go so that it doesn't try to parse the parser's source files using the old syntax (they have new syntax now). 4) gofmt -w src misc test/bench 3rd set of files. R=rsc CC=golang-dev http://codereview.appspot.com/180048
2009-12-14improved formatting of import declarations andRobert Griesemer1-5/+28
multi-line expressions with comments Fixes issue 414. R=rsc http://codereview.appspot.com/179047
2009-12-11Various cleanups:Robert Griesemer1-20/+16
- no need to replace comments for stand-alone blocks - always print string concatenations with interspersed "+" (remove option) - minor cleanups R=rsc http://codereview.appspot.com/174076
2009-12-11fix printer test for new syntaxRobert Griesemer1-0/+19
R=rsc http://codereview.appspot.com/175048
2009-12-10implement NoSemis and NoStringConcat mode for go/printerRobert Griesemer1-5/+20
R=rsc http://codereview.appspot.com/174050
2009-11-23gofmt -r: documentation and minor fixesRuss Cox1-13/+23
fix a few paren insertion bugs in the printer too. R=gri, r CC=golang-dev http://codereview.appspot.com/157119
2009-11-20gofmt: add -r flag to rewrite source code according to patternRuss Cox1-3/+13
a little slow, but usable (speed unchanged when not using -r) tweak go/printer to handle nodes without line numbers more gracefully in a couple cases. R=gri http://codereview.appspot.com/156103
2009-11-19Permit omission of hi bound in slices.Robert Griesemer1-7/+15
R=r, rsc http://codereview.appspot.com/157082
2009-11-09- minor cleanupsRobert Griesemer1-16/+9
- better debugging support - gofmt -l src misc | wc -l is 0 R=rsc http://go/go-review/1024042
2009-11-09 - replaced gofmt expression formatting algorithm withRobert Griesemer1-116/+199
rsc's algorithm - applied gofmt -w misc src - partial CL (remaining files in other CLs) R=rsc, r http://go/go-review/1026036
2009-11-09remove semis after statements in one-statement statement listsRobert Griesemer1-100/+100
R=rsc, r http://go/go-review/1025029
2009-11-09- rename Context to exprContext to remove it from public interfaceRobert Griesemer1-4/+4
(and to match the style of declContext) R=rsc http://go/go-review/1024033
2009-11-09fix for nodeSize computation, used to determine ifRobert Griesemer1-1/+5
a node fits on one line: - for purposes of measuring the node size in text, don't generate html or use a styler that could generate html as it will lead to overly large sizes A consequence of this bug is that source code displayed with godoc may show functions that fit on one line in the source on multiple lines. This change causes no difference to the gofmt formatting of any files in src or misc. R=rsc http://go/go-review/1026034
2009-11-07- blank before opening { for multi-line composite literals (as preferred by r)Robert Griesemer1-14/+37
- blank padding around composite literal contents for a less dense look (most if not all composite literals were written in that style before gofmt ran through them) - corresponding (internal) flag: compositeLitBlank - don't print a semi after a one-statement statement list (as preferred by r) - corresponding (internal flag): fewerSemis - the number of changes in nodes.go is huge because of the removed semis; hg mail requires that I gofmt the file before With both flags set to false, this CL causes no gofmt formatting change. We can turn them on if we like it (and then remove the flags). Will submit with flags disabled. R=rsc, r http://go/go-review/1025015
2009-11-06format composite literal types that are "short" struct type literalsRobert Griesemer1-21/+85
on one line for a more compact representation of some composite Literals R=rsc http://go/go-review/1025008
2009-11-06- fine-tuning of one-line func heuristic (nodes.go)Robert Griesemer1-28/+49
- enabled for function declarations (not just function literals) - applied gofmt -w $GOROOT/src (look for instance at src/pkg/debug/elf/elf.go) R=r, rsc CC=go-dev http://go/go-review/1026006