Add PrimaryEntityData marker trait.
Require this trait on the value type stored in an EntityMap to 'unlock' the methods intended for primary entity maps that are allowed to create references with the 'push method. This prevents accidentally depending on these methods in secondary maps.
This commit is contained in:
@@ -10,7 +10,7 @@ pub mod dfg;
|
||||
pub mod layout;
|
||||
|
||||
use ir::types::{FunctionName, Signature};
|
||||
use entity_map::{EntityRef, EntityMap};
|
||||
use entity_map::{EntityRef, EntityMap, PrimaryEntityData};
|
||||
use ir::entities::{StackSlot, JumpTable};
|
||||
use ir::jumptable::JumpTableData;
|
||||
use ir::dfg::DataFlowGraph;
|
||||
@@ -39,6 +39,9 @@ pub struct Function {
|
||||
pub layout: Layout,
|
||||
}
|
||||
|
||||
// Tag JumpTableData as a primary entity so jump_tables above .
|
||||
impl PrimaryEntityData for JumpTableData {}
|
||||
|
||||
impl Function {
|
||||
/// Create a function with the given name and signature.
|
||||
pub fn with_name_signature(name: FunctionName, sig: Signature) -> Function {
|
||||
|
||||
Reference in New Issue
Block a user