code: func CheckDataRefs(reg template.Registry) (err error) {
  	var currentTemplate string
  	defer func() {
  		if err2 := recover(); err2 != nil {
  			err = fmt.Errorf("template %v: %v", currentTemplate, err2)
  		}
  	}()
  
  	for _, t := range reg.Templates {
  		currentTemplate = t.Node.Name
  		tc := newTemplateChecker(reg, t.Doc.Params)
  		tc.checkTemplate(t.Node.Body)
  
  		// check that all params appear in the usedKeys
  		for _, param := range tc.params {
  			if !contains(tc.usedKeys, param) {
  				panic(fmt.Errorf("param %q is unused", param))
  			}
  		}
  	}
  	return nil
  }
docs: // CheckDataRefs validates that:
  //  1. all data refs are provided by @params or {let} nodes (except $ij)
  //  2. any data declared as a @param is used by the template (or passed via {call})
  //  3. all {call} params are declared as @params in the called template soydoc.
  //  4. a {call}'ed template is passed all required @params, or a data="$var"
  //  5. {call}'d templates actually exist in the registry.
  //  6. any variable created by {let} is used somewhere
  //  7. {let} variable names are valid.  ('ij' is not allowed.)