MCPcopy
hub / github.com/davyxu/tabtoy / Compile

Function Compile

v3/compiler/flow.go:10–86  ·  view source on GitHub ↗
(globals *model.Globals)

Source from the content-addressed store, hash-verified

8)
9
10func Compile(globals *model.Globals) (ret error) {
11
12 defer func() {
13
14 switch err := recover().(type) {
15 case *report.TableError:
16 ret = err
17 case nil:
18 default:
19 panic(err)
20 }
21
22 }()
23
24 model.InitBuiltinTypes(globals.Types)
25
26 report.Log.Debugf("Loading Index file: '%s'... ", globals.IndexFile)
27 err := LoadIndexTable(globals, globals.IndexFile)
28
29 if err != nil {
30 return err
31 }
32
33 // 测试时, 这个Getter会被提前设置为MemFile, 普通导出时, 这个Getter为空
34 if globals.TableGetter == nil {
35 tabLoader := helper.NewFileLoader(!globals.ParaLoading, globals.CacheDir)
36
37 if globals.ParaLoading {
38 for _, pragma := range globals.IndexList {
39 tabLoader.AddFile(pragma.TableFileName)
40 }
41
42 tabLoader.Commit()
43 }
44
45 globals.TableGetter = tabLoader
46 }
47
48 var kvList, dataList model.DataTableList
49
50 // 加载多种表
51 err = loadVariantTables(globals, &kvList, &dataList)
52
53 if err != nil {
54 return err
55 }
56
57 report.Log.Debugln("Checking types...")
58 checker.CheckType(globals.Types)
59 checker.PreCheck(&dataList)
60
61 if kvList.Count() > 0 {
62 report.Log.Debugln("Merge key-value tables...")
63
64 // 合并所有的KV表行
65 var mergedKV model.DataTableList
66 MergeData(&kvList, &mergedKV, globals.Types)
67

Callers 5

V3EntryFunction · 0.92
MustGotErrorMethod · 0.92
VerifyTypeMethod · 0.92
VerifyDataMethod · 0.92
VerifyGoTypeAndJsonMethod · 0.92

Calls 14

AddFileMethod · 0.95
CommitMethod · 0.95
CountMethod · 0.95
AllTablesMethod · 0.95
AddDataTableMethod · 0.95
InitBuiltinTypesFunction · 0.92
NewFileLoaderFunction · 0.92
CheckTypeFunction · 0.92
PreCheckFunction · 0.92
PostCheckFunction · 0.92
LoadIndexTableFunction · 0.85
loadVariantTablesFunction · 0.85

Tested by

no test coverage detected