This repository has been archived by the owner on May 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for doc comments, inner attrs, AstBuilder::attr()
- Loading branch information
Showing
4 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
|
||
name = "aster" | ||
version = "0.2.0" | ||
version = "0.2.1" | ||
authors = ["Erick Tryzelaar <[email protected]>"] | ||
license = "MIT/Apache-2.0" | ||
description = "A libsyntax ast builder" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#![feature(rustc_private)] | ||
|
||
extern crate aster; | ||
extern crate syntax; | ||
|
||
use syntax::ast; | ||
use syntax::codemap::{DUMMY_SP, respan}; | ||
use syntax::ptr::P; | ||
|
||
use aster::AstBuilder; | ||
|
||
#[test] | ||
fn test_doc() { | ||
let builder = AstBuilder::new(); | ||
assert_eq!( | ||
builder.attr().doc("/// doc string"), | ||
respan( | ||
DUMMY_SP, | ||
ast::Attribute_ { | ||
id: ast::AttrId(0), | ||
style: ast::AttrOuter, | ||
value: P(respan( | ||
DUMMY_SP, | ||
ast::MetaNameValue( | ||
builder.interned_string("doc"), | ||
(*builder.lit().str("/// doc string")).clone(), | ||
), | ||
)), | ||
is_sugared_doc: true, | ||
} | ||
) | ||
); | ||
} |