mirror of
https://github.com/Sarsoo/csbindgen.git
synced 2024-12-22 22:46:26 +00:00
TODO:collect_enum parse syn
This commit is contained in:
parent
5b0792802c
commit
17bd45271d
2
csbindgen-tests/Cargo.toml
vendored
2
csbindgen-tests/Cargo.toml
vendored
@ -14,7 +14,7 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
csbindgen = { path = "../csbindgen" }
|
||||
physx-sys = "0.11.0"
|
||||
# physx-sys = "0.11.0"
|
||||
|
||||
[build-dependencies]
|
||||
cc = "1.0.79"
|
||||
|
@ -185,8 +185,8 @@ impl Builder {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn has_input_file(&self) -> bool {
|
||||
!self.options.input_bindgen_file.to_string_lossy().is_empty()
|
||||
fn has_input_files(&self) -> bool {
|
||||
!self.options.input_bindgen_files.is_empty()
|
||||
}
|
||||
fn has_input_externals(&self) -> bool {
|
||||
!self.options.input_extern_files.is_empty()
|
||||
@ -197,7 +197,7 @@ impl Builder {
|
||||
rust_output_path: P,
|
||||
csharp_output_path: P,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
if !self.options.input_bindgen_files.is_empty() {
|
||||
if self.has_input_files() {
|
||||
let (rust, csharp) = generate(GenerateKind::InputBindgen, &self.options)?;
|
||||
|
||||
if let Some(rust) = rust {
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{alias_map::AliasMap, builder::BindgenOptions, field_map::FieldMap, type_meta::*};
|
||||
use std::collections::HashSet;
|
||||
use syn::{ForeignItem, Item, Pat, ReturnType};
|
||||
use syn::{ForeignItem, Item, Pat, ReturnType, __private::ToTokens};
|
||||
|
||||
enum FnItem {
|
||||
ForeignItem(syn::ForeignItemFn),
|
||||
@ -209,6 +209,24 @@ pub fn collect_enum(ast: &syn::File, result: &mut Vec<RustEnum>) {
|
||||
repr,
|
||||
});
|
||||
}
|
||||
else if let Item::Macro(t) = item {
|
||||
let last_segment = t.mac.path.segments.last().unwrap();
|
||||
if last_segment.ident == "bitflags" {
|
||||
// t.mac.tokens
|
||||
//let inner_ast = syn::parse(t.mac.tokens);
|
||||
//let ttt = t.mac.to_token_stream();
|
||||
|
||||
let input = t.mac.to_tokens(tokens);
|
||||
//let foo = syn::parse(tokens);
|
||||
//let tako = syn::parse2(tokens);
|
||||
|
||||
//t.mac.tokens.to_string()
|
||||
|
||||
let ast: syn::DeriveInput = syn::parse_file(content)
|
||||
|
||||
//let file_ast = syn::parse_file(t.mac.to_tokens(tokens)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user