mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-23 15:19:44 +00:00
Move C++-specific namespace code unused by the proc macro
This commit is contained in:
parent
6edeaab3cb
commit
90b133b553
@ -9,6 +9,7 @@ mod file;
|
|||||||
pub(super) mod fs;
|
pub(super) mod fs;
|
||||||
mod ifndef;
|
mod ifndef;
|
||||||
pub(super) mod include;
|
pub(super) mod include;
|
||||||
|
mod namespace;
|
||||||
mod nested;
|
mod nested;
|
||||||
pub(super) mod out;
|
pub(super) mod out;
|
||||||
mod write;
|
mod write;
|
||||||
|
14
gen/src/namespace.rs
Normal file
14
gen/src/namespace.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
use crate::syntax::namespace::Namespace;
|
||||||
|
use crate::syntax::Api;
|
||||||
|
|
||||||
|
impl Api {
|
||||||
|
pub fn namespace(&self) -> &Namespace {
|
||||||
|
match self {
|
||||||
|
Api::CxxFunction(efn) | Api::RustFunction(efn) => &efn.ident.cxx.namespace,
|
||||||
|
Api::CxxType(ety) | Api::RustType(ety) => &ety.ident.cxx.namespace,
|
||||||
|
Api::Enum(enm) => &enm.ident.cxx.namespace,
|
||||||
|
Api::Struct(strct) => &strct.ident.cxx.namespace,
|
||||||
|
Api::Impl(_) | Api::Include(_) | Api::TypeAlias(_) => Default::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
use crate::syntax::qualified::QualifiedName;
|
use crate::syntax::qualified::QualifiedName;
|
||||||
use crate::syntax::Api;
|
|
||||||
use quote::IdentFragment;
|
use quote::IdentFragment;
|
||||||
use std::fmt::{self, Display};
|
use std::fmt::{self, Display};
|
||||||
use std::iter::FromIterator;
|
use std::iter::FromIterator;
|
||||||
@ -84,15 +83,3 @@ impl<'a> FromIterator<&'a Ident> for Namespace {
|
|||||||
Namespace { segments }
|
Namespace { segments }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Api {
|
|
||||||
pub fn namespace(&self) -> &Namespace {
|
|
||||||
match self {
|
|
||||||
Api::CxxFunction(efn) | Api::RustFunction(efn) => &efn.ident.cxx.namespace,
|
|
||||||
Api::CxxType(ety) | Api::RustType(ety) => &ety.ident.cxx.namespace,
|
|
||||||
Api::Enum(enm) => &enm.ident.cxx.namespace,
|
|
||||||
Api::Struct(strct) => &strct.ident.cxx.namespace,
|
|
||||||
Api::Impl(_) | Api::Include(_) | Api::TypeAlias(_) => Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user