code: func (c *Compiler) resolveAllRefs() {
  
  	rules := c.getExports()
  
  	for _, name := range c.sorted {
  		mod := c.Modules[name]
  
  		var ruleExports []Var
  		if x, ok := rules.Get(mod.Package.Path); ok {
  			ruleExports = x.([]Var)
  		}
  
  		globals := getGlobals(mod.Package, ruleExports, mod.Imports)
  
  		WalkRules(mod, func(rule *Rule) bool {
  			err := resolveRefsInRule(globals, rule)
  			if err != nil {
  				c.err(NewError(CompileErr, rule.Location, err.Error()))
  			}
  			return false
  		})
  
  		// Once imports have been resolved, they are no longer needed.
  		mod.Imports = nil
  	}
  
  	if c.moduleLoader != nil {
  
  		parsed, err := c.moduleLoader(c.Modules)
  		if err != nil {
  			c.err(NewError(CompileErr, nil, err.Error()))
  			return
  		}
  
  		if len(parsed) == 0 {
  			return
  		}
  
  		for id, module := range parsed {
  			c.Modules[id] = module
  			c.sorted = append(c.sorted, id)
  		}
  
  		sort.Strings(c.sorted)
  		c.resolveAllRefs()
  	}
  }
docs: // resolveAllRefs resolves references in expressions to their fully qualified values.
  //
  // For instance, given the following module:
  //
  // package a.b
  // import data.foo.bar
  // p[x] { bar[_] = x }
  //
  // The reference "bar[_]" would be resolved to "data.foo.bar[_]".