// RenderInterface renders any value and returns the resulting value.
180034
func RenderInterface(v interface{}, ctx *Context) (interface{}, error) {
	f := func(v string) (string, error) {
		return Render(v, ctx)
	}

	walker := &renderWalker{
		F:       f,
		Replace: true,
	}
	err := reflectwalk.Walk(v, walker)
	if err != nil {
		return nil, err
	}

	if walker.Top != nil {
		v = walker.Top
	}
	return v, nil
}
310942
func resolveInterface(uses map[*ast.Ident]types.Object, iface *ast.InterfaceType) error {
	var rmi []int
	for i, m := range iface.Methods.List {
		if len(m.Names) > 0 {
			continue
		}
		newIface, err := exprInterfaceType(uses, m.Type)
		if err != nil {
			return err
		}
		iface.Methods.List = append(iface.Methods.List, newIface.Methods.List...)
		rmi = append(rmi, i)
	}

	// After adding the signatures, remove the embedded interface
	for i := len(rmi) - 1; i >= 0; i-- {
		iface.Methods.List = append(iface.Methods.List[:i], iface.Methods.List[i+1:]...)
	}

	return nil
}
456886
func (d *Datum) SetInterface(x interface{}) {
	d.k = KindInterface
	d.x = x
}
391620
func (d *decodeState) valueInterface() (interface{}, error) {
	switch d.scanWhile(scanSkipSpace) {
	default:
		return nil, errPhase
	case scanBeginArray:
		return d.arrayInterface()
	case scanBeginObject:
		return d.objectInterface()
	case scanBeginLiteral:
		return d.literalInterface()
	}
}
617283
func (c *Context) Render(name string, data interface{}) error {
	return c.weavebox.templateEngine.Render(c.Response(), name, data)
}
232141
func mergeInterfaces(a map[string]interface{}, b map[string]interface{}) (c map[string]interface{}, ok bool) {

	c = map[string]interface{}{}
	for k := range a {
		c[k] = a[k]
	}

	for k := range b {

		add := b[k]
		exist, ok := c[k]
		if !ok {
			c[k] = add
			continue
		}

		existObj, existOk := exist.(map[string]interface{})
		addObj, addOk := add.(map[string]interface{})
		if !existOk || !addOk {
			return nil, false
		}

		c[k], ok = mergeInterfaces(existObj, addObj)
		if !ok {
			return nil, false
		}
	}

	return c, true
}
247927
func (client *Client) DescribeRouterInterfaces(args *DescribeRouterInterfacesArgs) (response *DescribeRouterInterfacesResponse, err error) {
	response = &DescribeRouterInterfacesResponse{}
	err = client.Invoke("DescribeRouterInterfaces", args, &response)
	if err != nil {
		return response, err
	}
	return response, nil
}
285007
func (renderer *HTMLTemplateRenderer) Render(template string, model Model) error {
	templates, err := renderer.provider.Provide()
	if err != nil {
		renderer.errorf(template, err)
		return err
	}
	setContentType(renderer.writer, ContentHTML)
	err = templates.ExecuteTemplate(renderer.writer, template, model)
	if err != nil {
		renderer.errorf(template, err)
		return err
	}
	return nil
}
396873
func (r *Renderer) Render(str []byte) []byte {
	bl, sl, el := len(r.begin), len(str), len(r.end)
	data := make([]byte, bl+sl+el)
	copy(data, r.begin)
	copy(data[bl:], str)
	copy(data[bl+sl:], r.end)
	return data
}
907519
func (f *Fake) IsInterface() bool {
	if f.Target == nil || f.Target.Type() == nil {
		return false
	}
	return types.IsInterface(f.Target.Type())
}
1296685
func (x XML) Render(w io.Writer, v interface{}) error {
	var result []byte
	var err error

	if x.Indent {
		result, err = xml.MarshalIndent(v, "", "  ")
		result = append(result, '\n')
	} else {
		result, err = xml.Marshal(v)
	}
	if err != nil {
		return err
	}

	// XML marshaled fine, write out the result.
	if hw, ok := w.(http.ResponseWriter); ok {
		x.Head.Write(hw)
	}
	if len(x.Prefix) > 0 {
		w.Write(x.Prefix)
	}
	w.Write(result)
	return nil
}
981597
func (this *Response) Render(view string, i ...interface{}) {
	i = append(i, this.Locals)
	s, err := this.app.Render(view, i...)
	if err != nil {
		// Need to do something about errors and next()
		fmt.Println(err)
		this.next()
		return
	}
	this.Send(s)
}
277034
func (d *decodeState) objectInterface(data Slice) map[string]interface{} {
	m := make(map[string]interface{})
	it, err := NewObjectIterator(data)
	if err != nil {
		d.error(err)
	}
	for it.IsValid() {
		key, err := it.Key(true)
		if err != nil {
			d.error(err)
		}
		keyStr, err := key.GetString()
		if err != nil {
			d.error(err)
		}
		value, err := it.Value()
		if err != nil {
			d.error(err)
		}

		// Read value.
		m[keyStr] = d.valueInterface(value)

		// Move to next field
		if err := it.Next(); err != nil {
			d.error(err)
		}
	}
	return m
}
8579
func (a *Module) InitRenderer(conf *render.Config, funcMap map[string]interface{}) *Module {
	a.Renderer, a.Resource = a.Application.NewRenderer(conf, a, funcMap)
	if a.Handler != nil {
		a.Handler.SetRenderer(a.Renderer)
		//为了支持域名绑定和解除绑定，此处使用路由Hander的方式服务静态资源文件
		a.Resource.Wrapper(a.Handler)
	} else {
		a.Group.Get(strings.TrimPrefix(a.Resource.Path, `/`+a.Name)+`/*`, a.Resource)
	}
	a.Use(mw.SimpleFuncMap(funcMap))
	return a
}
1257351
func Render(w http.ResponseWriter, r *http.Request, v Renderer) error {
	if err := renderer(w, r, v); err != nil {
		return err
	}
	Respond(w, r, v)
	return nil
}
1296354
func (s String) RenderTo(w io.Writer, resolve VariableResolver) error {
	for _, term := range s {
		var value string
		switch t := term.(type) {
		case literal:
			value = string(t)
		case variable:
			if val, ok := resolve(t.Name); ok {
				value = val
			} else if t.HasDefault {
				value = t.Default
			} else {
				return errUnknownVariable{Name: t.Name}
			}
		}
		if _, err := io.WriteString(w, value); err != nil {
			return err
		}
	}
	return nil
}
319874
func (context *BaseContext) SetInterface(key string, value interface{}) {
	context.userData[key] = value
}