// Generate takes the typechecked inputs, and generates the shim file for the relevant
// identifiers.
Generate takes the typechecked inputs, and generates the shim file for the relevant
identifiers.
// Generate takes the typechecked inputs and generates the shim file for the relevant // identifiers .
func Generate(w io.Writer, filename, pkg string, ids []string, fset *token.FileSet, files []*ast.File) error {
	e := starcgenx.NewExtractor(pkg)
	e.Ids = ids
	imp := importer.For("source", nil)
	if err := e.FromAsts(imp, fset, files); err != nil {
		if _, errw := w.Write(e.Bytes()); errw != nil {
			return fmt.Errorf("error writing debug data to file after err %v:%v", err, errw)
		}
		return fmt.Errorf("error extracting from asts: %v", err)
	}
	e.Print("*/\n")
	data := e.Generate(filename)
	if err := write(w, []byte(license)); err != nil {
		return err
	}
	return write(w, data)
}
func Generate ( w io . Writer , filename , pkg string , ids [ ] string , fset * token . FileSet , files [ ] * ast . File ) error { e := starcgenx . NewExtractor ( pkg ) e . Ids = ids imp := importer . For ( " " , nil ) if err := e . FromAsts ( imp , fset , files ) ; err != nil { if _ , errw := w . Write ( e . Bytes ( ) ) ; errw != nil { return fmt . Errorf ( " " , err , errw ) } return fmt . Errorf ( " " , err ) } e . Print ( " \n " ) data := e . Generate ( filename ) if err := write ( w , [ ] byte ( license ) ) ; err != nil { return err } return write ( w , data ) }
Generate takes the typechecked inputs, and generates the shim file for the relevant
identifiers.
Generate takes the typechecked inputs and generates the shim file for the relevant identifiers .
// Importing from source should work in most cases. // Always print out the debugging info to the file.