@@ -211,14 +211,37 @@ pub enum Expr {
211211
212212#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
213213pub enum BoxedExpr {
214+ // (have start and end as usize in each variant)
214215 // nullary
215- Const ( BitVecValue ) ,
216- Sym ( SymbolId ) ,
217- DontCare ,
216+ Const ( BitVecValue , usize , usize ) ,
217+ Sym ( SymbolId , usize , usize ) ,
218+ DontCare ( usize , usize ) ,
218219 // unary
219- Binary ( BinOp , Box < BoxedExpr > , Box < BoxedExpr > ) ,
220+ Binary ( BinOp , Box < BoxedExpr > , Box < BoxedExpr > , usize , usize ) ,
220221 // binary
221- Unary ( UnaryOp , Box < BoxedExpr > ) ,
222+ Unary ( UnaryOp , Box < BoxedExpr > , usize , usize ) ,
223+ }
224+
225+ impl BoxedExpr {
226+ pub fn start ( & self ) -> usize {
227+ match self {
228+ BoxedExpr :: Const ( _, start, _) => * start,
229+ BoxedExpr :: Sym ( _, start, _) => * start,
230+ BoxedExpr :: DontCare ( start, _) => * start,
231+ BoxedExpr :: Binary ( _, _, _, start, _) => * start,
232+ BoxedExpr :: Unary ( _, _, start, _) => * start,
233+ }
234+ }
235+
236+ pub fn end ( & self ) -> usize {
237+ match self {
238+ BoxedExpr :: Const ( _, _, end) => * end,
239+ BoxedExpr :: Sym ( _, _, end) => * end,
240+ BoxedExpr :: DontCare ( _, end) => * end,
241+ BoxedExpr :: Binary ( _, _, _, _, end) => * end,
242+ BoxedExpr :: Unary ( _, _, _, end) => * end,
243+ }
244+ }
222245}
223246
224247// add further bin ops
@@ -275,7 +298,6 @@ entity_impl!(SymbolId, "symbol");
275298#[ derive( Debug , Clone , Eq , PartialEq , Default ) ]
276299pub struct SymbolTable {
277300 entries : PrimaryMap < SymbolId , SymbolTableEntry > ,
278- // FIXME: Use by_name map
279301 by_name : FxHashMap < String , SymbolId > ,
280302 structs : PrimaryMap < StructId , Struct > ,
281303}
0 commit comments