diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-06 18:29:39 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-07-06 18:34:51 -0400 |
| commit | d950805b6c65435158cd64c63c2d2af290061d30 (patch) | |
| tree | 18326414008baf28a2b066b47c24436dedf318ad /src | |
| parent | cdc62a3c9d2a6b6eabf6d18e7c5077b6c861b7c4 (diff) | |
Run the parser when indexing with the temporary allocator to avoid leaks
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/build.odin | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/server/build.odin b/src/server/build.odin index 9db5c43..b8056fe 100644 --- a/src/server/build.odin +++ b/src/server/build.odin @@ -232,11 +232,17 @@ index_file :: proc(uri: common.Uri, text: string) -> common.Error { pkg = pkg, } - ok = parser.parse_file(&p, &file) + { + allocator := context.allocator + context.allocator = context.temp_allocator + defer context.allocator = allocator + + ok = parser.parse_file(&p, &file) - if !ok { - if !strings.contains(fullpath, "builtin.odin") && !strings.contains(fullpath, "intrinsics.odin") { - log.errorf("error in parse file for indexing %v", fullpath) + if !ok { + if !strings.contains(fullpath, "builtin.odin") && !strings.contains(fullpath, "intrinsics.odin") { + log.errorf("error in parse file for indexing %v", fullpath) + } } } |