Mike Gerwitz

Activist for User Freedom

diff options
authorMike Gerwitz <mike.gerwitz@ryansg.com>2020-03-14 00:10:03 -0400
committerMike Gerwitz <mike.gerwitz@ryansg.com>2020-03-24 09:56:20 -0400
commit5fb68f9b677dff593159a9986be8da7f72b16b0d (patch)
tree070b25bc22722a7088026a5f75c14d23c4806eb0 /tamer/src/ld/poc.rs
parentf20120787f7505d98296f933cc6dde134ca5ebba (diff)
TAMER: Make Asg generic over object
There's a lot here to make the object stored on the `Asg` generic. This introduces `ObjectState` for state transitions and `ObjectData` for pure data retrieval. This will allow not only for mocking, but will be useful to enforce compile-time restrictions on the type of objects expected by the linker vs. the compiler (e.g. the linker will not have expressions). This commit intentionally leaves the corresponding tests in their original location to prove that the functionality has not changed; they'll be moved in a future commit. This also leaves the names as "Object" to reduce the number the cognative overhead of this commit. It will be renamed to something like "IdentObject" in the near future to clarify the intent of the current object type and to open the way for expressions and a type that marries both of them in the future. Once all of this is done, we'll finally be able to make changes to the compatibility logic in state transitions to implement extern compatibility checks during resolution. DEV-7087
Diffstat (limited to 'tamer/src/ld/poc.rs')
1 files changed, 2 insertions, 2 deletions
diff --git a/tamer/src/ld/poc.rs b/tamer/src/ld/poc.rs
index def7730..7ddfc36 100644
--- a/tamer/src/ld/poc.rs
+++ b/tamer/src/ld/poc.rs
@@ -34,8 +34,8 @@ use std::error::Error;
use std::fs;
use std::io::BufReader;
+type LinkerAsg<'i> = DefaultAsg<'i, Object<'i>, global::ProgIdentSize>;
type LinkerObjectRef = ObjectRef<global::ProgIdentSize>;
-type LinkerAsg<'i> = DefaultAsg<'i, global::ProgIdentSize>;
type LoadResult<'i> =
Result<Option<(Option<&'i Symbol<'i>>, Option<String>)>, Box<dyn Error>>;
@@ -251,7 +251,7 @@ fn get_ident<'a, 'i>(
fn output_xmle<'a, 'i, I: Interner<'i>>(
depgraph: &'a LinkerAsg<'i>,
interner: &'i I,
- sorted: &mut Sections<'a, 'i>,
+ sorted: &mut Sections<'a, Object<'i>>,
name: &'i Symbol<'i>,
relroot: String,
output: &str,