// CompileWriter compiles amber and writes the Go Template source into given io.Writer instance.
// You would not be using this unless debugging / checking the output. Please use Compile
// method to obtain a template instance directly.
557591
func (c *Compiler) CompileWriter(out io.Writer) (err error) {
	defer func() {
		if r := recover(); r != nil {
			err = errors.New(r.(string))
		}
	}()

	c.buffer = new(bytes.Buffer)
	c.visit(c.node)

	if c.buffer.Len() > 0 {
		c.write("\n")
	}

	_, err = c.buffer.WriteTo(out)
	return
}
833032
func Compile(template string) (renderFn *js.Object) {
	return vue.Call("compile", template).Get("render")
}
1133636
func (_m *API) CompileServiceTemplate(_a0 api.CompileTemplateConfig) (*servicetemplate.ServiceTemplate, error) {
	ret := _m.Called(_a0)

	var r0 *servicetemplate.ServiceTemplate
	if rf, ok := ret.Get(0).(func(api.CompileTemplateConfig) *servicetemplate.ServiceTemplate); ok {
		r0 = rf(_a0)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*servicetemplate.ServiceTemplate)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(api.CompileTemplateConfig) error); ok {
		r1 = rf(_a0)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
947457
func (m *MockCompiler) Compile(arg0 pkg.Compilable) (pkg0.CompiledPackageRecord, bool, error) {
	ret := m.ctrl.Call(m, "Compile", arg0)
	ret0, _ := ret[0].(pkg0.CompiledPackageRecord)
	ret1, _ := ret[1].(bool)
	ret2, _ := ret[2].(error)
	return ret0, ret1, ret2
}
400412
func (c *Compiler) Compile(ctx context.Context, stmtNode ast.StmtNode) (*ExecStmt, error) {
	return c.compile(ctx, stmtNode, false)
}
112115
func (stmt RetInsertStmt) Compile(d aspect.Dialect, params *aspect.Parameters) (string, error) {
	compiled, err := stmt.InsertStmt.Compile(d, params)
	if err != nil {
		return "", err
	}
	if len(stmt.returning) > 0 {
		compiled += fmt.Sprintf(
			" RETURNING %s",
			strings.Join(
				stmt.CompileColumns(d, params, stmt.returning),
				", ",
			),
		)
	}
	return compiled, nil
}
1058460
func Compile(ctx context.Context, rawStmt ast.StmtNode) (plan.Plan, error) {
	info := ctx.GetSessionVars().TxnCtx.InfoSchema.(infoschema.InfoSchema)

	node := rawStmt
	err := resolver.ResolveName(node, info, ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	p, err := plan.Optimize(ctx, node, info)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return p, nil
}
605897
func compileTemplate(p, base string) error {
	ext := path.Ext(p)
	c, ok := compilers[ext]
	// Ignore file if no template compiler exist for this extension
	if ok {
		t, err := c.Compile(p)
		if err != nil {
			return err
		}
		key, err := filepath.Rel(base, p)
		if err != nil {
			return err
		}
		ghost.LogFn("ghost.templates : storing template for file %s", key)
		templaters[key] = t
	}
	return nil
}
70808
func CompileVyper(vyper string, sourcefiles ...string) (map[string]*Contract, error) {
	if len(sourcefiles) == 0 {
		return nil, errors.New("vyper: no source files")
	}
	source, err := slurpFiles(sourcefiles)
	if err != nil {
		return nil, err
	}
	s, err := VyperVersion(vyper)
	if err != nil {
		return nil, err
	}
	args := s.makeArgs()
	cmd := exec.Command(s.Path, append(args, sourcefiles...)...)
	return s.run(cmd, source)
}
880342
func makeWriter(typ reflect.Type, ts tags) (writer, error) {
	kind := typ.Kind()
	switch {
	case typ == rawValueType:
		return writeRawValue, nil
	case typ.Implements(encoderInterface):
		return writeEncoder, nil
	case kind != reflect.Ptr && reflect.PtrTo(typ).Implements(encoderInterface):
		return writeEncoderNoPtr, nil
	case kind == reflect.Interface:
		return writeInterface, nil
	case typ.AssignableTo(reflect.PtrTo(bigInt)):
		return writeBigIntPtr, nil
	case typ.AssignableTo(bigInt):
		return writeBigIntNoPtr, nil
	case isUint(kind):
		return writeUint, nil
	case kind == reflect.Bool:
		return writeBool, nil
	case kind == reflect.String:
		return writeString, nil
	case kind == reflect.Slice && isByte(typ.Elem()):
		return writeBytes, nil
	case kind == reflect.Array && isByte(typ.Elem()):
		return writeByteArray, nil
	case kind == reflect.Slice || kind == reflect.Array:
		return makeSliceWriter(typ, ts)
	case kind == reflect.Struct:
		return makeStructWriter(typ)
	case kind == reflect.Ptr:
		return makePtrWriter(typ)
	default:
		return nil, fmt.Errorf("rlp: type %v is not RLP-serializable", typ)
	}
}
1065601
func (mr *MockCompilerMockRecorder) Compile(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Compile", reflect.TypeOf((*MockCompiler)(nil).Compile), arg0)
}
126718
func compile(ctx context.Context, prog *progInfo, dir *directoryInfo, debug bool) (err error) {
	args := make([]string, 0, 16)
	if prog.OutputType == outputSource {
		args = append(args, "-E") // Preprocessor
	} else {
		args = append(args, "-emit-llvm")
		if debug {
			args = append(args, "-g")
		}
	}
	args = append(args, standardCFlags...)
	args = append(args, progCFlags(prog, dir)...)

	// Compilation is split between two exec calls. First clang generates
	// LLVM bitcode and then later llc compiles it to byte-code.
	log.WithFields(logrus.Fields{
		"target": compiler,
		"args":   args,
	}).Debug("Launching compiler")
	if prog.OutputType == outputSource {
		compileCmd := exec.CommandContext(ctx, compiler, args...)
		_, err = compileCmd.CombinedOutput(log, debug)
	} else {
		switch prog.OutputType {
		case outputObject:
			err = compileAndLink(ctx, prog, dir, debug, args...)
		case outputAssembly:
			err = compileAndLink(ctx, prog, dir, false, args...)
		default:
			log.Fatalf("Unhandled progInfo.OutputType %s", prog.OutputType)
		}
	}

	return err
}
1039987
func Write(out io.Writer, node ast.Node, options Options) (err error) {
	defer errRecover(&err)

	if options.Formatter == nil {
		options.Formatter = &ES5Formatter{}
	}

	var (
		tmpOut     = &bytes.Buffer{}
		importsBuf = &bytes.Buffer{}
		s          = &state{
			wr:          tmpOut,
			options:     options,
			funcsCalled: map[string]string{},
			funcsInFile: map[string]bool{},
		}
	)

	s.scope.push()
	s.walk(node)

	if len(s.funcsCalled) > 0 {
		for _, f := range difference(s.funcsCalled, s.funcsInFile) {
			importsBuf.WriteString(s.funcsCalled[f])
			importsBuf.WriteRune('\n')
		}
		importsBuf.WriteRune('\n')
	}

	out.Write(importsBuf.Bytes())
	out.Write(tmpOut.Bytes())

	return nil
}
1096799
func (acetmpl AceTemplate) Render(wr io.Writer, arg interface{}) error {
	// We can redirect this render to another template if the arguments contain ace_content in them
	if argmap, ok := arg.(map[string]interface{}); ok {
		if acecontentraw, ok := argmap["ace-inner"]; ok {
			acecontent := acecontentraw.(string)
			newtemplatename := acetmpl.TemplateName + "-" + acecontent
			// Now lookup the template again
			if _, ok := acetmpl.engine.templatesByName[newtemplatename]; !ok {
				if inner, ok := acetmpl.engine.templatesByName[acecontent]; !ok {
					return fmt.Errorf("Inner content %s not found in ace templates", acecontent)
				} else {
					acetmpl.engine.templatesByName[newtemplatename] = &AceTemplate{
						File:         acetmpl.File,
						Inner:        inner.File,
						engine:       acetmpl.engine,
						TemplateView: acetmpl.TemplateView}
				}

			}
			return acetmpl.engine.templatesByName[newtemplatename].renderInternal(wr, arg)
		}
	}
	return acetmpl.renderInternal(wr, arg)
}
794326
func (w *stdWriter) Write(p []byte) (n int, err error) {
	if w == nil || w.Writer == nil {
		return 0, errors.New("Writer not instantiated")
	}
	if p == nil {
		return 0, nil
	}

	header := [stdWriterPrefixLen]byte{stdWriterFdIndex: w.prefix}
	binary.BigEndian.PutUint32(header[stdWriterSizeIndex:], uint32(len(p)))
	buf := bufPool.Get().(*bytes.Buffer)
	buf.Write(header[:])
	buf.Write(p)

	n, err = w.Writer.Write(buf.Bytes())
	n -= stdWriterPrefixLen
	if n < 0 {
		n = 0
	}

	buf.Reset()
	bufPool.Put(buf)
	return
}
698761
func Compile(ctx context.Context, sctx sessionctx.Context, stmtNode ast.StmtNode) (sqlexec.Statement, error) {
	compiler := executor.Compiler{Ctx: sctx}
	stmt, err := compiler.Compile(ctx, stmtNode)
	return stmt, err
}
1246812
func (e *etc) Write(target io.Writer, prettyPrint bool) error {
	// Build the nodes tree.
	builder := sml.NewNodeBuilder()
	depth := 0
	err := e.values.DoAllDeep(func(ks []string, v string) error {
		doDepth := len(ks)
		tag := ks[doDepth-1]
		for i := depth; i > doDepth; i-- {
			builder.EndTagNode()
		}
		switch {
		case doDepth > depth:
			builder.BeginTagNode(tag)
			builder.TextNode(v)
			depth = doDepth
		case doDepth == depth:
			builder.EndTagNode()
			builder.BeginTagNode(tag)
			builder.TextNode(v)
		case doDepth < depth:
			builder.EndTagNode()
			builder.BeginTagNode(tag)
			builder.TextNode(v)
			depth = doDepth
		}
		return nil
	})
	if err != nil {
		return err
	}
	for i := depth; i > 0; i-- {
		builder.EndTagNode()
	}
	root, err := builder.Root()
	if err != nil {
		return err
	}
	// Now write the node structure.
	wp := sml.NewStandardSMLWriter()
	wctx := sml.NewWriterContext(wp, target, prettyPrint, "   ")
	return sml.WriteSML(root, wctx)
}