mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
Rust: introduce PathExprBase class
This commit is contained in:
2
rust/extractor/src/generated/.generated.list
generated
2
rust/extractor/src/generated/.generated.list
generated
@@ -1,2 +1,2 @@
|
||||
mod.rs 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7 4bcb9def847469aae9d8649461546b7c21ec97cf6e63d3cf394e339915ce65d7
|
||||
top.rs f7bff00786adef1f7f80825d9f613a958c92d35896ea8c3c3b077b9992dca590 f7bff00786adef1f7f80825d9f613a958c92d35896ea8c3c3b077b9992dca590
|
||||
top.rs a77ab900964451c668839aad6827ea539b8932e7c93b54a7987ece0e1bd846ba a77ab900964451c668839aad6827ea539b8932e7c93b54a7987ece0e1bd846ba
|
||||
|
||||
122
rust/extractor/src/generated/top.rs
generated
122
rust/extractor/src/generated/top.rs
generated
@@ -6232,62 +6232,44 @@ impl From<trap::Label<ParenType>> for trap::Label<TypeRef> {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PathExpr {
|
||||
pub id: trap::TrapId<PathExpr>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub path: Option<trap::Label<Path>>,
|
||||
pub struct PathExprBase {
|
||||
_unused: ()
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for PathExpr {
|
||||
fn extract_id(&mut self) -> trap::TrapId<Self> {
|
||||
std::mem::replace(&mut self.id, trap::TrapId::Star)
|
||||
}
|
||||
|
||||
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("path_exprs", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("path_expr_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.path {
|
||||
out.add_tuple("path_expr_paths", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
impl trap::TrapClass for PathExprBase {
|
||||
fn class_name() -> &'static str { "PathExprBase" }
|
||||
}
|
||||
|
||||
impl trap::TrapClass for PathExpr {
|
||||
fn class_name() -> &'static str { "PathExpr" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<PathExpr>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<PathExpr>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of AstNode
|
||||
impl From<trap::Label<PathExprBase>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<PathExprBase>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExprBase is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<PathExpr>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<PathExpr>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Element
|
||||
impl From<trap::Label<PathExprBase>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<PathExprBase>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExprBase is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<PathExpr>> for trap::Label<Expr> {
|
||||
fn from(value: trap::Label<PathExpr>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Expr
|
||||
impl From<trap::Label<PathExprBase>> for trap::Label<Expr> {
|
||||
fn from(value: trap::Label<PathExprBase>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExprBase is a subclass of Expr
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<PathExpr>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<PathExpr>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Locatable
|
||||
impl From<trap::Label<PathExprBase>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<PathExprBase>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExprBase is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
@@ -9225,6 +9207,78 @@ impl From<trap::Label<Module>> for trap::Label<Stmt> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PathExpr {
|
||||
pub id: trap::TrapId<PathExpr>,
|
||||
pub attrs: Vec<trap::Label<Attr>>,
|
||||
pub path: Option<trap::Label<Path>>,
|
||||
}
|
||||
|
||||
impl trap::TrapEntry for PathExpr {
|
||||
fn extract_id(&mut self) -> trap::TrapId<Self> {
|
||||
std::mem::replace(&mut self.id, trap::TrapId::Star)
|
||||
}
|
||||
|
||||
fn emit(self, id: trap::Label<Self>, out: &mut trap::Writer) {
|
||||
out.add_tuple("path_exprs", vec![id.into()]);
|
||||
for (i, v) in self.attrs.into_iter().enumerate() {
|
||||
out.add_tuple("path_expr_attrs", vec![id.into(), i.into(), v.into()]);
|
||||
}
|
||||
if let Some(v) = self.path {
|
||||
out.add_tuple("path_expr_paths", vec![id.into(), v.into()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl trap::TrapClass for PathExpr {
|
||||
fn class_name() -> &'static str { "PathExpr" }
|
||||
}
|
||||
|
||||
impl From<trap::Label<PathExpr>> for trap::Label<AstNode> {
|
||||
fn from(value: trap::Label<PathExpr>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of AstNode
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<PathExpr>> for trap::Label<Element> {
|
||||
fn from(value: trap::Label<PathExpr>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Element
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<PathExpr>> for trap::Label<Expr> {
|
||||
fn from(value: trap::Label<PathExpr>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Expr
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<PathExpr>> for trap::Label<Locatable> {
|
||||
fn from(value: trap::Label<PathExpr>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of Locatable
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<trap::Label<PathExpr>> for trap::Label<PathExprBase> {
|
||||
fn from(value: trap::Label<PathExpr>) -> Self {
|
||||
// SAFETY: this is safe because in the dbscheme PathExpr is a subclass of PathExprBase
|
||||
unsafe {
|
||||
Self::from_untyped(value.as_untyped())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Static {
|
||||
pub id: trap::TrapId<Static>,
|
||||
|
||||
Reference in New Issue
Block a user