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

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

Issue 195041: code review 195041: Bug in go/parser when coverting identifier lists. (Closed)
Left Patch Set: code review 195041: Bug in go/parser when coverting identifier lists. Created 14 years, 2 months ago
Right Patch Set: code review 195041: Bug in go/parser when coverting identifier lists. Created 14 years, 2 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/go/parser/parser_test.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
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 // A parser for Go source files. Input may be provided in a variety of 5 // A parser for Go source files. Input may be provided in a variety of
6 // forms (see the various Parse* functions); the output is an abstract 6 // forms (see the various Parse* functions); the output is an abstract
7 // syntax tree (AST) representing the Go source. The parser is invoked 7 // syntax tree (AST) representing the Go source. The parser is invoked
8 // through one of the Parse* functions. 8 // through one of the Parse* functions.
9 // 9 //
10 package parser 10 package parser
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 457 }
458 458
459 459
460 func (p *parser) makeIdentList(list *vector.Vector) []*ast.Ident { 460 func (p *parser) makeIdentList(list *vector.Vector) []*ast.Ident {
461 idents := make([]*ast.Ident, len(*list)) 461 idents := make([]*ast.Ident, len(*list))
462 for i, x := range *list { 462 for i, x := range *list {
463 ident, isIdent := x.(*ast.Ident) 463 ident, isIdent := x.(*ast.Ident)
464 if !isIdent { 464 if !isIdent {
465 pos := x.(ast.Expr).Pos() 465 pos := x.(ast.Expr).Pos()
466 p.errorExpected(pos, "identifier") 466 p.errorExpected(pos, "identifier")
467 » » » ident = &ast.Ident{pos, ast.NewObj(ast.Err, pos, "")} 467 » » » ident = &ast.Ident{pos, ast.NewObj(ast.Err, pos, "_")}
468 } 468 }
469 idents[i] = ident 469 idents[i] = ident
470 } 470 }
471 return idents 471 return idents
472 } 472 }
473 473
474 474
475 func (p *parser) parseFieldDecl() *ast.Field { 475 func (p *parser) parseFieldDecl() *ast.Field {
476 if p.trace { 476 if p.trace {
477 defer un(trace(p, "FieldDecl")) 477 defer un(trace(p, "FieldDecl"))
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 2058
2059 // convert declaration list 2059 // convert declaration list
2060 decls = make([]ast.Decl, len(list)) 2060 decls = make([]ast.Decl, len(list))
2061 for i, x := range list { 2061 for i, x := range list {
2062 decls[i] = x.(ast.Decl) 2062 decls[i] = x.(ast.Decl)
2063 } 2063 }
2064 } 2064 }
2065 2065
2066 return &ast.File{doc, pos, ident, decls, p.comments} 2066 return &ast.File{doc, pos, ident, decls, p.comments}
2067 } 2067 }
LEFTRIGHT

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