提交 a2467b94 编写于 作者: D Dzmitry Malyshau

Fixed lifetimes on syntax deriving structs, implemented Clone

上级 e0a6e2b4
......@@ -24,6 +24,7 @@
use std::gc::Gc;
/// The types of pointers
#[deriving(Clone)]
pub enum PtrTy<'a> {
/// &'lifetime mut
Borrowed(Option<&'a str>, ast::Mutability),
......@@ -31,6 +32,7 @@ pub enum PtrTy<'a> {
/// A path, e.g. `::std::option::Option::<int>` (global). Has support
/// for type parameters and a lifetime.
#[deriving(Clone)]
pub struct Path<'a> {
pub path: Vec<&'a str> ,
pub lifetime: Option<&'a str>,
......@@ -81,6 +83,7 @@ pub fn to_path(&self,
}
/// A type. Supports pointers (except for *), Self, and literals
#[deriving(Clone)]
pub enum Ty<'a> {
Self,
/// &/Box/ Ty
......@@ -107,7 +110,7 @@ pub fn borrowed_self<'r>() -> Ty<'r> {
borrowed(box Self)
}
pub fn nil_ty() -> Ty<'static> {
pub fn nil_ty<'r>() -> Ty<'r> {
Tuple(Vec::new())
}
......@@ -205,13 +208,14 @@ fn mk_generics(lifetimes: Vec<ast::Lifetime>, ty_params: Vec<ast::TyParam> ) ->
}
/// Lifetimes and bounds on type parameters
#[deriving(Clone)]
pub struct LifetimeBounds<'a> {
pub lifetimes: Vec<&'a str>,
pub bounds: Vec<(&'a str, Option<ast::TyParamBound>, Vec<Path<'a>>)>,
}
impl<'a> LifetimeBounds<'a> {
pub fn empty() -> LifetimeBounds<'static> {
pub fn empty() -> LifetimeBounds<'a> {
LifetimeBounds {
lifetimes: Vec::new(), bounds: Vec::new()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册