mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-23 17:40:53 +00:00
Skeleton for topological sort
This commit is contained in:
parent
dfb82d74d5
commit
58cd0c75b4
@ -12,6 +12,7 @@ pub(super) mod include;
|
||||
mod namespace;
|
||||
mod nested;
|
||||
pub(super) mod out;
|
||||
mod toposort;
|
||||
mod write;
|
||||
|
||||
pub(super) use self::error::Error;
|
||||
|
8
gen/src/toposort.rs
Normal file
8
gen/src/toposort.rs
Normal file
@ -0,0 +1,8 @@
|
||||
use crate::syntax::{Api, Types};
|
||||
use std::iter::FromIterator;
|
||||
|
||||
pub fn sort<'a>(apis: &'a [Api], types: &Types) -> Vec<&'a Api> {
|
||||
// TODO https://github.com/dtolnay/cxx/issues/292
|
||||
let _ = types;
|
||||
Vec::from_iter(apis)
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
use crate::gen::block::Block;
|
||||
use crate::gen::nested::NamespaceEntries;
|
||||
use crate::gen::out::OutFile;
|
||||
use crate::gen::{builtin, include, Opt};
|
||||
use crate::gen::{builtin, include, toposort, Opt};
|
||||
use crate::syntax::atom::Atom::{self, *};
|
||||
use crate::syntax::symbol::Symbol;
|
||||
use crate::syntax::{
|
||||
@ -76,7 +76,7 @@ fn write_data_structures<'a>(out: &mut OutFile<'a>, apis: &'a [Api]) {
|
||||
}
|
||||
}
|
||||
|
||||
for api in apis {
|
||||
for api in toposort::sort(apis, out.types) {
|
||||
match api {
|
||||
Api::Struct(strct) => {
|
||||
out.next_section();
|
||||
|
Loading…
x
Reference in New Issue
Block a user