mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-24 18:12:14 +00:00
Make type information accessible through OutFile
This commit is contained in:
parent
598154250c
commit
b560a0fabf
@ -1,9 +1,11 @@
|
||||
use crate::gen::include::Includes;
|
||||
use crate::syntax::Types;
|
||||
use std::cell::RefCell;
|
||||
use std::fmt::{self, Arguments, Write};
|
||||
|
||||
pub(crate) struct OutFile {
|
||||
pub(crate) struct OutFile<'a> {
|
||||
pub header: bool,
|
||||
pub types: &'a Types<'a>,
|
||||
pub include: Includes,
|
||||
pub front: Content,
|
||||
content: RefCell<Content>,
|
||||
@ -15,10 +17,11 @@ pub struct Content {
|
||||
blocks_pending: Vec<&'static str>,
|
||||
}
|
||||
|
||||
impl OutFile {
|
||||
pub fn new(header: bool) -> Self {
|
||||
impl<'a> OutFile<'a> {
|
||||
pub fn new(header: bool, types: &'a Types) -> Self {
|
||||
OutFile {
|
||||
header,
|
||||
types,
|
||||
include: Includes::new(),
|
||||
front: Content::new(),
|
||||
content: RefCell::new(Content::new()),
|
||||
|
@ -10,8 +10,8 @@ use crate::syntax::{
|
||||
use proc_macro2::Ident;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub(super) fn gen(apis: &[Api], types: &Types, opt: &Opt, header: bool) -> OutFile {
|
||||
let mut out_file = OutFile::new(header);
|
||||
pub(super) fn gen<'a>(apis: &[Api], types: &'a Types, opt: &Opt, header: bool) -> OutFile<'a> {
|
||||
let mut out_file = OutFile::new(header, types);
|
||||
let out = &mut out_file;
|
||||
|
||||
if header {
|
||||
|
Loading…
x
Reference in New Issue
Block a user