Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan committed Jul 28, 2017
1 parent d03f45f commit a5681f9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions parcel/src/es6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,21 @@ pub enum Export<'s> {
Named(Vec<ExportSpec<'s>>),
NamedFrom(Vec<ExportSpec<'s>>, Cow<'s, str>),
}

#[derive(Debug)]
pub struct ExportSpec<'s> {
bind: &'s str,
name: &'s str,
}

impl<'s> ExportSpec<'s> {
pub fn new(bind: &'s str, name: &'s str) -> Self {
ExportSpec {
name,
bind,
}
}

pub fn same(name: &'s str) -> Self {
ExportSpec::new(name, name)
}
Expand All @@ -46,6 +49,7 @@ pub struct Import<'s> {
default_bind: Option<&'s str>,
binds: Bindings<'s>,
}

impl<'s> Import<'s> {
pub fn new(module_source: &'s str, module: Cow<'s, str>) -> Self {
Import {
Expand All @@ -63,11 +67,13 @@ pub enum Bindings<'s> {
NameSpace(&'s str),
Named(Vec<ImportSpec<'s>>),
}

#[derive(Debug)]
pub struct ImportSpec<'s> {
name: &'s str,
bind: &'s str,
}

impl<'s> ImportSpec<'s> {
pub fn new(name: &'s str, bind: &'s str) -> Self {
ImportSpec {
Expand All @@ -87,12 +93,15 @@ pub struct CjsModule<'s> {
pub source_suffix: String,
pub deps: HashSet<Cow<'s, str>>,
}

pub type Result<T> = ::std::result::Result<T, Error>;

#[derive(Debug)]
pub struct Error {
kind: ErrorKind,
span: esparse::ast::SpanT<String>,
}

#[derive(Debug)]
pub enum ErrorKind {
Expected(&'static str),
Expand Down

0 comments on commit a5681f9

Please sign in to comment.