Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Delta Between Two Patch Sets: src/pkg/go/parser/parser.go

Issue 5321046: code review 5321046: gofix: test import insertion, deletion (Closed)
Left Patch Set: Created 13 years, 5 months ago
Right Patch Set: diff -r 3f647c45f84d https://go.googlecode.com/hg/ Created 13 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/go/ast/ast.go ('k') | src/pkg/go/printer/nodes.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Package parser implements a parser for Go source files. Input may be 5 // Package parser implements a parser for Go source files. Input may be
6 // provided in a variety of forms (see the various Parse* functions); the 6 // provided in a variety of forms (see the various Parse* functions); the
7 // output is an abstract syntax tree (AST) representing the Go source. The 7 // output is an abstract syntax tree (AST) representing the Go source. The
8 // parser is invoked through one of the Parse* functions. 8 // parser is invoked through one of the Parse* functions.
9 // 9 //
10 package parser 10 package parser
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 var path *ast.BasicLit 1902 var path *ast.BasicLit
1903 if p.tok == token.STRING { 1903 if p.tok == token.STRING {
1904 path = &ast.BasicLit{p.pos, p.tok, p.lit} 1904 path = &ast.BasicLit{p.pos, p.tok, p.lit}
1905 p.next() 1905 p.next()
1906 } else { 1906 } else {
1907 p.expect(token.STRING) // use expect() error handling 1907 p.expect(token.STRING) // use expect() error handling
1908 } 1908 }
1909 p.expectSemi() // call before accessing p.linecomment 1909 p.expectSemi() // call before accessing p.linecomment
1910 1910
1911 // collect imports 1911 // collect imports
1912 » spec := &ast.ImportSpec{doc, ident, path, p.lineComment} 1912 » spec := &ast.ImportSpec{doc, ident, path, p.lineComment, token.NoPos}
1913 p.imports = append(p.imports, spec) 1913 p.imports = append(p.imports, spec)
1914 1914
1915 return spec 1915 return spec
1916 } 1916 }
1917 1917
1918 func parseConstSpec(p *parser, doc *ast.CommentGroup, iota int) ast.Spec { 1918 func parseConstSpec(p *parser, doc *ast.CommentGroup, iota int) ast.Spec {
1919 if p.trace { 1919 if p.trace {
1920 defer un(trace(p, "ConstSpec")) 1920 defer un(trace(p, "ConstSpec"))
1921 } 1921 }
1922 1922
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 assert(ident.Obj == unresolved, "object already resolved") 2162 assert(ident.Obj == unresolved, "object already resolved")
2163 ident.Obj = p.pkgScope.Lookup(ident.Name) // also removes unreso lved sentinel 2163 ident.Obj = p.pkgScope.Lookup(ident.Name) // also removes unreso lved sentinel
2164 if ident.Obj == nil { 2164 if ident.Obj == nil {
2165 p.unresolved[i] = ident 2165 p.unresolved[i] = ident
2166 i++ 2166 i++
2167 } 2167 }
2168 } 2168 }
2169 2169
2170 return &ast.File{doc, pos, ident, decls, p.pkgScope, p.imports, p.unreso lved[0:i], p.comments} 2170 return &ast.File{doc, pos, ident, decls, p.pkgScope, p.imports, p.unreso lved[0:i], p.comments}
2171 } 2171 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b