aboutsummaryrefslogtreecommitdiff
path: root/ARCHITECTURE.md
diff options
context:
space:
mode:
Diffstat (limited to 'ARCHITECTURE.md')
-rw-r--r--ARCHITECTURE.md20
1 files changed, 10 insertions, 10 deletions
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 823db0034..b326f9c71 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -20,7 +20,7 @@ memory and never does any IO. Because the input data is source code, which
20typically measures in tens of megabytes at most, keeping all input data in 20typically measures in tens of megabytes at most, keeping all input data in
21memory is OK. 21memory is OK.
22 22
23A "structured semantic model" is basically an object-oriented representations of 23A "structured semantic model" is basically an object-oriented representation of
24modules, functions and types which appear in the source code. This representation 24modules, functions and types which appear in the source code. This representation
25is fully "resolved": all expressions have types, all references are bound to 25is fully "resolved": all expressions have types, all references are bound to
26declarations, etc. 26declarations, etc.
@@ -90,29 +90,29 @@ fixes a bug in the grammar.
90We use [salsa][https://github.com/salsa-rs/salsa] crate for incremental and 90We use [salsa][https://github.com/salsa-rs/salsa] crate for incremental and
91on-demand computation. Roughly, you can think of salsa as a key-value store, but 91on-demand computation. Roughly, you can think of salsa as a key-value store, but
92it also can compute derived values using specified functions. The `ra_db` crate 92it also can compute derived values using specified functions. The `ra_db` crate
93provides a basic infrastructure for interracting with salsa. Crucially, it 93provides a basic infrastructure for interacting with salsa. Crucially, it
94defines most of the "input" queries: facts supplied by the client of the 94defines most of the "input" queries: facts supplied by the client of the
95analyzer. Reading the docs of the `ra_db::input` module should be useful: 95analyzer. Reading the docs of the `ra_db::input` module should be useful:
96everithing else is strictly derived from thouse inputs. 96everything else is strictly derived from those inputs.
97 97
98### `crates/ra_hir` 98### `crates/ra_hir`
99 99
100HIR provides a high-level "object oriented" acess to Rust code. 100HIR provides high-level "object oriented" access to Rust code.
101 101
102The principal difference between HIR and syntax trees is that HIR is bound to a 102The principal difference between HIR and syntax trees is that HIR is bound to a
103particular crate instance. That is, it has cfg flags and features applied (in 103particular crate instance. That is, it has cfg flags and features applied (in
104theory, in practice this is to be implemented). So, there relation between 104theory, in practice this is to be implemented). So, the relation between
105syntax and HIR is many-to-one. The `source_binder` modules is responsible for 105syntax and HIR is many-to-one. The `source_binder` modules is responsible for
106guessing a hir for a particular source position. 106guessing a HIR for a particular source position.
107 107
108Underneath, hir works on top of salsa, using a `HirDatabase` trait. 108Underneath, HIR works on top of salsa, using a `HirDatabase` trait.
109 109
110### `crates/ra_analysis` 110### `crates/ra_analysis`
111 111
112A stateful library for analyzing many Rust files as they change. 112A stateful library for analyzing many Rust files as they change.
113`AnalysisHost` is a mutable entity (clojure's atom) which holds 113`AnalysisHost` is a mutable entity (clojure's atom) which holds the
114current state, incorporates changes and handles out `Analysis` --- an 114current state, incorporates changes and handles out `Analysis` --- an
115immutable consistent snapshot of world state at a point in time, which 115immutable and consistent snapshot of world state at a point in time, which
116actually powers analysis. 116actually powers analysis.
117 117
118One interesting aspect of analysis is its support for cancellation. When a change 118One interesting aspect of analysis is its support for cancellation. When a change
@@ -137,7 +137,7 @@ without the need to fiddle with build-systems, file
137synchronization and such. 137synchronization and such.
138 138
139In a sense, `ra_editor` is just a bunch of pure functions which take a 139In a sense, `ra_editor` is just a bunch of pure functions which take a
140syntax tree as an input. 140syntax tree as input.
141 141
142The tests for `ra_editor` are `#[cfg(test)] mod tests` unit-tests spread 142The tests for `ra_editor` are `#[cfg(test)] mod tests` unit-tests spread
143throughout its modules. 143throughout its modules.