}}}
(chunk []ast.Stmt, name string)
| 1847 | } // }}} |
| 1848 | |
| 1849 | func Compile(chunk []ast.Stmt, name string) (proto *FunctionProto, err error) { // {{{ |
| 1850 | defer func() { |
| 1851 | if rcv := recover(); rcv != nil { |
| 1852 | if _, ok := rcv.(*CompileError); ok { |
| 1853 | err = rcv.(error) |
| 1854 | } else { |
| 1855 | panic(rcv) |
| 1856 | } |
| 1857 | } |
| 1858 | }() |
| 1859 | err = nil |
| 1860 | parlist := &ast.ParList{HasVargs: true, Names: []string{}} |
| 1861 | funcexpr := &ast.FunctionExpr{ParList: parlist, Stmts: chunk} |
| 1862 | if len(chunk) > 0 { |
| 1863 | funcexpr.SetLastLine(sline(chunk[0])) |
| 1864 | funcexpr.SetLastLine(eline(chunk[len(chunk)-1]) + 1) |
| 1865 | } |
| 1866 | context := newFuncContext(name, nil) |
| 1867 | compileFunctionExpr(context, funcexpr, ecnone(0)) |
| 1868 | proto = context.Proto |
| 1869 | return |
| 1870 | } // }}} |
searching dependent graphs…