Make implementation more complete

Use Unimplemented to mark AstNodes  that need implementing
This commit is contained in:
Arthur Baars
2024-09-10 14:10:07 +02:00
parent 2ae725784c
commit a5d1d9e167
28 changed files with 1009 additions and 96 deletions

View File

@@ -1,2 +1,2 @@
mod.rs 7cdfedcd68cf8e41134daf810c1af78624082b0c3e8be6570339b1a69a5d457e 7cdfedcd68cf8e41134daf810c1af78624082b0c3e8be6570339b1a69a5d457e
top.rs 9a7c8ffe5ec4da406abd252c1eb1cca6fabff489429a6c1b1f8809072f63c2c1 9a7c8ffe5ec4da406abd252c1eb1cca6fabff489429a6c1b1f8809072f63c2c1
top.rs 569909061b9a993481764765a014327d143939778f2dbc79836e7496cdb83e1f 569909061b9a993481764765a014327d143939778f2dbc79836e7496cdb83e1f

View File

@@ -88,6 +88,48 @@ impl TrapEntry for MatchArm {
}
}
#[derive(Debug)]
pub struct RecordFieldPat {
pub id: TrapId,
pub location: Option<trap::Label>,
pub name: String,
pub pat: trap::Label,
}
impl TrapEntry for RecordFieldPat {
fn extract_id(&mut self) -> TrapId {
std::mem::replace(&mut self.id, TrapId::Star)
}
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
out.add_tuple("record_field_pats", vec![trap::Arg::Label(id), self.name.into(), self.pat.into()]);
if let Some(v) = self.location {
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
}
}
}
#[derive(Debug)]
pub struct RecordLitField {
pub id: TrapId,
pub location: Option<trap::Label>,
pub name: String,
pub expr: trap::Label,
}
impl TrapEntry for RecordLitField {
fn extract_id(&mut self) -> TrapId {
std::mem::replace(&mut self.id, TrapId::Star)
}
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
out.add_tuple("record_lit_fields", vec![trap::Arg::Label(id), self.name.into(), self.expr.into()]);
if let Some(v) = self.location {
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
}
}
}
#[derive(Debug)]
pub struct TypeRef {
pub id: TrapId,
@@ -339,6 +381,7 @@ pub struct ClosureExpr {
pub arg_types: Vec<Option<trap::Label>>,
pub ret_type: Option<trap::Label>,
pub body: trap::Label,
pub closure_kind: String,
pub is_move: bool,
}
@@ -348,7 +391,7 @@ impl TrapEntry for ClosureExpr {
}
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
out.add_tuple("closure_exprs", vec![trap::Arg::Label(id), self.body.into()]);
out.add_tuple("closure_exprs", vec![trap::Arg::Label(id), self.body.into(), self.closure_kind.into()]);
if let Some(v) = self.location {
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
}
@@ -393,6 +436,7 @@ impl TrapEntry for ConstBlockPat {
pub struct ConstExpr {
pub id: TrapId,
pub location: Option<trap::Label>,
pub expr: trap::Label,
}
impl TrapEntry for ConstExpr {
@@ -401,7 +445,7 @@ impl TrapEntry for ConstExpr {
}
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
out.add_tuple("const_exprs", vec![trap::Arg::Label(id)]);
out.add_tuple("const_exprs", vec![trap::Arg::Label(id), self.expr.into()]);
if let Some(v) = self.location {
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
}
@@ -733,6 +777,7 @@ pub struct MethodCallExpr {
pub receiver: trap::Label,
pub method_name: String,
pub args: Vec<trap::Label>,
pub generic_args: Option<trap::Label>,
}
impl TrapEntry for MethodCallExpr {
@@ -748,6 +793,9 @@ impl TrapEntry for MethodCallExpr {
for (i, v) in self.args.into_iter().enumerate() {
out.add_tuple("method_call_expr_args", vec![trap::Arg::Label(id), i.into(), v.into()]);
}
if let Some(v) = self.generic_args {
out.add_tuple("method_call_expr_generic_args", vec![trap::Arg::Label(id), v.into()]);
}
}
}
@@ -863,6 +911,7 @@ impl TrapEntry for OrPat {
pub struct PathExpr {
pub id: TrapId,
pub location: Option<trap::Label>,
pub path: trap::Label,
}
impl TrapEntry for PathExpr {
@@ -871,7 +920,7 @@ impl TrapEntry for PathExpr {
}
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
out.add_tuple("path_exprs", vec![trap::Arg::Label(id)]);
out.add_tuple("path_exprs", vec![trap::Arg::Label(id), self.path.into()]);
if let Some(v) = self.location {
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
}
@@ -882,6 +931,7 @@ impl TrapEntry for PathExpr {
pub struct PathPat {
pub id: TrapId,
pub location: Option<trap::Label>,
pub path: trap::Label,
}
impl TrapEntry for PathPat {
@@ -890,7 +940,7 @@ impl TrapEntry for PathPat {
}
fn emit(self, id: trap::Label, out: &mut trap::Writer) {
out.add_tuple("path_pats", vec![trap::Arg::Label(id)]);
out.add_tuple("path_pats", vec![trap::Arg::Label(id), self.path.into()]);
if let Some(v) = self.location {
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
}
@@ -959,6 +1009,11 @@ impl TrapEntry for RangePat {
pub struct RecordLitExpr {
pub id: TrapId,
pub location: Option<trap::Label>,
pub path: Option<trap::Label>,
pub fields: Vec<trap::Label>,
pub spread: Option<trap::Label>,
pub has_ellipsis: bool,
pub is_assignee_expr: bool,
}
impl TrapEntry for RecordLitExpr {
@@ -971,6 +1026,21 @@ impl TrapEntry for RecordLitExpr {
if let Some(v) = self.location {
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
}
if let Some(v) = self.path {
out.add_tuple("record_lit_expr_paths", vec![trap::Arg::Label(id), v.into()]);
}
for (i, v) in self.fields.into_iter().enumerate() {
out.add_tuple("record_lit_expr_fields", vec![trap::Arg::Label(id), i.into(), v.into()]);
}
if let Some(v) = self.spread {
out.add_tuple("record_lit_expr_spreads", vec![trap::Arg::Label(id), v.into()]);
}
if self.has_ellipsis {
out.add_tuple("record_lit_expr_has_ellipsis", vec![trap::Arg::Label(id)]);
}
if self.is_assignee_expr {
out.add_tuple("record_lit_expr_is_assignee_expr", vec![trap::Arg::Label(id)]);
}
}
}
@@ -978,6 +1048,9 @@ impl TrapEntry for RecordLitExpr {
pub struct RecordPat {
pub id: TrapId,
pub location: Option<trap::Label>,
pub path: Option<trap::Label>,
pub args: Vec<trap::Label>,
pub has_ellipsis: bool,
}
impl TrapEntry for RecordPat {
@@ -990,6 +1063,15 @@ impl TrapEntry for RecordPat {
if let Some(v) = self.location {
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
}
if let Some(v) = self.path {
out.add_tuple("record_pat_paths", vec![trap::Arg::Label(id), v.into()]);
}
for (i, v) in self.args.into_iter().enumerate() {
out.add_tuple("record_pat_args", vec![trap::Arg::Label(id), i.into(), v.into()]);
}
if self.has_ellipsis {
out.add_tuple("record_pat_has_ellipsis", vec![trap::Arg::Label(id)]);
}
}
}
@@ -1157,6 +1239,9 @@ impl TrapEntry for TuplePat {
pub struct TupleStructPat {
pub id: TrapId,
pub location: Option<trap::Label>,
pub path: Option<trap::Label>,
pub args: Vec<trap::Label>,
pub ellipsis_index: Option<usize>,
}
impl TrapEntry for TupleStructPat {
@@ -1169,6 +1254,15 @@ impl TrapEntry for TupleStructPat {
if let Some(v) = self.location {
out.add_tuple("locatable_locations", vec![trap::Arg::Label(id), v.into()]);
}
if let Some(v) = self.path {
out.add_tuple("tuple_struct_pat_paths", vec![trap::Arg::Label(id), v.into()]);
}
for (i, v) in self.args.into_iter().enumerate() {
out.add_tuple("tuple_struct_pat_args", vec![trap::Arg::Label(id), i.into(), v.into()]);
}
if let Some(v) = self.ellipsis_index {
out.add_tuple("tuple_struct_pat_ellipsis_indices", vec![trap::Arg::Label(id), v.into()]);
}
}
}

View File

@@ -2,12 +2,15 @@ use crate::archive::Archiver;
use crate::trap::{AsTrapKeyPart, TrapFile, TrapId};
use crate::{generated, trap_key};
use codeql_extractor::trap;
use ra_ap_hir::db::DefDatabase;
use ra_ap_hir::db::{DefDatabase, InternDatabase};
use ra_ap_hir::HasSource;
use ra_ap_hir::TypeRef;
use ra_ap_hir::{Crate, Module, ModuleDef};
use ra_ap_hir_def::body::{Body, BodySourceMap};
use ra_ap_hir_def::hir::{CaptureBy, ExprId, LabelId, MatchArm, PatId, Statement};
use ra_ap_hir_def::hir::{
CaptureBy, ExprId, LabelId, MatchArm, PatId, RecordFieldPat, RecordLitField, Statement,
};
use ra_ap_hir_def::path::Path;
use ra_ap_ide_db::line_index::LineIndex;
use ra_ap_ide_db::{LineIndexDatabase, RootDatabase};
use ra_ap_syntax::ast::RangeOp;
@@ -113,7 +116,7 @@ impl CrateTranslator<'_> {
source_map: &BodySourceMap,
) -> trap::Label {
match pat {
ra_ap_hir_def::hir::LiteralOrConst::Literal(literal) => {
ra_ap_hir_def::hir::LiteralOrConst::Literal(_literal) => {
let expr = self.trap.emit(generated::LiteralExpr {
id: TrapId::Star,
location: None,
@@ -176,6 +179,50 @@ impl CrateTranslator<'_> {
name: label.name.as_str().into(),
})
}
fn emit_unimplemented(&mut self, location: Option<trap::Label>) -> trap::Label {
self.trap.emit(generated::Unimplemented {
id: TrapId::Star,
location,
})
}
fn emit_path(&mut self, _path: &Path, location: Option<trap::Label>) -> trap::Label {
self.emit_unimplemented(location)
}
fn emit_record_field_pat(
&mut self,
field_pat: &RecordFieldPat,
body: &Body,
source_map: &BodySourceMap,
) -> trap::Label {
let RecordFieldPat { name, pat } = field_pat;
let location = self.emit_location_for_pat(*pat, source_map);
let pat = self.emit_pat(*pat, body, source_map);
self.trap.emit(generated::RecordFieldPat {
id: TrapId::Star,
location,
name: name.as_str().into(),
pat,
})
}
fn emit_record_lit_field(
&mut self,
field_expr: &RecordLitField,
body: &Body,
source_map: &BodySourceMap,
) -> trap::Label {
let RecordLitField { name, expr } = field_expr;
let location = self.emit_location_for_expr(*expr, source_map);
let expr = self.emit_expr(*expr, body, source_map);
self.trap.emit(generated::RecordLitField {
id: TrapId::Star,
location,
name: name.as_str().into(),
expr,
})
}
fn emit_pat(&mut self, pat_id: PatId, body: &Body, source_map: &BodySourceMap) -> trap::Label {
let location: Option<trap::Label> = self.emit_location_for_pat(pat_id, source_map);
let pat = &body.pats[pat_id];
@@ -216,11 +263,20 @@ impl CrateTranslator<'_> {
path,
args,
ellipsis,
} => self.trap.emit(generated::RecordPat {
//TODO:
id: TrapId::Star,
location,
}),
} => {
let path = path.as_ref().map(|path| self.emit_path(path, location));
let args = args
.into_iter()
.map(|arg| self.emit_record_field_pat(arg, body, source_map))
.collect();
self.trap.emit(generated::RecordPat {
id: TrapId::Star,
location,
path,
args,
has_ellipsis: *ellipsis,
})
}
ra_ap_hir_def::hir::Pat::Range { start, end } => {
let start = start
.as_ref()
@@ -257,10 +313,14 @@ impl CrateTranslator<'_> {
suffix,
})
}
ra_ap_hir_def::hir::Pat::Path(path) => self.trap.emit(generated::PathPat {
id: TrapId::Star,
location,
}),
ra_ap_hir_def::hir::Pat::Path(path) => {
let path = self.emit_path(path, location);
self.trap.emit(generated::PathPat {
id: TrapId::Star,
location,
path,
})
}
ra_ap_hir_def::hir::Pat::Lit(expr) => {
let expr = self.emit_expr(*expr, body, source_map);
self.trap.emit(generated::LitPat {
@@ -282,10 +342,20 @@ impl CrateTranslator<'_> {
path,
args,
ellipsis,
} => self.trap.emit(generated::TupleStructPat {
id: TrapId::Star,
location,
}),
} => {
let path = path.as_ref().map(|path| self.emit_path(path, location));
let args = args
.into_iter()
.map(|arg| self.emit_pat(*arg, body, source_map))
.collect();
self.trap.emit(generated::TupleStructPat {
id: TrapId::Star,
location,
path,
args,
ellipsis_index: ellipsis.map(|x| x as usize),
})
}
ra_ap_hir_def::hir::Pat::Ref { pat, mutability } => {
let pat = self.emit_pat(*pat, body, source_map);
self.trap.emit(generated::RefPat {
@@ -313,15 +383,8 @@ impl CrateTranslator<'_> {
}
}
}
fn emit_type_ref(
&mut self,
type_ref: &TypeRef, //TODO
) -> trap::Label {
let location: Option<trap::Label> = None; //TODO: ?
self.trap.emit(generated::TypeRef {
id: TrapId::Star,
location,
})
fn emit_type_ref(&mut self, _type_ref: &TypeRef) -> trap::Label {
self.emit_unimplemented(None)
}
fn emit_match_arm(
&mut self,
@@ -402,10 +465,14 @@ impl CrateTranslator<'_> {
id: TrapId::Star,
location,
}),
ra_ap_hir_def::hir::Expr::Path(path) => self.trap.emit(generated::PathExpr {
id: TrapId::Star,
location,
}),
ra_ap_hir_def::hir::Expr::Path(path) => {
let path = self.emit_path(path, location);
self.trap.emit(generated::PathExpr {
id: TrapId::Star,
location,
path,
})
}
ra_ap_hir_def::hir::Expr::If {
condition,
then_branch,
@@ -469,10 +536,15 @@ impl CrateTranslator<'_> {
tail,
})
}
ra_ap_hir_def::hir::Expr::Const(const_block) => self.trap.emit(generated::ConstExpr {
id: TrapId::Star,
location,
}),
ra_ap_hir_def::hir::Expr::Const(const_block) => {
let expr_id = self.db.lookup_intern_anonymous_const(*const_block).root;
let expr = self.emit_expr(expr_id, body, source_map);
self.trap.emit(generated::ConstExpr {
id: TrapId::Star,
location,
expr,
})
}
ra_ap_hir_def::hir::Expr::Unsafe {
id: _,
statements,
@@ -525,20 +597,23 @@ impl CrateTranslator<'_> {
receiver,
method_name,
args,
generic_args, //TODO
generic_args,
} => {
let receiver = self.emit_expr(*receiver, body, source_map);
let args = args
.into_iter()
.map(|e| self.emit_expr(*e, body, source_map))
.collect();
let generic_args = generic_args
.as_ref()
.map(|_args| self.emit_unimplemented(None));
self.trap.emit(generated::MethodCallExpr {
id: TrapId::Star,
location,
receiver,
method_name: method_name.as_str().into(),
args,
generic_args,
})
}
ra_ap_hir_def::hir::Expr::Match { expr, arms } => {
@@ -611,10 +686,23 @@ impl CrateTranslator<'_> {
spread,
ellipsis,
is_assignee_expr,
} => self.trap.emit(generated::RecordLitExpr {
id: TrapId::Star,
location,
}),
} => {
let path = path.as_ref().map(|path| self.emit_path(path, location));
let fields = fields
.into_iter()
.map(|field| self.emit_record_lit_field(field, body, source_map))
.collect();
let spread = spread.map(|expr_id| self.emit_expr(expr_id, body, source_map));
self.trap.emit(generated::RecordLitExpr {
id: TrapId::Star,
location,
path,
fields,
spread,
has_ellipsis: *ellipsis,
is_assignee_expr: *is_assignee_expr,
})
}
ra_ap_hir_def::hir::Expr::Field { expr, name } => {
let expr = self.emit_expr(*expr, body, source_map);
self.trap.emit(generated::FieldExpr {
@@ -751,6 +839,7 @@ impl CrateTranslator<'_> {
arg_types,
body: expr,
ret_type,
closure_kind: format!("{:?}", closure_kind),
is_move: *capture_by == CaptureBy::Value,
})
}
@@ -798,7 +887,7 @@ impl CrateTranslator<'_> {
repeat,
})
}
ra_ap_hir_def::hir::Expr::Literal(literal) => self.trap.emit(generated::LiteralExpr {
ra_ap_hir_def::hir::Expr::Literal(_literal) => self.trap.emit(generated::LiteralExpr {
id: TrapId::Star,
location,
}),
@@ -834,7 +923,9 @@ impl CrateTranslator<'_> {
labels: &mut Vec<trap::Label>,
) {
match id {
ModuleDef::Module(module) => {}
ModuleDef::Module(_) => {
self.emit_unimplemented(None);
}
ModuleDef::Function(function) => {
let def: ra_ap_hir::DefWithBody = function.into();
let (body, source_map) = self.db.body_with_source_map(def.into());
@@ -852,15 +943,41 @@ impl CrateTranslator<'_> {
body,
}));
}
ModuleDef::Adt(adt) => {}
ModuleDef::Variant(variant) => {}
ModuleDef::Const(const_) => {}
ModuleDef::Static(static_) => {}
ModuleDef::Trait(trait_) => {}
ModuleDef::TraitAlias(alias_) => {}
ModuleDef::TypeAlias(type_alias_) => {}
ModuleDef::BuiltinType(builtin_type_) => {}
ModuleDef::Macro(macro_) => {}
ModuleDef::Adt(adt) => {
let location = self.emit_location(adt);
self.emit_unimplemented(location);
}
ModuleDef::Variant(variant) => {
let location = self.emit_location(variant);
self.emit_unimplemented(location);
}
ModuleDef::Const(const_) => {
let location = self.emit_location(const_);
self.emit_unimplemented(location);
}
ModuleDef::Static(static_) => {
let location = self.emit_location(static_);
self.emit_unimplemented(location);
}
ModuleDef::Trait(trait_) => {
let location = self.emit_location(trait_);
self.emit_unimplemented(location);
}
ModuleDef::TraitAlias(alias) => {
let location = self.emit_location(alias);
self.emit_unimplemented(location);
}
ModuleDef::TypeAlias(type_alias) => {
let location = self.emit_location(type_alias);
self.emit_unimplemented(location);
}
ModuleDef::BuiltinType(_builtin_type) => {
self.emit_unimplemented(None);
}
ModuleDef::Macro(macro_) => {
let location = self.emit_location(macro_);
self.emit_unimplemented(location);
}
}
}

View File

@@ -89,8 +89,12 @@ lib/codeql/rust/elements/RangeExpr.qll 05a56b149adf83006243335be90c23eca71e981ae
lib/codeql/rust/elements/RangeExprConstructor.qll a04153bf88dd71c3f516418bdb7377ded9db21c07f7ee6dd245ed8b44719d8f3 2d578f8dbc49da98694676d6a59bb9d58c6d2a200ffc893ffa90dca77878e38a
lib/codeql/rust/elements/RangePat.qll 02f3e4647932553481c4d8b1e2d2da3551662a17d75f26f2fb7e9d77ef1d579d e2546bc74035d03c92aa7beab2abca73a587049c95710eb9b59f916363df1552
lib/codeql/rust/elements/RangePatConstructor.qll c391431118ed6ce16f7b7126c5d43e61f07b98fab7b8bc48e9dfe22f7e21ed19 bbafe1c9595b0b004f7b27999a14df27d0710d5b058e7ab14dddd2fae058fc31
lib/codeql/rust/elements/RecordFieldPat.qll e3f69b2c59d50807393928ef9be0b51af016f209cbae68cfde0fdf02b287f353 b24e256f850d1f0bbacea74c4879fee8bcedf47f65db091d7858302355751fa3
lib/codeql/rust/elements/RecordFieldPatConstructor.qll 36859753aa70086c540a1700495fe6c414521553877bfdd56800f586eb577743 1b31233a5e6da0bf88aaf40c52fa08cfbca5b44088cd3f91957ce8c96f4aeaea
lib/codeql/rust/elements/RecordLitExpr.qll f5c0377f0a1805d824052acbcaad393ba10b0f994a5ea6b6f60b5eec2c417c21 e61bb3750d19dad5c4e59dd0bb3a65430879f58909b735f7c28f378cd2217221
lib/codeql/rust/elements/RecordLitExprConstructor.qll 7b676a8e0fd9ba5a932988e613fe3dda8b6b0430feed8791ef5585fd9cd81767 f7811928dd8269138d75f0a6dd1c60f70d18806227bd2caaa5cd4cc1341e9286
lib/codeql/rust/elements/RecordLitField.qll 27bbc256f61f4428578155da47b1a1b3eef43fb5d4d98f168c66fa85337bde24 880aa885f2ba3d1866c6023360a206dc5095385adb908e953ce792beae90b2ca
lib/codeql/rust/elements/RecordLitFieldConstructor.qll 0f83c9dc00937d90ee0d64d157458145078f5f3c87c9c0484600fdcc830ab207 e2852d5bc4f0174d94b90a2ee34fae1e6c4b24d5d8ccb58a51c520b12adf8512
lib/codeql/rust/elements/RecordPat.qll 50f4a2401dc579f3900188043d412ccdd6c57c1da6636c105221cfe243307d32 7812f0e10ce1a8e70c8c45d0c87e52539f6b29469157463456d06c566e86c2dd
lib/codeql/rust/elements/RecordPatConstructor.qll 93c794efa5050b86c458470224de7f3206c1a004b46ef374780f080a8e9a4ce0 157800f342de96095e118dbcfa20f8e65cc79ccae712e8e37bff1ba92a227fda
lib/codeql/rust/elements/RefExpr.qll ed47e1a834f2af93197ceda685a368465f7eea59704c2b7df3ef59326e53c0e1 5676825b036eb4cb560238d86c8d1fac48a4e59d91110da0dc75eacd542bcc8e
@@ -126,7 +130,7 @@ lib/codeql/rust/elements/YeetExpr.qll 04a1f4f7b2bb697e30ab284720ed30c0c8e1377cac
lib/codeql/rust/elements/YeetExprConstructor.qll f1871c6e0c966c52806e370dbe2956585bbfa1dcf0bd7ebfdb2bd39b7cfd0d7b a2333e80a325a921a66c34151401da12c250951952ccb0c81e5102dc62299503
lib/codeql/rust/elements/YieldExpr.qll b0f238ba2e4b83b449b44224d766b6cf6b15523a413467f608f4a711d34edc01 355fcafe43915d69a07725ec3707e66abfefc6157bd7dc1c1fd846a965c6580d
lib/codeql/rust/elements/YieldExprConstructor.qll ff46ba17cc24abfcb0e310c7458d0539b704e7a771ad00853bd3a1844e4e6f82 1c13662ef01c88f1cf057d099eb46524036133e51a0e36ddf947f727ac6046bb
lib/codeql/rust/elements.qll 62468ff1c85eb9c41ee42dceae9c4f3404d4665ced309970fab3282e75abe465 62468ff1c85eb9c41ee42dceae9c4f3404d4665ced309970fab3282e75abe465
lib/codeql/rust/elements.qll c0e6bff934b1925ec03e55afc2b5b9127f51dc4a613e047e687bc83cdab4f196 c0e6bff934b1925ec03e55afc2b5b9127f51dc4a613e047e687bc83cdab4f196
lib/codeql/rust/generated/ArrayExpr.qll b9778720acf4080c065897ba1471be185c0c35f3ea01c15594c0a3ee4029b231 cbc8c9dbcb805063c4b893e21ed0bf00312490a0c92ee126d49dbfff6978fa99
lib/codeql/rust/generated/AstNode.qll 0598fac7859906f4103124270dfb2fbdb838387b1c45000bf50a4b62c797ec41 f47c84878c7c9676109e358073bddab92a1dbeb4d977d236ecc1eae44d81c894
lib/codeql/rust/generated/AsyncBlockExpr.qll 1e9d3bcd5d5703bf61748f2746d3f9a4e2a12080268b29a2685b762d13c30555 1e9d3bcd5d5703bf61748f2746d3f9a4e2a12080268b29a2685b762d13c30555
@@ -141,9 +145,9 @@ lib/codeql/rust/generated/BoxPat.qll b69ba2bc341a1bf4c613279e45fb97a530619d4148d
lib/codeql/rust/generated/BreakExpr.qll d68990513e0b2c0021cccebcdc7dc9ecc1d5b5c7dd0df7014686d6ed8a909940 36875ae186581f10485c1c846c9f6d2bffea3b18375b7f05c2927ba23f08b6ef
lib/codeql/rust/generated/CallExpr.qll 3e29dc45480e3be1989c364bad0ff94deb322cff20e87a3378fc1a7e11237d61 3873462b8811c3e3ef92700045ed05f55869d320ac74eb72111776d3353095f2
lib/codeql/rust/generated/CastExpr.qll 6ed07afb453706874d7ae7c4bb09ed35ffdd11e7aeb4cbef4d84dad11a203d0f 741d1c0ff092dc9273b0d588aea6b30f7e2c1c5b9d08f2c4722fe26c2cab33ab
lib/codeql/rust/generated/ClosureExpr.qll 7569fb26ab7d2b263ed6bc5fe8c2865ec81ac646519efbf4c95f4d07ef84746e 83803763478e01c49cb91337869723ed9671f4d2348d6b9f21546e6d48157aa6
lib/codeql/rust/generated/ClosureExpr.qll f0c7ce7aecc9da9663cbda3e285be73b23464f8baa6b966fb5aebb0bd0f0aca6 685d74b6a94052fc45aff83b7c525a83f9dfcc02c1bf7e7f7a0aed51ce2de945
lib/codeql/rust/generated/ConstBlockPat.qll d0818fe4cee066f1e6d3439c82122942ae62941e69da686b7d5c399e820c395c 2fae5a2f0457bb7106d52ac7457afb597d7ac9658b8dcff8e76294f5fe34019a
lib/codeql/rust/generated/ConstExpr.qll 93d2964bea4a441272a30a4e27d89149d2ec7c7f12a40cccb6124845bf4b3165 93d2964bea4a441272a30a4e27d89149d2ec7c7f12a40cccb6124845bf4b3165
lib/codeql/rust/generated/ConstExpr.qll dd851fb049429fe965569beb75957a6a596137b333a6cd7cd588d1c4d40412c4 824825bc46a393827d5df5ae30f622ef2a053ea1f5e338c3b957625a8542cfa5
lib/codeql/rust/generated/ContinueExpr.qll 436847767d2f68f95d011df0eb8a175924c029ac747daf620a203596479b20b3 e362f28dde0bf3e6ff3b234e81a44bc5026b4c9ed38b8b7872954cca9565eece
lib/codeql/rust/generated/DbFile.qll 4dbf1931124291e0d6a958ae882f8aeef006642f72adc7ff86cffd3a4e9a970a 4dbf1931124291e0d6a958ae882f8aeef006642f72adc7ff86cffd3a4e9a970a
lib/codeql/rust/generated/DbLocation.qll 735d9351b5eb46a3231b528600dddec3a4122c18c210d4d632a8d4ceaf7f02e9 735d9351b5eb46a3231b528600dddec3a4122c18c210d4d632a8d4ceaf7f02e9
@@ -169,33 +173,35 @@ lib/codeql/rust/generated/Location.qll bce4c72988ec6fedd1439c60a37c45aa6147c9629
lib/codeql/rust/generated/LoopExpr.qll e9304e282a97984e147b92ec7061c98fde238a8691e945e4cb775ccf34c27b0c 65b859e44e83bddb710d4ce9e5ab1346b98eaaa46509671776b75c9e8f1c1667
lib/codeql/rust/generated/MatchArm.qll 5ad0dc254b6d58ccd856e4235b68ca0226a898c33f1f6b6fe7b48266a01ca627 f519af39f45e820eb3a70cefb0e4dfb541c3cf17952c00c6dd7e59f854a629bd
lib/codeql/rust/generated/MatchExpr.qll f8b422699337324c91ec9c55024630efe114ca617f4f088a18d180df132d5754 13169bde872f533f55aa196d7150761857c593a4657ab34051346dde14e736c7
lib/codeql/rust/generated/MethodCallExpr.qll b198918d0f343b9714fa55febbc85c164420000715f5005c76d9c5ffda6e941e 8205123441260e7589dbd1b3226c1feb042b959c79584bdbd2ae18c4ac05695f
lib/codeql/rust/generated/MethodCallExpr.qll 499fa4c78bafbb8f3a6af645c26f1645c9a634976d409493d26d82dddd4b42a3 2dd18cb4868e96e38383c4ae3f8777637422e90b2363bb533f0e9e1c2692dc6e
lib/codeql/rust/generated/MissingExpr.qll 90b164567620c88b8e258fa229633365400abeafa4f4b0fcd1c856efc2f9b206 90b164567620c88b8e258fa229633365400abeafa4f4b0fcd1c856efc2f9b206
lib/codeql/rust/generated/MissingPat.qll 0d8034cee20bacf07ebb9337c797f53a25686a149f163f801916cd6ec5484710 0d8034cee20bacf07ebb9337c797f53a25686a149f163f801916cd6ec5484710
lib/codeql/rust/generated/Module.qll 2a931a4f2cdb2fee00ed83af045ea63d36b7dbd708e58c30445b5610feaae333 cd62add5c31a509f965aa294f44a1607ec7c62e3a9e3fe9ee063b3c814f4eb62
lib/codeql/rust/generated/OffsetOfExpr.qll 58dfd632efcb48de7fe6ffbcb2192fcf95bfabdb407a751133f63a0e32ae7489 21ebb1b3d66849fc21c04083cfa751eb56c55809cd52664020bd61ccfbe5ea68
lib/codeql/rust/generated/OrPat.qll f8fe5c7b83a08dabcc530484a696274930040ea13501ae20f1426faeec67bcf0 f3adb3148890531b698570a48740335983a5e81977ba4ac651778f940f184398
lib/codeql/rust/generated/ParentChild.qll 71beabd2a1ecc01ebb9884efbbf08a8b10db6d785cb241b30cfc717a35ea7831 b92d1c6668588dc24a8ae1592d9a98819ad9138b18c9ae3e2613a55902ada200
lib/codeql/rust/generated/ParentChild.qll 956f55ac17d66926c59f76d391b75c30767d236b145d6ae402f4308fa22a7d01 dd3cabb5b4a9ba42be60345f445cde18b0d7be934aeb94d7312eeef122e148d2
lib/codeql/rust/generated/Pat.qll fe1c72856442dbab5655eff93f86c2cbce8d69d9fa1f99a0f9203061ea1112a4 d85d86e8b6c48df733589d186f610b1cd9086629180701e017774bddc62402c7
lib/codeql/rust/generated/PathExpr.qll c29440b147b84e383ee052953d389759d6d946ac4cc2c8924edf07b3259fd095 c29440b147b84e383ee052953d389759d6d946ac4cc2c8924edf07b3259fd095
lib/codeql/rust/generated/PathPat.qll 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524 5869c513e1d0cb689589e2c72f3feda18b0f246d9b03304d8c0f9237f0300524
lib/codeql/rust/generated/PathExpr.qll 3664ed2ad08097e4446b0fdad148118c754f8203541ae588d967ba9d79b6bf21 0d987d2358fe9b42e57585e7ae906de80e9f4ccf7c20e1d9bb7624ffbad96941
lib/codeql/rust/generated/PathPat.qll acc4dda795bae97626a8d0041538f3ba1f0b591c743fed381cf198a8b04653cb c3deee1b3bb9bd37ae3ed4761d8ee2f498384fe5e1f5e31c0f9b99dfd864a0d5
lib/codeql/rust/generated/PureSynthConstructors.qll 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573 5eb1fc4f6a04172c34ae31e4931e4bf1f8b72fbe414c5f644731a45372d13573
lib/codeql/rust/generated/RangeExpr.qll f499d8c1f260d6262a55c1f3640aaee832ed8c9aac922cb2e05fefbca4509053 a01563640bc23fbce9d33da756bc209fd16155dc76a7fed4ba325979723f48a5
lib/codeql/rust/generated/RangePat.qll 6ec95f6cb9c4bd93b38990bb1e3b89b526624305ac6ee7b94e6fb0a2f3db28fc 0e193f3816a7587d5103dba421bc2bf22b869522353d4e3f43d49a792eac6cf4
lib/codeql/rust/generated/Raw.qll 0fdef0cf212a6190a2b439f6aae172fcddaa1278bf250c1db861735806c6e68a 686b31dfcc26baed862b8ad69dce911fa4a62e60781d73985c3c52006147961d
lib/codeql/rust/generated/RecordLitExpr.qll 2d24bca7aae46b0491af0a19b1b4fe357eac2fce36eeb75193b718ab4f41665a 2d24bca7aae46b0491af0a19b1b4fe357eac2fce36eeb75193b718ab4f41665a
lib/codeql/rust/generated/RecordPat.qll 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7 8c206be87b5738c6107db72cbe4d97a67e55060e92c0a3148fad84092d70f5e7
lib/codeql/rust/generated/Raw.qll 48d1e7d642bd2a7605dbafe3929c558560054a4e4e3e4b36925a8bfafb7536b9 3b881e64127e9b41fee7e091de725f5cd1cb1263e4a52c02adb1fb339fe36c3d
lib/codeql/rust/generated/RecordFieldPat.qll 26bed2285d849b9b7ac52d86131eacb40df912db350e423e81fb98c393c08a69 05ed735aecee90901a1bdfae05d9f85d7f6581616eca3a9262fdef6673222f9b
lib/codeql/rust/generated/RecordLitExpr.qll 1d3264446ff57e8b169f1ad6da150b2d457d6b60eda0ff63e2353eb8ef9e9113 f523dd5ce7f4bac0aafab7b27c6cfe766c72a9ee0c92d7a263347e67edf096df
lib/codeql/rust/generated/RecordLitField.qll bc704b56a986f3a399dc9c3dc2b61cca0d40cd389c694b9fe13374780835ffcc ab6b05a87f240a97cc2a8c15bb84a1338ad33ce367619125a8514e8815fd050e
lib/codeql/rust/generated/RecordPat.qll 5fd26e95dd23b07a847bd28c95a4206df62f7cc22c8d7b3bafa10e902e917d15 e264a96c2af4e2f64a394a119329b8b376d4b23ec6a3fc6d123c5631845bc4ef
lib/codeql/rust/generated/RefExpr.qll bb37b8bff64b0cf1f18de297487455692311b2006c45161f25969e131359c60f bfbc2b67b2b2ec66f3539e4972a947946b29e0ba527042593060eaf6b21e28ad
lib/codeql/rust/generated/RefPat.qll 3525331e8ba25a8612324e860423a39ddb29e8eb50a9f2bf62e49bf182d64b6d 804efbd32869f92e5515d34852fed6416288f99b0aab95b5be5cb5bdd1eea806
lib/codeql/rust/generated/RepeatExpr.qll 43aff00e966e4550179d756489e4cbc30618d66c93c13530c45b031b9513b915 b91691445e6f7de67d61c787f41b36a383cf36da1a216c18767ac1d2ce5db34c
lib/codeql/rust/generated/ReturnExpr.qll 6160f3a14ff1cbd6a297edae015769f90e8e31201639828d8a9d0d6e38c1ef99 b8c8a12f78281e558d230c6959236780758e9645fe22aca697b948535c20f9be
lib/codeql/rust/generated/SlicePat.qll b4de6692eebf1205940e04da963adc20a07b15923c3c3a7a512a24e3bd8342c9 ee9b919983807f39d97cfe8ca66b76bdbfde76db02db5c93268ce22cbddf4213
lib/codeql/rust/generated/Stmt.qll 55688c8f42f6e7fd1b871e572d75fac60d0543e38c4be4638abbb00187651d3d f978006a8453137f989249e849a7c935a090da3a9b0116145da80068760e12fd
lib/codeql/rust/generated/Synth.qll 353bcce1fc362ac62339a5a09cb42aa4d2d8892bc5db3a5d29d1a3051c7c8d6a d8617e82b1782941ca6ad655e2d2303d911864fd02a1851efd579c96cfa97b29
lib/codeql/rust/generated/SynthConstructors.qll 5ec5d4f62a1e1bd0f567783e0f450fe78adc9f2464aad1cdef4d97884c092b15 5ec5d4f62a1e1bd0f567783e0f450fe78adc9f2464aad1cdef4d97884c092b15
lib/codeql/rust/generated/Synth.qll 03ecd0d7e89aca555d2393bbea8de1cde0476e28fb9f198ed3355a74f1b5c1c8 11855cc446c2d8a77503795a7c395e86ff149ea10d773a6e50e54b08dd438642
lib/codeql/rust/generated/SynthConstructors.qll 07106a119dcfc7a839454d1fa66c0e65d6ab17eeace40cd5bc857a65dc7c859b 07106a119dcfc7a839454d1fa66c0e65d6ab17eeace40cd5bc857a65dc7c859b
lib/codeql/rust/generated/TupleExpr.qll 13e4dbc1afcabf388c793145cd399789f4014662f2eed1d49cbe96eeb8355413 bfa0708885c120bad24e29deb29641c69a5e5361654f3a144ead9543bfbd7197
lib/codeql/rust/generated/TuplePat.qll 23911b2ac7ee2279df8ef40a6e447437ef0ed62518504b17874a7652bf5e3f4b fc4f6f7ea40754290de194ac55939f08549bd637104baf8dc84ca3938bcbd1f1
lib/codeql/rust/generated/TupleStructPat.qll 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36 955e720b880bb9699ac402edc6774bb9aff4eb2fdf08d08b72f7db4ef4673b36
lib/codeql/rust/generated/TupleStructPat.qll fff004cce780501eac94fe4b146619a84e02c85cae12ffeba5a4058e8c9738ea 738659f8208aa65d1d8cf601e0d92a90a890d6cbaec51cf04c81fc75a827e30b
lib/codeql/rust/generated/TypeRef.qll 7cc468c2f473ee13c11a97c4360100376560e8fc42f25a136f1500fe31a31533 7cc468c2f473ee13c11a97c4360100376560e8fc42f25a136f1500fe31a31533
lib/codeql/rust/generated/UnaryOpExpr.qll fd55d4bc9cd1a49d1f38f02fef16771f29bb5fb2512abd18341d56665859d18c f271ef5036410c018f48d6f15b17cb9beaf4111a42fc638ac4ed3db974a5f870
lib/codeql/rust/generated/UnderscoreExpr.qll cd7f615e41562b80d89e413c1c808048da7746fd445f0eb6ad8c5d9996b44d5d cd7f615e41562b80d89e413c1c808048da7746fd445f0eb6ad8c5d9996b44d5d
@@ -211,5 +217,7 @@ test/extractor-tests/generated/File/File.ql dec43be882fad904fab0c6447ca93633d801
test/extractor-tests/generated/Function/Function.ql c49434420dbb6fc3d9e6294161dcd3d3b306fae5ba5c85b610e534b8b15ef74c fe02208b673b74eebed92b5cbb3a8a06c31c0681eb28f3e596515663f14fa9e2
test/extractor-tests/generated/Module/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e
test/extractor-tests/generated/Pat/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e
test/extractor-tests/generated/RecordFieldPat/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e
test/extractor-tests/generated/RecordLitField/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e
test/extractor-tests/generated/Stmt/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e
test/extractor-tests/generated/TypeRef/MISSING_SOURCE.txt cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e cc7c395e7c651d62596826b1a0bedf10f35d01b8afeef47600b4ddaf804f406e

8
rust/ql/.gitattributes generated vendored
View File

@@ -91,8 +91,12 @@
/lib/codeql/rust/elements/RangeExprConstructor.qll linguist-generated
/lib/codeql/rust/elements/RangePat.qll linguist-generated
/lib/codeql/rust/elements/RangePatConstructor.qll linguist-generated
/lib/codeql/rust/elements/RecordFieldPat.qll linguist-generated
/lib/codeql/rust/elements/RecordFieldPatConstructor.qll linguist-generated
/lib/codeql/rust/elements/RecordLitExpr.qll linguist-generated
/lib/codeql/rust/elements/RecordLitExprConstructor.qll linguist-generated
/lib/codeql/rust/elements/RecordLitField.qll linguist-generated
/lib/codeql/rust/elements/RecordLitFieldConstructor.qll linguist-generated
/lib/codeql/rust/elements/RecordPat.qll linguist-generated
/lib/codeql/rust/elements/RecordPatConstructor.qll linguist-generated
/lib/codeql/rust/elements/RefExpr.qll linguist-generated
@@ -185,7 +189,9 @@
/lib/codeql/rust/generated/RangeExpr.qll linguist-generated
/lib/codeql/rust/generated/RangePat.qll linguist-generated
/lib/codeql/rust/generated/Raw.qll linguist-generated
/lib/codeql/rust/generated/RecordFieldPat.qll linguist-generated
/lib/codeql/rust/generated/RecordLitExpr.qll linguist-generated
/lib/codeql/rust/generated/RecordLitField.qll linguist-generated
/lib/codeql/rust/generated/RecordPat.qll linguist-generated
/lib/codeql/rust/generated/RefExpr.qll linguist-generated
/lib/codeql/rust/generated/RefPat.qll linguist-generated
@@ -213,5 +219,7 @@
/test/extractor-tests/generated/Function/Function.ql linguist-generated
/test/extractor-tests/generated/Module/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/Pat/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/RecordFieldPat/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/RecordLitField/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/Stmt/MISSING_SOURCE.txt linguist-generated
/test/extractor-tests/generated/TypeRef/MISSING_SOURCE.txt linguist-generated

View File

@@ -56,7 +56,9 @@ import codeql.rust.elements.PathExpr
import codeql.rust.elements.PathPat
import codeql.rust.elements.RangeExpr
import codeql.rust.elements.RangePat
import codeql.rust.elements.RecordFieldPat
import codeql.rust.elements.RecordLitExpr
import codeql.rust.elements.RecordLitField
import codeql.rust.elements.RecordPat
import codeql.rust.elements.RefExpr
import codeql.rust.elements.RefPat

View File

@@ -0,0 +1,8 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `RecordFieldPat`.
*/
private import codeql.rust.generated.RecordFieldPat
class RecordFieldPat extends Generated::RecordFieldPat { }

View File

@@ -0,0 +1,14 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module defines the hook used internally to tweak the characteristic predicate of
* `RecordFieldPat` synthesized instances.
* INTERNAL: Do not use.
*/
private import codeql.rust.generated.Raw
/**
* The characteristic predicate of `RecordFieldPat` synthesized instances.
* INTERNAL: Do not use.
*/
predicate constructRecordFieldPat(Raw::RecordFieldPat id) { any() }

View File

@@ -0,0 +1,8 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module provides a hand-modifiable wrapper around the generated class `RecordLitField`.
*/
private import codeql.rust.generated.RecordLitField
class RecordLitField extends Generated::RecordLitField { }

View File

@@ -0,0 +1,14 @@
// generated by codegen, remove this comment if you wish to edit this file
/**
* This module defines the hook used internally to tweak the characteristic predicate of
* `RecordLitField` synthesized instances.
* INTERNAL: Do not use.
*/
private import codeql.rust.generated.Raw
/**
* The characteristic predicate of `RecordLitField` synthesized instances.
* INTERNAL: Do not use.
*/
predicate constructRecordLitField(Raw::RecordLitField id) { any() }

View File

@@ -85,6 +85,13 @@ module Generated {
Synth::convertExprFromRaw(Synth::convertClosureExprToRaw(this).(Raw::ClosureExpr).getBody())
}
/**
* Gets the closure kind of this closure expression.
*/
string getClosureKind() {
result = Synth::convertClosureExprToRaw(this).(Raw::ClosureExpr).getClosureKind()
}
/**
* Holds if this closure expression is move.
*/

View File

@@ -19,5 +19,13 @@ module Generated {
*/
class ConstExpr extends Synth::TConstExpr, Expr {
override string getAPrimaryQlClass() { result = "ConstExpr" }
/**
* Gets the expression of this const expression.
*/
Expr getExpr() {
result =
Synth::convertExprFromRaw(Synth::convertConstExprToRaw(this).(Raw::ConstExpr).getExpr())
}
}
}

View File

@@ -7,6 +7,7 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Expr
import codeql.rust.elements.Unimplemented
/**
* INTERNAL: This module contains the fully generated definition of `MethodCallExpr` and should not
@@ -56,5 +57,20 @@ module Generated {
* Gets the number of arguments of this method call expression.
*/
final int getNumberOfArgs() { result = count(int i | exists(this.getArg(i))) }
/**
* Gets the generic arguments of this method call expression, if it exists.
*/
Unimplemented getGenericArgs() {
result =
Synth::convertUnimplementedFromRaw(Synth::convertMethodCallExprToRaw(this)
.(Raw::MethodCallExpr)
.getGenericArgs())
}
/**
* Holds if `getGenericArgs()` exists.
*/
final predicate hasGenericArgs() { exists(this.getGenericArgs()) }
}
}

View File

@@ -194,6 +194,42 @@ private module Impl {
)
}
private Element getImmediateChildOfRecordFieldPat(
RecordFieldPat e, int index, string partialPredicateCall
) {
exists(int b, int bAstNode, int n, int nPat |
b = 0 and
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
n = bAstNode and
nPat = n + 1 and
(
none()
or
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
or
index = n and result = e.getPat() and partialPredicateCall = "Pat()"
)
)
}
private Element getImmediateChildOfRecordLitField(
RecordLitField e, int index, string partialPredicateCall
) {
exists(int b, int bAstNode, int n, int nExpr |
b = 0 and
bAstNode = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfAstNode(e, i, _)) | i) and
n = bAstNode and
nExpr = n + 1 and
(
none()
or
result = getImmediateChildOfAstNode(e, index - b, partialPredicateCall)
or
index = n and result = e.getExpr() and partialPredicateCall = "Expr()"
)
)
}
private Element getImmediateChildOfStmt(Stmt e, int index, string partialPredicateCall) {
exists(int b, int bAstNode, int n |
b = 0 and
@@ -477,14 +513,17 @@ private module Impl {
}
private Element getImmediateChildOfConstExpr(ConstExpr e, int index, string partialPredicateCall) {
exists(int b, int bExpr, int n |
exists(int b, int bExpr, int n, int nExpr |
b = 0 and
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
n = bExpr and
nExpr = n + 1 and
(
none()
or
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
or
index = n and result = e.getExpr() and partialPredicateCall = "Expr()"
)
)
}
@@ -745,12 +784,13 @@ private module Impl {
private Element getImmediateChildOfMethodCallExpr(
MethodCallExpr e, int index, string partialPredicateCall
) {
exists(int b, int bExpr, int n, int nReceiver, int nArg |
exists(int b, int bExpr, int n, int nReceiver, int nArg, int nGenericArgs |
b = 0 and
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
n = bExpr and
nReceiver = n + 1 and
nArg = nReceiver + 1 + max(int i | i = -1 or exists(e.getArg(i)) | i) and
nGenericArgs = nArg + 1 and
(
none()
or
@@ -760,6 +800,8 @@ private module Impl {
or
result = e.getArg(index - nReceiver) and
partialPredicateCall = "Arg(" + (index - nReceiver).toString() + ")"
or
index = nArg and result = e.getGenericArgs() and partialPredicateCall = "GenericArgs()"
)
)
}
@@ -846,27 +888,33 @@ private module Impl {
}
private Element getImmediateChildOfPathExpr(PathExpr e, int index, string partialPredicateCall) {
exists(int b, int bExpr, int n |
exists(int b, int bExpr, int n, int nPath |
b = 0 and
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
n = bExpr and
nPath = n + 1 and
(
none()
or
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
or
index = n and result = e.getPath() and partialPredicateCall = "Path()"
)
)
}
private Element getImmediateChildOfPathPat(PathPat e, int index, string partialPredicateCall) {
exists(int b, int bPat, int n |
exists(int b, int bPat, int n, int nPath |
b = 0 and
bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and
n = bPat and
nPath = n + 1 and
(
none()
or
result = getImmediateChildOfPat(e, index - b, partialPredicateCall)
or
index = n and result = e.getPath() and partialPredicateCall = "Path()"
)
)
}
@@ -912,27 +960,44 @@ private module Impl {
private Element getImmediateChildOfRecordLitExpr(
RecordLitExpr e, int index, string partialPredicateCall
) {
exists(int b, int bExpr, int n |
exists(int b, int bExpr, int n, int nPath, int nField, int nSpread |
b = 0 and
bExpr = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfExpr(e, i, _)) | i) and
n = bExpr and
nPath = n + 1 and
nField = nPath + 1 + max(int i | i = -1 or exists(e.getField(i)) | i) and
nSpread = nField + 1 and
(
none()
or
result = getImmediateChildOfExpr(e, index - b, partialPredicateCall)
or
index = n and result = e.getPath() and partialPredicateCall = "Path()"
or
result = e.getField(index - nPath) and
partialPredicateCall = "Field(" + (index - nPath).toString() + ")"
or
index = nField and result = e.getSpread() and partialPredicateCall = "Spread()"
)
)
}
private Element getImmediateChildOfRecordPat(RecordPat e, int index, string partialPredicateCall) {
exists(int b, int bPat, int n |
exists(int b, int bPat, int n, int nPath, int nArg |
b = 0 and
bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and
n = bPat and
nPath = n + 1 and
nArg = nPath + 1 + max(int i | i = -1 or exists(e.getArg(i)) | i) and
(
none()
or
result = getImmediateChildOfPat(e, index - b, partialPredicateCall)
or
index = n and result = e.getPath() and partialPredicateCall = "Path()"
or
result = e.getArg(index - nPath) and
partialPredicateCall = "Arg(" + (index - nPath).toString() + ")"
)
)
}
@@ -1046,14 +1111,21 @@ private module Impl {
private Element getImmediateChildOfTupleStructPat(
TupleStructPat e, int index, string partialPredicateCall
) {
exists(int b, int bPat, int n |
exists(int b, int bPat, int n, int nPath, int nArg |
b = 0 and
bPat = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfPat(e, i, _)) | i) and
n = bPat and
nPath = n + 1 and
nArg = nPath + 1 + max(int i | i = -1 or exists(e.getArg(i)) | i) and
(
none()
or
result = getImmediateChildOfPat(e, index - b, partialPredicateCall)
or
index = n and result = e.getPath() and partialPredicateCall = "Path()"
or
result = e.getArg(index - nPath) and
partialPredicateCall = "Arg(" + (index - nPath).toString() + ")"
)
)
}
@@ -1241,6 +1313,10 @@ private module Impl {
or
result = getImmediateChildOfMatchArm(e, index, partialAccessor)
or
result = getImmediateChildOfRecordFieldPat(e, index, partialAccessor)
or
result = getImmediateChildOfRecordLitField(e, index, partialAccessor)
or
result = getImmediateChildOfTypeRef(e, index, partialAccessor)
or
result = getImmediateChildOfUnimplemented(e, index, partialAccessor)

View File

@@ -7,6 +7,7 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Expr
import codeql.rust.elements.Unimplemented
/**
* INTERNAL: This module contains the fully generated definition of `PathExpr` and should not
@@ -19,5 +20,15 @@ module Generated {
*/
class PathExpr extends Synth::TPathExpr, Expr {
override string getAPrimaryQlClass() { result = "PathExpr" }
/**
* Gets the path of this path expression.
*/
Unimplemented getPath() {
result =
Synth::convertUnimplementedFromRaw(Synth::convertPathExprToRaw(this)
.(Raw::PathExpr)
.getPath())
}
}
}

View File

@@ -7,6 +7,7 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Pat
import codeql.rust.elements.Unimplemented
/**
* INTERNAL: This module contains the fully generated definition of `PathPat` and should not
@@ -19,5 +20,13 @@ module Generated {
*/
class PathPat extends Synth::TPathPat, Pat {
override string getAPrimaryQlClass() { result = "PathPat" }
/**
* Gets the path of this path pat.
*/
Unimplemented getPath() {
result =
Synth::convertUnimplementedFromRaw(Synth::convertPathPatToRaw(this).(Raw::PathPat).getPath())
}
}
}

View File

@@ -128,6 +128,40 @@ module Raw {
*/
class Pat extends @pat, AstNode { }
/**
* INTERNAL: Do not use.
*/
class RecordFieldPat extends @record_field_pat, AstNode {
override string toString() { result = "RecordFieldPat" }
/**
* Gets the name of this record field pat.
*/
string getName() { record_field_pats(this, result, _) }
/**
* Gets the pat of this record field pat.
*/
Pat getPat() { record_field_pats(this, _, result) }
}
/**
* INTERNAL: Do not use.
*/
class RecordLitField extends @record_lit_field, AstNode {
override string toString() { result = "RecordLitField" }
/**
* Gets the name of this record lit field.
*/
string getName() { record_lit_fields(this, result, _) }
/**
* Gets the expression of this record lit field.
*/
Expr getExpr() { record_lit_fields(this, _, result) }
}
/**
* INTERNAL: Do not use.
*/
@@ -334,7 +368,12 @@ module Raw {
/**
* Gets the body of this closure expression.
*/
Expr getBody() { closure_exprs(this, result) }
Expr getBody() { closure_exprs(this, result, _) }
/**
* Gets the closure kind of this closure expression.
*/
string getClosureKind() { closure_exprs(this, _, result) }
/**
* Holds if this closure expression is move.
@@ -359,6 +398,11 @@ module Raw {
*/
class ConstExpr extends @const_expr, Expr {
override string toString() { result = "ConstExpr" }
/**
* Gets the expression of this const expression.
*/
Expr getExpr() { const_exprs(this, result) }
}
/**
@@ -614,6 +658,11 @@ module Raw {
* Gets the `index`th argument of this method call expression (0-based).
*/
Expr getArg(int index) { method_call_expr_args(this, index, result) }
/**
* Gets the generic arguments of this method call expression, if it exists.
*/
Unimplemented getGenericArgs() { method_call_expr_generic_args(this, result) }
}
/**
@@ -676,6 +725,11 @@ module Raw {
*/
class PathExpr extends @path_expr, Expr {
override string toString() { result = "PathExpr" }
/**
* Gets the path of this path expression.
*/
Unimplemented getPath() { path_exprs(this, result) }
}
/**
@@ -683,6 +737,11 @@ module Raw {
*/
class PathPat extends @path_pat, Pat {
override string toString() { result = "PathPat" }
/**
* Gets the path of this path pat.
*/
Unimplemented getPath() { path_pats(this, result) }
}
/**
@@ -729,6 +788,31 @@ module Raw {
*/
class RecordLitExpr extends @record_lit_expr, Expr {
override string toString() { result = "RecordLitExpr" }
/**
* Gets the path of this record lit expression, if it exists.
*/
Unimplemented getPath() { record_lit_expr_paths(this, result) }
/**
* Gets the `index`th field of this record lit expression (0-based).
*/
RecordLitField getField(int index) { record_lit_expr_fields(this, index, result) }
/**
* Gets the spread of this record lit expression, if it exists.
*/
Expr getSpread() { record_lit_expr_spreads(this, result) }
/**
* Holds if this record lit expression has ellipsis.
*/
predicate hasEllipsis() { record_lit_expr_has_ellipsis(this) }
/**
* Holds if this record lit expression is assignee expression.
*/
predicate isAssigneeExpr() { record_lit_expr_is_assignee_expr(this) }
}
/**
@@ -736,6 +820,21 @@ module Raw {
*/
class RecordPat extends @record_pat, Pat {
override string toString() { result = "RecordPat" }
/**
* Gets the path of this record pat, if it exists.
*/
Unimplemented getPath() { record_pat_paths(this, result) }
/**
* Gets the `index`th argument of this record pat (0-based).
*/
RecordFieldPat getArg(int index) { record_pat_args(this, index, result) }
/**
* Holds if this record pat has ellipsis.
*/
predicate hasEllipsis() { record_pat_has_ellipsis(this) }
}
/**
@@ -850,6 +949,21 @@ module Raw {
*/
class TupleStructPat extends @tuple_struct_pat, Pat {
override string toString() { result = "TupleStructPat" }
/**
* Gets the path of this tuple struct pat, if it exists.
*/
Unimplemented getPath() { tuple_struct_pat_paths(this, result) }
/**
* Gets the `index`th argument of this tuple struct pat (0-based).
*/
Pat getArg(int index) { tuple_struct_pat_args(this, index, result) }
/**
* Gets the ellipsis index of this tuple struct pat, if it exists.
*/
int getEllipsisIndex() { tuple_struct_pat_ellipsis_indices(this, result) }
}
/**

View File

@@ -0,0 +1,41 @@
// generated by codegen
/**
* This module provides the generated definition of `RecordFieldPat`.
* INTERNAL: Do not import directly.
*/
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.AstNode
import codeql.rust.elements.Pat
/**
* INTERNAL: This module contains the fully generated definition of `RecordFieldPat` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::RecordFieldPat` class directly.
* Use the subclass `RecordFieldPat`, where the following predicates are available.
*/
class RecordFieldPat extends Synth::TRecordFieldPat, AstNode {
override string getAPrimaryQlClass() { result = "RecordFieldPat" }
/**
* Gets the name of this record field pat.
*/
string getName() {
result = Synth::convertRecordFieldPatToRaw(this).(Raw::RecordFieldPat).getName()
}
/**
* Gets the pat of this record field pat.
*/
Pat getPat() {
result =
Synth::convertPatFromRaw(Synth::convertRecordFieldPatToRaw(this)
.(Raw::RecordFieldPat)
.getPat())
}
}
}

View File

@@ -7,6 +7,8 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Expr
import codeql.rust.elements.RecordLitField
import codeql.rust.elements.Unimplemented
/**
* INTERNAL: This module contains the fully generated definition of `RecordLitExpr` and should not
@@ -19,5 +21,69 @@ module Generated {
*/
class RecordLitExpr extends Synth::TRecordLitExpr, Expr {
override string getAPrimaryQlClass() { result = "RecordLitExpr" }
/**
* Gets the path of this record lit expression, if it exists.
*/
Unimplemented getPath() {
result =
Synth::convertUnimplementedFromRaw(Synth::convertRecordLitExprToRaw(this)
.(Raw::RecordLitExpr)
.getPath())
}
/**
* Holds if `getPath()` exists.
*/
final predicate hasPath() { exists(this.getPath()) }
/**
* Gets the `index`th field of this record lit expression (0-based).
*/
RecordLitField getField(int index) {
result =
Synth::convertRecordLitFieldFromRaw(Synth::convertRecordLitExprToRaw(this)
.(Raw::RecordLitExpr)
.getField(index))
}
/**
* Gets any of the fields of this record lit expression.
*/
final RecordLitField getAField() { result = this.getField(_) }
/**
* Gets the number of fields of this record lit expression.
*/
final int getNumberOfFields() { result = count(int i | exists(this.getField(i))) }
/**
* Gets the spread of this record lit expression, if it exists.
*/
Expr getSpread() {
result =
Synth::convertExprFromRaw(Synth::convertRecordLitExprToRaw(this)
.(Raw::RecordLitExpr)
.getSpread())
}
/**
* Holds if `getSpread()` exists.
*/
final predicate hasSpread() { exists(this.getSpread()) }
/**
* Holds if this record lit expression has ellipsis.
*/
predicate hasEllipsis() {
Synth::convertRecordLitExprToRaw(this).(Raw::RecordLitExpr).hasEllipsis()
}
/**
* Holds if this record lit expression is assignee expression.
*/
predicate isAssigneeExpr() {
Synth::convertRecordLitExprToRaw(this).(Raw::RecordLitExpr).isAssigneeExpr()
}
}
}

View File

@@ -0,0 +1,41 @@
// generated by codegen
/**
* This module provides the generated definition of `RecordLitField`.
* INTERNAL: Do not import directly.
*/
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.AstNode
import codeql.rust.elements.Expr
/**
* INTERNAL: This module contains the fully generated definition of `RecordLitField` and should not
* be referenced directly.
*/
module Generated {
/**
* INTERNAL: Do not reference the `Generated::RecordLitField` class directly.
* Use the subclass `RecordLitField`, where the following predicates are available.
*/
class RecordLitField extends Synth::TRecordLitField, AstNode {
override string getAPrimaryQlClass() { result = "RecordLitField" }
/**
* Gets the name of this record lit field.
*/
string getName() {
result = Synth::convertRecordLitFieldToRaw(this).(Raw::RecordLitField).getName()
}
/**
* Gets the expression of this record lit field.
*/
Expr getExpr() {
result =
Synth::convertExprFromRaw(Synth::convertRecordLitFieldToRaw(this)
.(Raw::RecordLitField)
.getExpr())
}
}
}

View File

@@ -7,6 +7,8 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Pat
import codeql.rust.elements.RecordFieldPat
import codeql.rust.elements.Unimplemented
/**
* INTERNAL: This module contains the fully generated definition of `RecordPat` and should not
@@ -19,5 +21,45 @@ module Generated {
*/
class RecordPat extends Synth::TRecordPat, Pat {
override string getAPrimaryQlClass() { result = "RecordPat" }
/**
* Gets the path of this record pat, if it exists.
*/
Unimplemented getPath() {
result =
Synth::convertUnimplementedFromRaw(Synth::convertRecordPatToRaw(this)
.(Raw::RecordPat)
.getPath())
}
/**
* Holds if `getPath()` exists.
*/
final predicate hasPath() { exists(this.getPath()) }
/**
* Gets the `index`th argument of this record pat (0-based).
*/
RecordFieldPat getArg(int index) {
result =
Synth::convertRecordFieldPatFromRaw(Synth::convertRecordPatToRaw(this)
.(Raw::RecordPat)
.getArg(index))
}
/**
* Gets any of the arguments of this record pat.
*/
final RecordFieldPat getAnArg() { result = this.getArg(_) }
/**
* Gets the number of arguments of this record pat.
*/
final int getNumberOfArgs() { result = count(int i | exists(this.getArg(i))) }
/**
* Holds if this record pat has ellipsis.
*/
predicate hasEllipsis() { Synth::convertRecordPatToRaw(this).(Raw::RecordPat).hasEllipsis() }
}
}

View File

@@ -187,10 +187,18 @@ module Synth {
* INTERNAL: Do not use.
*/
TRangePat(Raw::RangePat id) { constructRangePat(id) } or
/**
* INTERNAL: Do not use.
*/
TRecordFieldPat(Raw::RecordFieldPat id) { constructRecordFieldPat(id) } or
/**
* INTERNAL: Do not use.
*/
TRecordLitExpr(Raw::RecordLitExpr id) { constructRecordLitExpr(id) } or
/**
* INTERNAL: Do not use.
*/
TRecordLitField(Raw::RecordLitField id) { constructRecordLitField(id) } or
/**
* INTERNAL: Do not use.
*/
@@ -277,7 +285,8 @@ module Synth {
* INTERNAL: Do not use.
*/
class TAstNode =
TDeclaration or TExpr or TLabel or TMatchArm or TPat or TStmt or TTypeRef or TUnimplemented;
TDeclaration or TExpr or TLabel or TMatchArm or TPat or TRecordFieldPat or TRecordLitField or
TStmt or TTypeRef or TUnimplemented;
/**
* INTERNAL: Do not use.
@@ -628,6 +637,13 @@ module Synth {
cached
TRangePat convertRangePatFromRaw(Raw::Element e) { result = TRangePat(e) }
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TRecordFieldPat`, if possible.
*/
cached
TRecordFieldPat convertRecordFieldPatFromRaw(Raw::Element e) { result = TRecordFieldPat(e) }
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TRecordLitExpr`, if possible.
@@ -635,6 +651,13 @@ module Synth {
cached
TRecordLitExpr convertRecordLitExprFromRaw(Raw::Element e) { result = TRecordLitExpr(e) }
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TRecordLitField`, if possible.
*/
cached
TRecordLitField convertRecordLitFieldFromRaw(Raw::Element e) { result = TRecordLitField(e) }
/**
* INTERNAL: Do not use.
* Converts a raw element to a synthesized `TRecordPat`, if possible.
@@ -795,6 +818,10 @@ module Synth {
or
result = convertPatFromRaw(e)
or
result = convertRecordFieldPatFromRaw(e)
or
result = convertRecordLitFieldFromRaw(e)
or
result = convertStmtFromRaw(e)
or
result = convertTypeRefFromRaw(e)
@@ -1290,6 +1317,13 @@ module Synth {
cached
Raw::Element convertRangePatToRaw(TRangePat e) { e = TRangePat(result) }
/**
* INTERNAL: Do not use.
* Converts a synthesized `TRecordFieldPat` to a raw DB element, if possible.
*/
cached
Raw::Element convertRecordFieldPatToRaw(TRecordFieldPat e) { e = TRecordFieldPat(result) }
/**
* INTERNAL: Do not use.
* Converts a synthesized `TRecordLitExpr` to a raw DB element, if possible.
@@ -1297,6 +1331,13 @@ module Synth {
cached
Raw::Element convertRecordLitExprToRaw(TRecordLitExpr e) { e = TRecordLitExpr(result) }
/**
* INTERNAL: Do not use.
* Converts a synthesized `TRecordLitField` to a raw DB element, if possible.
*/
cached
Raw::Element convertRecordLitFieldToRaw(TRecordLitField e) { e = TRecordLitField(result) }
/**
* INTERNAL: Do not use.
* Converts a synthesized `TRecordPat` to a raw DB element, if possible.
@@ -1457,6 +1498,10 @@ module Synth {
or
result = convertPatToRaw(e)
or
result = convertRecordFieldPatToRaw(e)
or
result = convertRecordLitFieldToRaw(e)
or
result = convertStmtToRaw(e)
or
result = convertTypeRefToRaw(e)

View File

@@ -46,7 +46,9 @@ import codeql.rust.elements.PathExprConstructor
import codeql.rust.elements.PathPatConstructor
import codeql.rust.elements.RangeExprConstructor
import codeql.rust.elements.RangePatConstructor
import codeql.rust.elements.RecordFieldPatConstructor
import codeql.rust.elements.RecordLitExprConstructor
import codeql.rust.elements.RecordLitFieldConstructor
import codeql.rust.elements.RecordPatConstructor
import codeql.rust.elements.RefExprConstructor
import codeql.rust.elements.RefPatConstructor

View File

@@ -7,6 +7,7 @@
private import codeql.rust.generated.Synth
private import codeql.rust.generated.Raw
import codeql.rust.elements.Pat
import codeql.rust.elements.Unimplemented
/**
* INTERNAL: This module contains the fully generated definition of `TupleStructPat` and should not
@@ -19,5 +20,52 @@ module Generated {
*/
class TupleStructPat extends Synth::TTupleStructPat, Pat {
override string getAPrimaryQlClass() { result = "TupleStructPat" }
/**
* Gets the path of this tuple struct pat, if it exists.
*/
Unimplemented getPath() {
result =
Synth::convertUnimplementedFromRaw(Synth::convertTupleStructPatToRaw(this)
.(Raw::TupleStructPat)
.getPath())
}
/**
* Holds if `getPath()` exists.
*/
final predicate hasPath() { exists(this.getPath()) }
/**
* Gets the `index`th argument of this tuple struct pat (0-based).
*/
Pat getArg(int index) {
result =
Synth::convertPatFromRaw(Synth::convertTupleStructPatToRaw(this)
.(Raw::TupleStructPat)
.getArg(index))
}
/**
* Gets any of the arguments of this tuple struct pat.
*/
final Pat getAnArg() { result = this.getArg(_) }
/**
* Gets the number of arguments of this tuple struct pat.
*/
final int getNumberOfArgs() { result = count(int i | exists(this.getArg(i))) }
/**
* Gets the ellipsis index of this tuple struct pat, if it exists.
*/
int getEllipsisIndex() {
result = Synth::convertTupleStructPatToRaw(this).(Raw::TupleStructPat).getEllipsisIndex()
}
/**
* Holds if `getEllipsisIndex()` exists.
*/
final predicate hasEllipsisIndex() { exists(this.getEllipsisIndex()) }
}
}

View File

@@ -57,6 +57,8 @@ locations(
| @label
| @match_arm
| @pat
| @record_field_pat
| @record_lit_field
| @stmt
| @type_ref
| @unimplemented
@@ -145,6 +147,18 @@ match_arm_guards(
| @wild_pat
;
record_field_pats(
unique int id: @record_field_pat,
string name: string ref,
int pat: @pat ref
);
record_lit_fields(
unique int id: @record_lit_field,
string name: string ref,
int expr: @expr ref
);
@stmt =
@expr_stmt
| @item_stmt
@@ -267,7 +281,8 @@ cast_exprs(
closure_exprs(
unique int id: @closure_expr,
int body: @expr ref
int body: @expr ref,
string closure_kind: string ref
);
#keyset[id, index]
@@ -301,7 +316,8 @@ const_block_pats(
);
const_exprs(
unique int id: @const_expr
unique int id: @const_expr,
int expr: @expr ref
);
continue_exprs(
@@ -442,6 +458,12 @@ method_call_expr_args(
int arg: @expr ref
);
#keyset[id]
method_call_expr_generic_args(
int id: @method_call_expr ref,
int generic_args: @unimplemented ref
);
missing_exprs(
unique int id: @missing_expr
);
@@ -485,11 +507,13 @@ or_pat_args(
);
path_exprs(
unique int id: @path_expr
unique int id: @path_expr,
int path: @unimplemented ref
);
path_pats(
unique int id: @path_pat
unique int id: @path_pat,
int path: @unimplemented ref
);
range_exprs(
@@ -533,10 +557,57 @@ record_lit_exprs(
unique int id: @record_lit_expr
);
#keyset[id]
record_lit_expr_paths(
int id: @record_lit_expr ref,
int path: @unimplemented ref
);
#keyset[id, index]
record_lit_expr_fields(
int id: @record_lit_expr ref,
int index: int ref,
int field: @record_lit_field ref
);
#keyset[id]
record_lit_expr_spreads(
int id: @record_lit_expr ref,
int spread: @expr ref
);
#keyset[id]
record_lit_expr_has_ellipsis(
int id: @record_lit_expr ref
);
#keyset[id]
record_lit_expr_is_assignee_expr(
int id: @record_lit_expr ref
);
record_pats(
unique int id: @record_pat
);
#keyset[id]
record_pat_paths(
int id: @record_pat ref,
int path: @unimplemented ref
);
#keyset[id, index]
record_pat_args(
int id: @record_pat ref,
int index: int ref,
int arg: @record_field_pat ref
);
#keyset[id]
record_pat_has_ellipsis(
int id: @record_pat ref
);
ref_exprs(
unique int id: @ref_expr,
int expr: @expr ref
@@ -633,6 +704,25 @@ tuple_struct_pats(
unique int id: @tuple_struct_pat
);
#keyset[id]
tuple_struct_pat_paths(
int id: @tuple_struct_pat ref,
int path: @unimplemented ref
);
#keyset[id, index]
tuple_struct_pat_args(
int id: @tuple_struct_pat ref,
int index: int ref,
int arg: @pat ref
);
#keyset[id]
tuple_struct_pat_ellipsis_indices(
int id: @tuple_struct_pat ref,
int ellipsis_index: int ref
);
unary_op_exprs(
unique int id: @unary_op_expr,
int expr: @expr ref,

View File

@@ -0,0 +1,4 @@
// generated by codegen
After a source file is added in this directory and codegen is run again, test queries
will appear and this file will be deleted

View File

@@ -0,0 +1,4 @@
// generated by codegen
After a source file is added in this directory and codegen is run again, test queries
will appear and this file will be deleted

View File

@@ -123,12 +123,12 @@ class Function(Declaration):
class MissingExpr(Expr):
pass
# Path(Path),
class PathExpr(Expr):
# TODO
pass
path: Unimplemented | child
# If {
# condition: ExprId,
@@ -182,7 +182,7 @@ class AsyncBlockExpr(BlockExprBase):
class ConstExpr(Expr):
pass
expr: Expr | child
# // FIXME: Fold this into Block with an unsafe flag?
# Unsafe {
@@ -229,8 +229,7 @@ class MethodCallExpr(Expr):
receiver: Expr | child
method_name: string
args: list[Expr] | child
# TODO
# generic_args: optional[GenericArgs]
generic_args: optional[Unimplemented] | child
# pub struct MatchArm {
# pub pat: PatId,
@@ -310,9 +309,22 @@ class YeetExpr(Expr):
# },
class RecordFieldPat(AstNode):
name: string
pat: Pat | child
class RecordLitField(AstNode):
name: string
expr: Expr | child
class RecordLitExpr(Expr):
# TODO
pass
path: optional[Unimplemented] | child
fields: list[RecordLitField] | child
spread: optional[Expr] | child
has_ellipsis: predicate
is_assignee_expr: predicate
# Field {
@@ -422,8 +434,7 @@ class ClosureExpr(Expr):
arg_types: list[optional[TypeRef]] | child
ret_type: optional[TypeRef] | child
body: Expr | child
# TODO
# closure_kind: ClosureKind
closure_kind: string
is_move: predicate
# Tuple {
# exprs: Box<[ExprId]>,
@@ -530,12 +541,15 @@ class TuplePat(Pat):
class OrPat(Pat):
args: list[Pat] | child
# Record { path: Option<Box<Path>>, args: Box<[RecordFieldPat]>, ellipsis: bool },
# Record { path: Option<Box<Path>>, args: Box<[RecordFieldPat]>, ellipsis: bool },
class RecordPat(Pat):
# TODO
pass
path: optional[Unimplemented] | child
args: list[RecordFieldPat] | child
has_ellipsis: predicate
# Range { start: Option<Box<LiteralOrConst>>, end: Option<Box<LiteralOrConst>> },
@@ -554,7 +568,8 @@ class SlicePat(Pat):
class PathPat(Pat):
pass
path: Unimplemented | child
# Lit(ExprId),
@@ -572,8 +587,9 @@ class BindPat(Pat):
class TupleStructPat(Pat):
# TODO
pass
path: optional[Unimplemented] | child
args: list[Pat] | child
ellipsis_index: optional[int]
# Ref { pat: PatId, mutability: Mutability },