chores: cleanup for docs; no email from travis

This commit is contained in:
강동윤 2018-01-27 15:14:53 +09:00
parent d4e2c90caf
commit 056a11dd06
14 changed files with 41 additions and 177 deletions

View File

@ -3,9 +3,4 @@
rustflags = ["--cfg", "procmacro2_semver_exempt"]
rustdocflags = [
"--cfg", "procmacro2_semver_exempt",
"--no-defaults",
"--passes", "collapse-docs",
"--passes", "unindent-comments",
# "--document-private-items",
"--passes", "strip-priv-imports"
]

View File

@ -32,8 +32,7 @@ after_success:
[ "$TRAVIS_BRANCH" == "master" ] &&
./.travis/docs.sh'
notifications:
email:
on_success: never
email: never
env:
global:
- RUST_MIN_STACK=4194304

View File

@ -5,10 +5,17 @@ name = "swc"
version = "0.1.0"
authors = ["강동윤 <kdy1@outlook.kr>"]
[dependencies]
libswc = { path = "./swc" }
swc_common = { path = "./common" }
[[bin]]
name = "swc"
[lib]
name = "swc"
[dependencies]
swc_atoms = { path = "./atoms" }
swc_common = { path = "./common" }
swc_ecmascript = { path = "./ecmascript" }
swc_macros = { path = "./macros" }
rayon = "0.9"
slog = "2"
slog-envlogger = "2.1"
@ -16,7 +23,7 @@ slog-term = "2.3"
[dependencies.clap]
version = "2.29"
version = "2.29.1"
default-features = false
features = [ "suggestions", "color" ]

View File

@ -10,8 +10,3 @@ string_cache = "0.6"
either = "1.4"
rustc-ap-rustc_errors = "16"
rustc-ap-syntax_pos = "16"
[dependencies.syntect]
version = "2"
default-features = false

View File

@ -27,8 +27,8 @@ impl Handler {
RustcHandler::with_tty_emitter_and_flags(color_config, cm, flags).into()
}
pub fn note<'a, 'b>(&'a self, sp: Span, msg: &'b str) -> Diagnostic<'a> {
Diagnostic::new(self, Level::Note, msg).span(sp)
pub fn note<'a, 'b>(&'a self, msg: &'b str) -> Diagnostic<'a> {
Diagnostic::new(self, Level::Note, msg)
}
pub fn warn<'a, 'b>(&'a self, msg: &'b str) -> Diagnostic<'a> {

View File

@ -2,10 +2,8 @@
//!
//! -----
//!
//! This module is almost copied from [rustc_errors][].
//! This module use [`::rustc_errors`][] internally.
//!
//!
//![rustc_errors]:http://manishearth.github.io/rust-internals-docs/rustc_errors/
pub use self::codemap::{CodeMap, FileLoader, FilePathMapping, RealFileLoader};
pub use self::diagnostic::*;

View File

@ -13,12 +13,12 @@ impl FileLoader for MyFileLoader {
}
/// Return an absolute path to a file, if possible.
fn abs_path(&self, path: &Path) -> Option<PathBuf> {
fn abs_path(&self, _path: &Path) -> Option<PathBuf> {
Some("/tmp.js".into())
}
/// Read the contents of an UTF-8 file into memory.
fn read_file(&self, path: &Path) -> io::Result<String> {
fn read_file(&self, _path: &Path) -> io::Result<String> {
Ok("
function foo() {
with (window) {

View File

@ -15,7 +15,7 @@ pub trait Folder<T> {
///
///#Derive
///
/// This trait can be derived with `#[derive(AstNode)]`.
/// This trait can be derived with `#[derive(Fold)]`.
///
/// Note that derive ignores all fields with primitive type
/// because it would encourage mistakes. Use new type instead.

View File

@ -1,15 +1,24 @@
//! This module is almost copied from [rustc_errors][].
//!
//! Modified a bit because, unlike rustc, we
//!
//! - work with lot of files (node_modules).
//! - need source information in every run (I think?)
//!
//!
//!-----
//!
//![rustc_errors]:TODO
pub use self::span::*;
pub use syntax_pos::{FileMap, FileName, MultiSpan};
use fold::FoldWith;
pub use syntax_pos::{hygiene, BytePos, ExpnFormat, ExpnInfo, FileMap, FileName, MultiSpan,
NameAndSpan, Span, SpanData, SyntaxContext, DUMMY_SP, NO_EXPANSION};
mod span;
pub trait Spanned<T>: Sized {
/// Creates `Self` from `node` and `span.
fn from_unspanned(node: T, span: Span) -> Self;
}
impl<S, T> Spanned<T> for Box<S>
where
S: Spanned<T>,
{
fn from_unspanned(node: T, span: Span) -> Self {
box S::from_unspanned(node, span)
}
}
impl<F> FoldWith<F> for Span {
/// No op as span does not have any child.
fn fold_children(self, _: &mut F) -> Span {
self
}
}

View File

@ -1,123 +0,0 @@
// use super::FileMap;
// use errors::Msg;
use fold::FoldWith;
// use std::fmt::{self, Debug, Display, Formatter};
// use std::ops::{Add, Sub};
// use std::rc::Rc;
pub use syntax_pos::{BytePos, Span, SpanData, DUMMY_SP};
// /// A new-type struct for position of specific byte.
// ///
// /// See [Span](./struct.Span.html).
// #[derive(Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
// pub struct BytePos(pub u32);
// impl Display for BytePos {
// fn fmt(&self, f: &mut Formatter) -> fmt::Result {
// Display::fmt(&self.0, f)
// }
// }
// impl BytePos {
// pub(crate) fn to_usize(self) -> usize {
// self.0 as usize
// }
// pub(crate) fn from_usize(u: usize) -> Self {
// BytePos(u as _)
// }
// }
// impl Debug for BytePos {
// fn fmt(&self, f: &mut Formatter) -> fmt::Result {
// Debug::fmt(&self.0, f)
// }
// }
// impl Add for BytePos {
// type Output = BytePos;
// fn add(self, rhs: BytePos) -> BytePos {
// BytePos(self.0 + rhs.0)
// }
// }
// impl Sub for BytePos {
// type Output = BytePos;
// fn sub(self, rhs: BytePos) -> BytePos {
// BytePos(self.0 - rhs.0)
// }
// }
// /// Byte range of a token or node.
// #[derive(Clone, Copy, PartialEq, Eq, Hash)]
// pub struct Span {
// /// Inclusive
// pub start: BytePos,
// /// Inclusive
// pub end: BytePos,
// }
// impl Debug for Span {
// fn fmt(&self, f: &mut Formatter) -> fmt::Result {
// if self.start == BytePos(0) && self.end == BytePos(0) {
// write!(f, "_")
// } else {
// write!(f, "{}..{}", self.start, self.end.0 + 1)
// }
// }
// }
// impl Span {
// pub fn new(start: BytePos, end: BytePos) -> Self {
// Span { start, end }
// }
// /// temporary method
// pub(crate) fn ctxt(self) -> usize {
// 0
// }
// /// temporary method
// pub(crate) fn lo(self) -> BytePos {
// self.start
// }
// /// temporary method
// pub(crate) fn hi(self) -> BytePos {
// self.end
// }
// /// temporary method
// pub(crate) fn with_hi(self, hi: BytePos) -> Span {
// Span {
// start: self.start,
// end: hi,
// }
// }
// /// Dummy span. This is same as `Span::defult()`.
// pub const DUMMY: Span = Span {
// start: BytePos(0),
// end: BytePos(0),
// };
// }
// impl Default for Span {
// #[inline]
// fn default() -> Self {
// Span::DUMMY
// }
// }
pub trait Spanned<T>: Sized {
/// Creates `Self` from `node` and `span.
fn from_unspanned(node: T, span: Span) -> Self;
}
impl<S, T> Spanned<T> for Box<S>
where
S: Spanned<T>,
{
fn from_unspanned(node: T, span: Span) -> Self {
box S::from_unspanned(node, span)
}
}
impl<F> FoldWith<F> for Span {
/// No op as span does not have any child.
fn fold_children(self, _: &mut F) -> Span {
self
}
}

View File

@ -1,4 +1,3 @@
//! Note: this module requires `#![feature(nll)]`.
use Context;
use lexer::{Input, Lexer};
use swc_common::{BytePos, Span, DUMMY_SP};

View File

@ -1,15 +0,0 @@
[package]
name = "libswc"
version = "0.1.0"
authors = ["강동윤 <kdy1@outlook.kr>"]
[lib]
name = "swc"
[dependencies]
swc_atoms = { path = "../atoms" }
swc_ecmascript = { path = "../ecmascript" }
swc_common = { path = "../common" }
swc_macros = { path = "../macros" }
rayon = "0.9"
slog = "2"