| 1 |
/* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 |
|
| 5 |
//! Initial IR, this is the Metadata from uniffi_meta with some slight changes: |
| 6 |
//! |
| 7 |
//! * The Type/Literal enums are wrapped in TypeNode/LiteralNode structs. This allows for future pipeline passes to add fields. |
| 8 |
//! * module_path is normalized to module_name (UDL and proc-macros determine module_path differently). |
| 9 |
|
| 10 |
#[macro_use] |
| 11 |
pub mod nodes; |
| 12 |
|
| 13 |
mod callable; |
| 14 |
mod callback_interfaces; |
| 15 |
mod checksums; |
| 16 |
mod enums; |
| 17 |
mod ffi_async_data; |
| 18 |
mod ffi_functions; |
| 19 |
mod ffi_types; |
| 20 |
mod objects; |
| 21 |
mod rust_buffer; |
| 22 |
mod rust_future; |
| 23 |
mod self_types; |
| 24 |
mod sort; |
| 25 |
mod type_definitions_from_api; |
| 26 |
mod type_nodes; |
| 27 |
|
| 28 |
use crate::pipeline::initial; |
| 29 |
use anyhow::{bail, Result}; |
| 30 |
use indexmap::IndexMap; |
| 31 |
pub use nodes::*; |
| 32 |
use uniffi_pipeline::{new_pipeline, Node, Pipeline}; |
| 33 |
|
| 34 |
/// General IR pipeline |
| 35 |
/// |
| 36 |
/// This is the shared beginning for all bindings pipelines. |
| 37 |
/// Bindings generators will add language-specific passes to this. |
| 38 |
pub fn pipeline() -> Pipeline<initial::Root, Root> { |
| 39 |
new_pipeline() |
| 40 |
.convert_ir_pass::<Root>() |
| 41 |
.pass(callable::pass) |
| 42 |
.pass(rust_buffer::pass) |
| 43 |
.pass(rust_future::pass) |
| 44 |
.pass(self_types::pass) |
| 45 |
.pass(type_definitions_from_api::pass) |
| 46 |
.pass(type_nodes::pass) |
| 47 |
.pass(ffi_types::pass) |
| 48 |
.pass(ffi_async_data::pass) |
| 49 |
.pass(enums::pass) |
| 50 |
.pass(objects::pass) |
| 51 |
.pass(callback_interfaces::pass) |
| 52 |
.pass(ffi_functions::pass) |
| 53 |
.pass(checksums::pass) |
| 54 |
.pass(sort::pass) |
| 55 |
} |