Split EntityMap into entity::PrimaryMap and entity::EntityMap.
The new PrimaryMap replaces the primary EntityMap and the PrimaryEntityData marker trait which was causing some confusion. We now have a clear division between the two types of maps: - PrimaryMap is used to assign entity numbers to the primary data for an entity. - EntityMap is a secondary mapping adding additional info. The split also means that the secondary EntityMap can now behave as if all keys have a default value. This means that we can get rid of the annoying ensure() and get_or_default() methods ther were used everywhere instead of indexing. Just use normal indexing now; non-existent keys will return the default value.
This commit is contained in:
@@ -1388,7 +1388,7 @@ impl<'a> Parser<'a> {
|
||||
.expect("duplicate inst references created");
|
||||
|
||||
if let Some(encoding) = encoding {
|
||||
*ctx.function.encodings.ensure(inst) = encoding;
|
||||
ctx.function.encodings[inst] = encoding;
|
||||
}
|
||||
|
||||
if results.len() != num_results {
|
||||
@@ -1421,7 +1421,7 @@ impl<'a> Parser<'a> {
|
||||
.inst_results(inst)
|
||||
.iter()
|
||||
.zip(result_locations) {
|
||||
*ctx.function.locations.ensure(value) = loc;
|
||||
ctx.function.locations[value] = loc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user