Skip to content

Commit e5dbb16

Browse files
committed
transpile: Do not unwrap Paren with CExprId index
1 parent 55063c8 commit e5dbb16

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

  • c2rust-transpile/src/c_ast

c2rust-transpile/src/c_ast/mod.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,21 +1519,15 @@ impl Index<CTypeId> for TypedAstContext {
15191519

15201520
impl Index<CExprId> for TypedAstContext {
15211521
type Output = CExpr;
1522+
15221523
fn index(&self, index: CExprId) -> &CExpr {
15231524
static BADEXPR: CExpr = Located {
15241525
loc: None,
15251526
kind: CExprKind::BadExpr,
15261527
};
15271528
match self.c_exprs.get(&index) {
15281529
None => &BADEXPR, // panic!("Could not find {:?} in TypedAstContext", index),
1529-
Some(e) => {
1530-
// Transparently index through Paren expressions
1531-
if let CExprKind::Paren(_, subexpr) = e.kind {
1532-
self.index(subexpr)
1533-
} else {
1534-
e
1535-
}
1536-
}
1530+
Some(e) => e,
15371531
}
15381532
}
15391533
}

0 commit comments

Comments
 (0)