MCPcopy Create free account
hub / github.com/nsf/gocode / process_data

Method process_data

autocompletefile.go:67–110  ·  view source on GitHub ↗

this one is used for current file buffer exclusively

(data []byte)

Source from the content-addressed store, hash-verified

65
66// this one is used for current file buffer exclusively
67func (f *auto_complete_file) process_data(data []byte) {
68 cur, filedata, block := rip_off_decl(data, f.cursor)
69 file, err := parser.ParseFile(f.fset, "", filedata, parser.AllErrors)
70 if err != nil && *g_debug {
71 log_parse_error("Error parsing input file (outer block)", err)
72 }
73 f.package_name = package_name(file)
74
75 f.decls = make(map[string]*decl)
76 f.packages = collect_package_imports(f.name, file.Decls, f.context)
77 f.filescope = new_scope(nil)
78 f.scope = f.filescope
79
80 for _, d := range file.Decls {
81 anonymify_ast(d, 0, f.filescope)
82 }
83
84 // process all top-level declarations
85 for _, decl := range file.Decls {
86 append_to_top_decls(f.decls, decl, f.scope)
87 }
88 if block != nil {
89 // process local function as top-level declaration
90 decls, err := parse_decl_list(f.fset, block)
91 if err != nil && *g_debug {
92 log_parse_error("Error parsing input file (inner block)", err)
93 }
94
95 for _, d := range decls {
96 anonymify_ast(d, 0, f.filescope)
97 }
98
99 for _, decl := range decls {
100 append_to_top_decls(f.decls, decl, f.scope)
101 }
102
103 // process function internals
104 f.cursor = cur
105 for _, decl := range decls {
106 f.process_decl_locals(decl)
107 }
108 }
109
110}
111
112func (f *auto_complete_file) process_decl_locals(decl ast.Decl) {
113 switch t := decl.(type) {

Callers

nothing calls this directly

Calls 9

process_decl_localsMethod · 0.95
rip_off_declFunction · 0.85
log_parse_errorFunction · 0.85
package_nameFunction · 0.85
collect_package_importsFunction · 0.85
new_scopeFunction · 0.85
anonymify_astFunction · 0.85
append_to_top_declsFunction · 0.85
parse_decl_listFunction · 0.85

Tested by

no test coverage detected