mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
tpl: Remove some unreached code branches
This commit is contained in:
parent
1bd7ac7ed9
commit
d037dee9a1
1 changed files with 11 additions and 33 deletions
|
@ -738,17 +738,9 @@ func (t *TemplateStore) UnusedTemplates() []*TemplInfo {
|
||||||
// Skip inline partials and internal templates.
|
// Skip inline partials and internal templates.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if vv.noBaseOf {
|
|
||||||
if vv.executionCounter.Load() == 0 {
|
if vv.executionCounter.Load() == 0 {
|
||||||
unused = append(unused, vv)
|
unused = append(unused, vv)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for vvv := range vv.BaseVariantsSeq() {
|
|
||||||
if vvv.Template.executionCounter.Load() == 0 {
|
|
||||||
unused = append(unused, vvv.Template)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sort.Sort(byPath(unused))
|
sort.Sort(byPath(unused))
|
||||||
|
@ -1543,6 +1535,9 @@ func (s *TemplateStore) resolveOutputFormatAndOrMediaType(ofs, mns string) (outp
|
||||||
return outputFormat, mediaType
|
return outputFormat, mediaType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// templates iterates over all templates in the store.
|
||||||
|
// Note that for templates with one or more base templates applied,
|
||||||
|
// we will yield the variants, e.g. the templates that's actually in use.
|
||||||
func (s *TemplateStore) templates() iter.Seq[*TemplInfo] {
|
func (s *TemplateStore) templates() iter.Seq[*TemplInfo] {
|
||||||
return func(yield func(*TemplInfo) bool) {
|
return func(yield func(*TemplInfo) bool) {
|
||||||
for _, v := range s.treeMain.All() {
|
for _, v := range s.treeMain.All() {
|
||||||
|
@ -1697,33 +1692,16 @@ func (s *TemplateStore) transformTemplates() error {
|
||||||
if vv.category == CategoryBaseof {
|
if vv.category == CategoryBaseof {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !vv.noBaseOf {
|
|
||||||
// TODO(bep) I don't think this branch is ever called.
|
|
||||||
for vvv := range vv.BaseVariantsSeq() {
|
|
||||||
tctx, err := applyTemplateTransformers(vvv.Template, lookup)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
for name, node := range tctx.deferNodes {
|
|
||||||
if err := s.addDeferredTemplate(vvv.Overlay, name, node); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
tctx, err := applyTemplateTransformers(vv, lookup)
|
tctx, err := applyTemplateTransformers(vv, lookup)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, node := range tctx.deferNodes {
|
for name, node := range tctx.deferNodes {
|
||||||
if err := s.addDeferredTemplate(vv, name, node); err != nil {
|
if err := s.addDeferredTemplate(vv, name, node); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue