this one is used for current file buffer exclusively
(data []byte)
| 65 | |
| 66 | // this one is used for current file buffer exclusively |
| 67 | func (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 | |
| 112 | func (f *auto_complete_file) process_decl_locals(decl ast.Decl) { |
| 113 | switch t := decl.(type) { |
nothing calls this directly
no test coverage detected