aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/expr.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-12-24 12:04:28 +0000
committerGitHub <[email protected]>2020-12-24 12:04:28 +0000
commit06320015af0c966df3deef9994b535fb110d303e (patch)
treec067698863b8f6e2d7ab9778b7e23e19fbfcf0b9 /crates/hir_def/src/expr.rs
parent1487f2f10efe2d0a54e8627692643f3a48ffdbff (diff)
parent262b9c39824b58068d89d6c5cf53d8fea782b11c (diff)
Merge #7021
7021: Track labels in the HIR r=matklad a=Veykril Groundwork for #6966 Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_def/src/expr.rs')
-rw-r--r--crates/hir_def/src/expr.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/hir_def/src/expr.rs b/crates/hir_def/src/expr.rs
index 3bba30397..6a481769d 100644
--- a/crates/hir_def/src/expr.rs
+++ b/crates/hir_def/src/expr.rs
@@ -30,6 +30,12 @@ pub(crate) fn dummy_expr_id() -> ExprId {
30pub type PatId = Idx<Pat>; 30pub type PatId = Idx<Pat>;
31 31
32#[derive(Debug, Clone, Eq, PartialEq)] 32#[derive(Debug, Clone, Eq, PartialEq)]
33pub struct Label {
34 pub name: Name,
35}
36pub type LabelId = Idx<Label>;
37
38#[derive(Debug, Clone, Eq, PartialEq)]
33pub enum Literal { 39pub enum Literal {
34 String(String), 40 String(String),
35 ByteString(Vec<u8>), 41 ByteString(Vec<u8>),
@@ -52,22 +58,22 @@ pub enum Expr {
52 Block { 58 Block {
53 statements: Vec<Statement>, 59 statements: Vec<Statement>,
54 tail: Option<ExprId>, 60 tail: Option<ExprId>,
55 label: Option<Name>, 61 label: Option<LabelId>,
56 }, 62 },
57 Loop { 63 Loop {
58 body: ExprId, 64 body: ExprId,
59 label: Option<Name>, 65 label: Option<LabelId>,
60 }, 66 },
61 While { 67 While {
62 condition: ExprId, 68 condition: ExprId,
63 body: ExprId, 69 body: ExprId,
64 label: Option<Name>, 70 label: Option<LabelId>,
65 }, 71 },
66 For { 72 For {
67 iterable: ExprId, 73 iterable: ExprId,
68 pat: PatId, 74 pat: PatId,
69 body: ExprId, 75 body: ExprId,
70 label: Option<Name>, 76 label: Option<LabelId>,
71 }, 77 },
72 Call { 78 Call {
73 callee: ExprId, 79 callee: ExprId,