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

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

Issue 7378063: code review 7378063: go/parser: more precise comment (Closed)
Left Patch Set: diff -r 33d3e7bbd3ef https://code.google.com/p/go Created 12 years ago
Right Patch Set: diff -r 4bbd9bfda787 https://code.google.com/p/go Created 12 years 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 // know if a key that's an identifier is a struct field name or a name 1222 // know if a key that's an identifier is a struct field name or a name
1223 // denoting a value. The former is not resolved by the parser or the 1223 // denoting a value. The former is not resolved by the parser or the
1224 // resolver. 1224 // resolver.
1225 // 1225 //
1226 // Instead, _try_ to resolve such a key if possible. If it resolves, 1226 // Instead, _try_ to resolve such a key if possible. If it resolves,
1227 // it a) has correctly resolved, or b) incorrectly resolved because 1227 // it a) has correctly resolved, or b) incorrectly resolved because
1228 // the key is a struct field with a name matching another identifier. 1228 // the key is a struct field with a name matching another identifier.
1229 // In the former case we are done, and in the latter case we don't 1229 // In the former case we are done, and in the latter case we don't
1230 // care because the type checker will do a separate field lookup. 1230 // care because the type checker will do a separate field lookup.
1231 // 1231 //
1232 » // If the key does not resolve, it must a) be defined at the top level 1232 » // If the key does not resolve, it a) must be defined at the top
1233 » // in another file of the same package, or the universe scope, or be 1233 » // level in another file of the same package, the universe scope, or be
1234 // undeclared; or b) it is a struct field. In the former case, the type 1234 // undeclared; or b) it is a struct field. In the former case, the type
1235 // checker can do a top-level lookup, and in the latter case it will do 1235 // checker can do a top-level lookup, and in the latter case it will do
1236 // a separate field lookup. 1236 // a separate field lookup.
1237 x := p.checkExpr(p.parseExpr(keyOk)) 1237 x := p.checkExpr(p.parseExpr(keyOk))
1238 if keyOk { 1238 if keyOk {
1239 if p.tok == token.COLON { 1239 if p.tok == token.COLON {
1240 colon := p.pos 1240 colon := p.pos
1241 p.next() 1241 p.next()
1242 // Try to resolve the key but don't collect it 1242 // Try to resolve the key but don't collect it
1243 // as unresolved identifier if it fails so that 1243 // as unresolved identifier if it fails so that
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2401 Doc: doc, 2401 Doc: doc,
2402 Package: pos, 2402 Package: pos,
2403 Name: ident, 2403 Name: ident,
2404 Decls: decls, 2404 Decls: decls,
2405 Scope: p.pkgScope, 2405 Scope: p.pkgScope,
2406 Imports: p.imports, 2406 Imports: p.imports,
2407 Unresolved: p.unresolved[0:i], 2407 Unresolved: p.unresolved[0:i],
2408 Comments: p.comments, 2408 Comments: p.comments,
2409 } 2409 }
2410 } 2410 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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