aboutsummaryrefslogtreecommitdiff
path: root/crates/libanalysis/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-15 15:24:20 +0100
committerAleksey Kladov <[email protected]>2018-08-15 15:24:20 +0100
commit9f6cf42c5fd0bd98dd3445239f2c6414e8fd9324 (patch)
tree5e6496a681a56e9fd1b6e6bae196538cd471e2d0 /crates/libanalysis/src
parent109658332a75ca91d6dc2bf573e0ab77fa5619ca (diff)
Switch to file ids
Diffstat (limited to 'crates/libanalysis/src')
-rw-r--r--crates/libanalysis/src/lib.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/crates/libanalysis/src/lib.rs b/crates/libanalysis/src/lib.rs
index fc0b9ee9a..7c52080cb 100644
--- a/crates/libanalysis/src/lib.rs
+++ b/crates/libanalysis/src/lib.rs
@@ -37,7 +37,6 @@ pub type Result<T> = ::std::result::Result<T, ::failure::Error>;
37const INDEXING_THRESHOLD: usize = 128; 37const INDEXING_THRESHOLD: usize = 128;
38 38
39pub struct WorldState { 39pub struct WorldState {
40 next_file_id: u32,
41 data: Arc<WorldData> 40 data: Arc<WorldData>
42} 41}
43 42
@@ -47,12 +46,11 @@ pub struct World {
47} 46}
48 47
49#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 48#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
50pub struct FileId(u32); 49pub struct FileId(pub u32);
51 50
52impl WorldState { 51impl WorldState {
53 pub fn new() -> WorldState { 52 pub fn new() -> WorldState {
54 WorldState { 53 WorldState {
55 next_file_id: 0,
56 data: Arc::new(WorldData::default()) 54 data: Arc::new(WorldData::default())
57 } 55 }
58 } 56 }
@@ -61,12 +59,6 @@ impl WorldState {
61 World { data: self.data.clone() } 59 World { data: self.data.clone() }
62 } 60 }
63 61
64 pub fn new_file_id(&mut self) -> FileId {
65 let id = FileId(self.next_file_id);
66 self.next_file_id += 1;
67 id
68 }
69
70 pub fn change_file(&mut self, file_id: FileId, text: Option<String>) { 62 pub fn change_file(&mut self, file_id: FileId, text: Option<String>) {
71 self.change_files(::std::iter::once((file_id, text))); 63 self.change_files(::std::iter::once((file_id, text)));
72 } 64 }