...
 
Commits (2)
......@@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Niko Matsakis <niko@alum.mit.edu>",
"Federico Mena Quintero<federico@gnome.org>",
"Alex Crichton <alex@alexcrichton.com>"]
edition = "2018"
[lib]
......
// use lalrpop_intern::InternedString;
use parser::keywords;
use crate::parser::keywords;
use proc_macro2::Ident;
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
......
use ast::*;
use errors::*;
use crate::ast::*;
use crate::errors::*;
pub fn check_program(program: &Program) -> Result<()> {
for class in get_program_classes(program) {
......@@ -19,7 +19,7 @@ fn check_class_items(_class: &Class) -> Result<()> {
pub mod tests {
use super::*;
use ast;
use crate::ast;
pub fn run() -> Result<()> {
checks_empty_class()
......
use hir::names::ParentNames;
use crate::hir::names::ParentNames;
use proc_macro2::TokenStream;
use quote::ToTokens;
......
use gen::slots::{ReservedSlotDeclarations, SlotDeclarations};
use hir::names::{Names, ParentNames};
use hir::{OverrideItem, Property, Slot};
use crate::gen::slots::{ReservedSlotDeclarations, SlotDeclarations};
use crate::hir::names::{Names, ParentNames};
use crate::hir::{OverrideItem, Property, Slot};
use syn::Field;
pub trait Boilerplate<'ast> {
......
use super::boilerplate::Boilerplate;
use ::hir::{Method, Signal, Slot, VirtualMethod};
use gen::ancestorext::AncestorRefExt;
use hir::Property;
use crate::hir::{Method, Signal, Slot, VirtualMethod};
use crate::gen::ancestorext::AncestorRefExt;
use crate::hir::Property;
use proc_macro2::TokenStream;
use quote::ToTokens;
use std::iter::FilterMap;
......
......@@ -3,12 +3,12 @@
use proc_macro2::TokenStream;
use gen::boilerplate::Boilerplate;
use gen::slots::{ReservedSlotDeclarations, SlotDeclarations};
use gen::BoilerplateExt;
use hir;
use hir::names::{Names, ParentNames};
use hir::{OverrideItem, Program, Property, Slot};
use crate::gen::boilerplate::Boilerplate;
use crate::gen::slots::{ReservedSlotDeclarations, SlotDeclarations};
use crate::gen::BoilerplateExt;
use crate::hir;
use crate::hir::names::{Names, ParentNames};
use crate::hir::{OverrideItem, Program, Property, Slot};
use syn::Field;
pub struct Class<'ast> {
......
......@@ -2,12 +2,12 @@ use quote::ToTokens;
use xml::writer::{EmitterConfig, XmlEvent};
use xml::EventWriter;
use gen::writer::GeneratorWrite;
use glib_utils::*;
use hir::names::Names;
use hir::{Class, FnArg, Method, Program, Slot, Ty};
use crate::gen::writer::GeneratorWrite;
use crate::glib_utils::*;
use crate::hir::names::Names;
use crate::hir::{Class, FnArg, Method, Program, Slot, Ty};
use errors::*;
use crate::errors::*;
use xml::writer::Result as EmitterResult;
......
use proc_macro2::{Ident, TokenStream};
use syn::Block;
use glib_utils::*;
use hir::{FnSig, Method, Override, OverrideItem, Signal, Slot, VirtualMethod};
use crate::glib_utils::*;
use crate::hir::{FnSig, Method, Override, OverrideItem, Signal, Slot, VirtualMethod};
use hir::names::{Names, ParentNames};
use crate::hir::names::{Names, ParentNames};
pub fn slot_assignments<'ast>(names: &Names, slots: &[Slot<'ast>]) -> Vec<TokenStream> {
let InstanceNameFfi = names.instance_ffi();
......
use super::boilerplate;
use gen::boilerplateext::BoilerplateExt;
use crate::gen::boilerplateext::BoilerplateExt;
use proc_macro2::TokenStream;
use quote::ToTokens;
use std::marker::PhantomData;
......
use proc_macro2::TokenStream;
use hir::{Method, Slot, VirtualMethod};
use crate::hir::{Method, Slot, VirtualMethod};
use super::signals;
use hir::names::Names;
use crate::hir::names::Names;
/// Generates function prototypes for use within the generated FooExt trait.
///
......
// We give `ClassName` variables an identifier that uses upper-case.
#![allow(non_snake_case)]
use hir;
use hir::{OverrideItem, Program, Property, Slot};
use crate::hir;
use crate::hir::{OverrideItem, Program, Property, Slot};
use gen::boilerplate::Boilerplate;
use gen::slots::{ReservedSlotDeclarations, SlotDeclarations};
use hir::names::{Names, ParentNames};
use crate::gen::boilerplate::Boilerplate;
use crate::gen::slots::{ReservedSlotDeclarations, SlotDeclarations};
use crate::hir::names::{Names, ParentNames};
use syn::Field;
......
......@@ -29,7 +29,7 @@ pub use self::instance::Instance;
pub use self::interface::Interface;
pub use self::property_ext::PropertyGenExt;
use self::writer::RustWriter;
use hir::Program;
use crate::hir::Program;
pub use self::ancestorext::AncestorRefExt;
......
use gen::boilerplate;
use gen::boilerplateext::BoilerplateExt;
use hir::{Override, OverrideItem};
use crate::gen::boilerplate;
use crate::gen::boilerplateext::BoilerplateExt;
use crate::hir::{Override, OverrideItem};
/// ! This file contains the instantion of all the data that is instantiated once
/// ! and stored in a static variable
use proc_macro2::TokenStream;
......@@ -75,7 +75,7 @@ impl<'lt, 'ast: 'lt, Boilerplate: boilerplate::Boilerplate<'ast>>
} else {
quote!{}
};
let names = ::gen::signals::signal_id_names(self.boilerplate.signals());
let names = crate::gen::signals::signal_id_names(self.boilerplate.signals());
let signal_id_names = &names;
let slot_declarations = self.boilerplate.slot_declarations();
let reserved_slot_declarations = self.boilerplate.reserved_slot_declarations();
......@@ -110,7 +110,7 @@ impl<'lt, 'ast: 'lt, Boilerplate: boilerplate::Boilerplate<'ast>>
/// Generates the static private variables
fn gen_priv_def(&self) -> TokenStream {
let structname = self.boilerplate.names().class_private();
let names = ::gen::signals::signal_id_names(self.boilerplate.signals());
let names = crate::gen::signals::signal_id_names(self.boilerplate.signals());
let signal_id_names = &names;
let properties_field_len = self.boilerplate.number_new_properties() + 1;
let properties = if properties_field_len > 1 {
......@@ -176,9 +176,9 @@ impl<'lt, 'ast: 'lt, Boilerplate: boilerplate::Boilerplate<'ast>>
return quote!{};
}
match self.boilerplate.fundamental_type() {
::glib::Type::BaseObject => ::gen::properties::properties_registration(properties),
::glib::Type::BaseObject => crate::gen::properties::properties_registration(properties),
::glib::Type::BaseInterface => {
::gen::properties::properties_interface_registration(properties.iter())
crate::gen::properties::properties_interface_registration(properties.iter())
}
::glib::Type::BaseParamSpec
| ::glib::Type::BaseFlags
......@@ -191,7 +191,7 @@ impl<'lt, 'ast: 'lt, Boilerplate: boilerplate::Boilerplate<'ast>>
}
fn gen_vtable_init_signals(&self) -> TokenStream {
let signal_declaration = ::gen::signals::signal_declarations(
let signal_declaration = crate::gen::signals::signal_declarations(
self.boilerplate.names(),
self.boilerplate.signals(),
);
......@@ -206,7 +206,7 @@ impl<'lt, 'ast: 'lt, Boilerplate: boilerplate::Boilerplate<'ast>>
fn gen_vtable_init_slots(&self) -> TokenStream {
let vtable = self.boilerplate.names().vtable();
let slot_assignments =
::gen::imp::slot_assignments(&self.boilerplate.names(), &self.boilerplate.slots());
crate::gen::imp::slot_assignments(&self.boilerplate.names(), &self.boilerplate.slots());
let slot_overrides = self.gen_vtable_slot_assignments();
quote! {
......
use proc_macro2::{Ident, TokenStream};
use gen::PropertyGenExt;
use hir::{Property, Ty};
use ident_ext::IdentExt;
use crate::gen::PropertyGenExt;
use crate::hir::{Property, Ty};
use crate::ident_ext::IdentExt;
use std::iter::Map;
......
use hir::{Property, Ty};
use ident_ext::IdentExt;
use crate::hir::{Property, Ty};
use crate::ident_ext::IdentExt;
use proc_macro2::TokenStream;
use syn::Lit;
......
......@@ -3,12 +3,12 @@ use proc_macro2::{Ident, TokenStream};
use std::char;
use syn::Path;
use glib_utils::*;
use hir::{FnArg, Signal, Ty};
use crate::glib_utils::*;
use crate::hir::{FnArg, Signal, Ty};
use super::super::ident_ext::IdentExt;
use super::cstringliteral::CStringLiteral;
use hir::names::Names;
use crate::hir::names::Names;
pub fn signal_emit_methods<'ast>(
signals: impl Iterator<Item = &'ast Signal<'ast>>,
......
use proc_macro2::{Span, TokenStream};
use quote::ToTokens;
use hir::{FnArg, FnSig, Ty};
use crate::hir::{FnArg, FnSig, Ty};
impl<'ast> FnSig<'ast> {
/// Generates `-> GlibTypeName` for the function's return value
......
......@@ -2,7 +2,7 @@ use proc_macro2::{Ident, TokenStream};
use quote::ToTokens;
use hir::{Slot, VirtualMethod};
use crate::hir::{Slot, VirtualMethod};
struct SlotDeclaration<'ast> {
InstanceNameFfi: &'ast Ident,
......
use difference::{Changeset, Difference};
use errors::{ErrorAppend, Errors, Result, ToError};
use hir::generatorattrs::{Generator, GeneratorAttributes};
use crate::errors::{ErrorAppend, Errors, Result, ToError};
use crate::hir::generatorattrs::{Generator, GeneratorAttributes};
use proc_macro2::{Span, TokenStream};
use quote::ToTokens;
use rustfmt;
......
#![allow(non_snake_case)]
use ast;
use crate::ast;
use proc_macro2::TokenStream;
use quote::ToTokens;
......
use ::errors::{Errors, ToError};
use crate::errors::{Errors, ToError};
use syn::spanned::Spanned;
use syn::{ImplItemType, Type};
......
......@@ -2,9 +2,9 @@ use super::associated_types::OptionTypeExt;
use super::ast;
use super::GeneratorAttributes;
use super::{Method, Property, Slot, VirtualMethod};
use ::errors::{ErrorAppend, Errors, Result, ToError};
use hir::names::{Names, ParentNames};
use hir::{Override, OverrideItem};
use crate::errors::{ErrorAppend, Errors, Result, ToError};
use crate::hir::names::{Names, ParentNames};
use crate::hir::{Override, OverrideItem};
use proc_macro2::Ident;
use std::collections::HashMap;
use std::rc::Rc;
......
use errors::{Error, Result, ToError, TrySet};
use crate::errors::{Error, Result, ToError, TrySet};
use proc_macro2::Span;
use syn::token::Comma;
use syn::{
......
use syn::{Ident, Path, Type};
use glib_utils::*;
use crate::glib_utils::*;
use super::super::ident_ext::IdentExt;
use std::iter::FromIterator;
......@@ -215,7 +215,7 @@ impl ParentNames {
ParentNames::GType(::glib::Type::BaseObject) => {
type_path! { @path glib::Object }
}
ParentNames::GType(gtype) => ::syn::parse2(::glib_utils::tokens_glib_type(&gtype))
ParentNames::GType(gtype) => ::syn::parse2(crate::glib_utils::tokens_glib_type(&gtype))
.expect("Valid conversion from gtype to type"),
}
}
......
use ast;
use crate::ast;
use crate::errors::*;
use gobject_sys::GParamFlags;
use proc_macro2::{Ident, TokenStream};
......
......@@ -18,7 +18,7 @@ extern crate glib;
extern crate glib_sys;
extern crate gobject_sys;
use errors::*;
use crate::errors::*;
mod ast;
mod checking;
......
......@@ -3,7 +3,7 @@ use proc_macro2::TokenStream;
use syn;
use syn::parse::{Parse, ParseStream, Result};
use ast;
use crate::ast;
pub mod keywords {
custom_keyword!(class);
......