mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Remove some redundant cmd/puffs/gen.go code.
This commit is contained in:
1 parent
7c85ed04f9
commit
f23a80820c
2 files changed
+5
-7
No files matched your search
+3
-5
@@ -14,7 +14,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/puffs/lang/ast"
|
|
||||||
"github.com/google/puffs/lang/parse"
|
"github.com/google/puffs/lang/parse"
|
||||||
"github.com/google/puffs/lang/render"
|
"github.com/google/puffs/lang/render"
|
||||||
"github.com/google/puffs/lang/token"
|
"github.com/google/puffs/lang/token"
|
||||||
@@ -72,7 +71,6 @@ func genDir(puffsRoot string, dirname string, filenames []string, langs []string
|
|||||||
// mtime is newer than all inputs and the puffs-gen-foo command.
|
// mtime is newer than all inputs and the puffs-gen-foo command.
|
||||||
|
|
||||||
tm := &token.Map{}
|
tm := &token.Map{}
|
||||||
files := []*ast.File(nil)
|
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
for _, filename := range filenames {
|
for _, filename := range filenames {
|
||||||
filename = filepath.Join(puffsRoot, filepath.FromSlash(dirname), filename)
|
filename = filepath.Join(puffsRoot, filepath.FromSlash(dirname), filename)
|
||||||
@@ -84,11 +82,11 @@ func genDir(puffsRoot string, dirname string, filenames []string, langs []string
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
f, err := parse.Parse(tm, filename, tokens)
|
// We don't need the AST node to pretty-print, but it's worth rejecting
|
||||||
if err != nil {
|
// syntax errors early. This is just a parse, not a full type check.
|
||||||
|
if _, err := parse.Parse(tm, filename, tokens); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
files = append(files, f)
|
|
||||||
if err := render.Render(buf, tm, tokens, nil); err != nil {
|
if err := render.Render(buf, tm, tokens, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,8 +112,8 @@ func do(r io.Reader, filename string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// We don't need the AST node to pretty-print, but it's worth puffsfmt
|
// We don't need the AST node to pretty-print, but it's worth rejecting
|
||||||
// rejecting syntax errors. This is just a parse, not a full type check.
|
// syntax errors early. This is just a parse, not a full type check.
|
||||||
if _, err := parse.Parse(tm, filename, tokens); err != nil {
|
if _, err := parse.Parse(tm, filename, tokens); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user