Skip to content

Commit e827701

Browse files
committed
Add subclasses for Array
1 parent 69b05e8 commit e827701

File tree

17 files changed

+364
-60
lines changed

17 files changed

+364
-60
lines changed

rust/.generated.list

Lines changed: 12 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/.gitattributes

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/extractor/src/generated/top.rs

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,6 @@ impl TrapEntry for TypeRef {
105105
}
106106
}
107107

108-
#[derive(Debug)]
109-
pub struct Array {
110-
pub id: TrapId,
111-
pub location: Option<trap::Label>,
112-
}
113-
114-
impl TrapEntry for Array {
115-
fn extract_id(&mut self) -> TrapId {
116-
std::mem::replace(&mut self.id, TrapId::Star)
117-
}
118-
119-
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
120-
out.add_tuple("arrays", vec![trap::Arg::Label(id)]);
121-
if let Some(v) = self.location {
122-
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
123-
}
124-
}
125-
}
126-
127108
#[derive(Debug)]
128109
pub struct Await {
129110
pub id: TrapId,
@@ -1325,6 +1306,54 @@ impl TrapEntry for Block {
13251306
}
13261307
}
13271308

1309+
#[derive(Debug)]
1310+
pub struct ElementList {
1311+
pub id: TrapId,
1312+
pub location: Option<trap::Label>,
1313+
pub elements: Vec<trap::Label>,
1314+
pub is_assignee_expr: bool,
1315+
}
1316+
1317+
impl TrapEntry for ElementList {
1318+
fn extract_id(&mut self) -> TrapId {
1319+
std::mem::replace(&mut self.id, TrapId::Star)
1320+
}
1321+
1322+
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
1323+
out.add_tuple("element_lists", vec![trap::Arg::Label(id)]);
1324+
if let Some(v) = self.location {
1325+
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
1326+
}
1327+
for (i, &v) in self.elements.iter().enumerate() {
1328+
out.add_tuple("element_list_elements", vec![trap::Arg::Label(id), i.into(), v.into()]);
1329+
}
1330+
if self.is_assignee_expr {
1331+
out.add_tuple("element_list_is_assignee_expr", vec![trap::Arg::Label(id)]);
1332+
}
1333+
}
1334+
}
1335+
1336+
#[derive(Debug)]
1337+
pub struct Repeat {
1338+
pub id: TrapId,
1339+
pub location: Option<trap::Label>,
1340+
pub initializer: trap::Label,
1341+
pub repeat: trap::Label,
1342+
}
1343+
1344+
impl TrapEntry for Repeat {
1345+
fn extract_id(&mut self) -> TrapId {
1346+
std::mem::replace(&mut self.id, TrapId::Star)
1347+
}
1348+
1349+
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
1350+
out.add_tuple("repeats", vec![trap::Arg::Label(id), self.initializer.into(), self.repeat.into()]);
1351+
if let Some(v) = self.location {
1352+
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
1353+
}
1354+
}
1355+
}
1356+
13281357
#[derive(Debug)]
13291358
pub struct UnsafeBlock {
13301359
pub id: TrapId,

rust/ql/lib/codeql/rust/elements.qll

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/ElementList.qll

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/ElementListConstructor.qll

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/Repeat.qll

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/ArrayConstructor.qll renamed to rust/ql/lib/codeql/rust/elements/RepeatConstructor.qll

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/generated/Array.qll

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)