Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for commentSizeBefore (0.18 sec)

  1. src/go/printer/printer.go

    func (p *printer) commentBefore(next token.Position) bool {
    	return p.commentOffset < next.Offset && (!p.impliedSemi || !p.commentNewline)
    }
    
    // commentSizeBefore returns the estimated size of the
    // comments on the same line before the next position.
    func (p *printer) commentSizeBefore(next token.Position) int {
    	// save/restore current p.commentInfo (p.nextComment() modifies it)
    	defer func(info commentInfo) {
    		p.commentInfo = info
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 41.6K bytes
    - Viewed (0)
  2. src/go/printer/nodes.go

    		return maxSize + 1
    	}
    	if len(b.List) > 5 {
    		// too many statements - don't make it a one-liner
    		return maxSize + 1
    	}
    	// otherwise, estimate body size
    	bodySize := p.commentSizeBefore(p.posFor(pos2))
    	for i, s := range b.List {
    		if bodySize > maxSize {
    			break // no need to continue
    		}
    		if i > 0 {
    			bodySize += 2 // space for a semicolon and blank
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 17 18:53:17 UTC 2023
    - 52.6K bytes
    - Viewed (0)
Back to top