func (p *Package) parseFiles() ([]*ast.File, error) {
	// TODO: do this concurrently.
	var files []*ast.File
	var fileErrs []error
	for _, file := range p.GoFiles {
		f, err := p.parseFile(filepath.Join(p.Package.Dir, file), parser.ParseComments)
		if err != nil {
			fileErrs = append(fileErrs, err)
			continue
		}
		if err != nil {
			fileErrs = append(fileErrs, err)
			continue
		}
		files = append(files, f)
	}
	for _, file := range p.CgoFiles {
		path := filepath.Join(p.Package.Dir, file)
		f, err := p.parseFile(path, parser.ParseComments)
		if err != nil {
			fileErrs = append(fileErrs, err)
			continue
		}
		files = append(files, f)
	}
	if len(p.CgoFiles) != 0 {
		clangIncludes := ""
		if _, err := os.Stat(filepath.Join(p.TINYGOROOT, "llvm", "tools", "clang", "lib", "Headers")); !os.IsNotExist(err) {
			// Running from the source directory.
			clangIncludes = filepath.Join(p.TINYGOROOT, "llvm", "tools", "clang", "lib", "Headers")
		} else {
			// Running from the installation directory.
			clangIncludes = filepath.Join(p.TINYGOROOT, "lib", "clang", "include")
		}
		generated, errs := cgo.Process(files, p.Program.Dir, p.fset, append(p.CFlags, "-I"+p.Package.Dir, "-I"+clangIncludes))
		if errs != nil {
			fileErrs = append(fileErrs, errs...)
		}
		files = append(files, generated)
	}
	if len(fileErrs) != 0 {
		return nil, Errors{p, fileErrs}
	}
	return files, nil
}
// parseFiles parses the loaded list of files and returns this list.
parseFiles parses the loaded list of files and returns this list.
// parseFiles parses the loaded list of files and returns this list .
func (p *Package) parseFiles() ([]*ast.File, error) {
	var files []*ast.File
	var fileErrs []error
	for _, file := range p.GoFiles {
		f, err := p.parseFile(filepath.Join(p.Package.Dir, file), parser.ParseComments)
		if err != nil {
			fileErrs = append(fileErrs, err)
			continue
		}
		if err != nil {
			fileErrs = append(fileErrs, err)
			continue
		}
		files = append(files, f)
	}
	for _, file := range p.CgoFiles {
		path := filepath.Join(p.Package.Dir, file)
		f, err := p.parseFile(path, parser.ParseComments)
		if err != nil {
			fileErrs = append(fileErrs, err)
			continue
		}
		files = append(files, f)
	}
	if len(p.CgoFiles) != 0 {
		clangIncludes := ""
		if _, err := os.Stat(filepath.Join(p.TINYGOROOT, "llvm", "tools", "clang", "lib", "Headers")); !os.IsNotExist(err) {
			clangIncludes = filepath.Join(p.TINYGOROOT, "llvm", "tools", "clang", "lib", "Headers")
		} else {
			clangIncludes = filepath.Join(p.TINYGOROOT, "lib", "clang", "include")
		}
		generated, errs := cgo.Process(files, p.Program.Dir, p.fset, append(p.CFlags, "-I"+p.Package.Dir, "-I"+clangIncludes))
		if errs != nil {
			fileErrs = append(fileErrs, errs...)
		}
		files = append(files, generated)
	}
	if len(fileErrs) != 0 {
		return nil, Errors{p, fileErrs}
	}
	return files, nil
}
func ( p * Package ) parseFiles ( ) ( [ ] * ast . File , error ) { var files [ ] * ast . File var fileErrs [ ] error for _ , file := range p . GoFiles { f , err := p . parseFile ( filepath . Join ( p . Package . Dir , file ) , parser . ParseComments ) if err != nil { fileErrs = append ( fileErrs , err ) continue } if err != nil { fileErrs = append ( fileErrs , err ) continue } files = append ( files , f ) } for _ , file := range p . CgoFiles { path := filepath . Join ( p . Package . Dir , file ) f , err := p . parseFile ( path , parser . ParseComments ) if err != nil { fileErrs = append ( fileErrs , err ) continue } files = append ( files , f ) } if len ( p . CgoFiles ) != 0 { clangIncludes := " " if _ , err := os . Stat ( filepath . Join ( p . TINYGOROOT , " " , " " , " " , " " , " " ) ) ; ! os . IsNotExist ( err ) { clangIncludes = filepath . Join ( p . TINYGOROOT , " " , " " , " " , " " , " " ) } else { clangIncludes = filepath . Join ( p . TINYGOROOT , " " , " " , " " ) } generated , errs := cgo . Process ( files , p . Program . Dir , p . fset , append ( p . CFlags , " " + p . Package . Dir , " " + clangIncludes ) ) if errs != nil { fileErrs = append ( fileErrs , errs ... ) } files = append ( files , generated ) } if len ( fileErrs ) != 0 { return nil , Errors { p , fileErrs } } return files , nil }
parseFiles parses the loaded list of files and returns this list.
parseFiles parses the loaded list of files and returns this list .
// TODO: do this concurrently. // Running from the source directory. // Running from the installation directory.