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

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

Issue 189080: code review 189080: Steps towards tracking scopes for identifiers. (Closed)
Left Patch Set: code review 189080: Steps towards tracking scopes for identifiers. Created 15 years, 2 months ago
Right Patch Set: code review 189080: Steps towards tracking scopes for identifiers. Created 15 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 | « src/pkg/exp/eval/typec.go ('k') | src/pkg/exp/parser/parser.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 // This file contains the exported entry points for invoking the parser. 5 // This file contains the exported entry points for invoking the parser.
6 6
7 package oldParser 7 package oldParser
8 8
9 import ( 9 import (
10 "bytes" 10 "bytes"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 src, err := ioutil.ReadFile(filename) 141 src, err := ioutil.ReadFile(filename)
142 if err != nil { 142 if err != nil {
143 return nil, err 143 return nil, err
144 } 144 }
145 145
146 if pkgname != "" { 146 if pkgname != "" {
147 prog, err := ParseFile(filename, src, PackageClauseOnly) 147 prog, err := ParseFile(filename, src, PackageClauseOnly)
148 if err != nil { 148 if err != nil {
149 return nil, err 149 return nil, err
150 } 150 }
151 » » if prog.Name.Value() != pkgname { 151 » » if prog.Name.Name() != pkgname {
152 » » » return nil, os.NewError(fmt.Sprintf("multiple packages f ound: %s, %s", prog.Name.Value(), pkgname)) 152 » » » return nil, os.NewError(fmt.Sprintf("multiple packages f ound: %s, %s", prog.Name.Name(), pkgname))
153 } 153 }
154 if mode == PackageClauseOnly { 154 if mode == PackageClauseOnly {
155 return prog, nil 155 return prog, nil
156 } 156 }
157 } 157 }
158 158
159 return ParseFile(filename, src, mode) 159 return ParseFile(filename, src, mode)
160 } 160 }
161 161
162 162
(...skipping 19 matching lines...) Expand all
182 files := make(map[string]*ast.File) 182 files := make(map[string]*ast.File)
183 for i := 0; i < len(list); i++ { 183 for i := 0; i < len(list); i++ {
184 entry := &list[i] 184 entry := &list[i]
185 if filter == nil || filter(entry) { 185 if filter == nil || filter(entry) {
186 src, err := ParsePkgFile(name, pathutil.Join(path, entry .Name), mode) 186 src, err := ParsePkgFile(name, pathutil.Join(path, entry .Name), mode)
187 if err != nil { 187 if err != nil {
188 return nil, err 188 return nil, err
189 } 189 }
190 files[entry.Name] = src 190 files[entry.Name] = src
191 if name == "" { 191 if name == "" {
192 » » » » name = src.Name.Value() 192 » » » » name = src.Name.Name()
193 } 193 }
194 } 194 }
195 } 195 }
196 196
197 if len(files) == 0 { 197 if len(files) == 0 {
198 return nil, os.NewError(path + ": no package found") 198 return nil, os.NewError(path + ": no package found")
199 } 199 }
200 200
201 return &ast.Package{name, path, files}, nil 201 return &ast.Package{name, path, files}, nil
202 } 202 }
LEFTRIGHT

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