Coalesce the contents of blocks as well
This commit is contained in:
parent
dfbd4e2880
commit
180becbee4
3 changed files with 10 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
|||
#![crate_type = "dylib"]
|
||||
#![feature(plugin_registrar, quote)]
|
||||
#![feature(slice_patterns)]
|
||||
#![feature(collections, rustc_private)]
|
||||
#![feature(rustc_private)]
|
||||
|
||||
extern crate syntax;
|
||||
extern crate rustc;
|
||||
|
|
|
@ -136,10 +136,16 @@ impl<'cx, 'i> Parser<'cx, 'i> {
|
|||
self.element(sp, name.as_str());
|
||||
},
|
||||
// Block
|
||||
[TtDelimited(sp, ref d), ..] if d.delim == token::DelimToken::Brace => {
|
||||
[TtDelimited(_, ref d), ..] if d.delim == token::DelimToken::Brace => {
|
||||
self.shift(1);
|
||||
let stmts = self.block(sp, &d.tts);
|
||||
self.render.push_stmts(stmts);
|
||||
{
|
||||
// Parse the contents of the block, emitting the
|
||||
// result inline
|
||||
let mut i = &*d.tts;
|
||||
mem::swap(&mut self.input, &mut i);
|
||||
self.markups();
|
||||
mem::swap(&mut self.input, &mut i);
|
||||
}
|
||||
},
|
||||
// ???
|
||||
_ => {
|
||||
|
|
|
@ -70,12 +70,6 @@ impl<'cx> Renderer<'cx> {
|
|||
stmts
|
||||
}
|
||||
|
||||
/// Appends the list of statements to the output.
|
||||
pub fn push_stmts(&mut self, mut stmts: Vec<P<Stmt>>) {
|
||||
self.flush();
|
||||
self.stmts.append(&mut stmts);
|
||||
}
|
||||
|
||||
/// Pushes an statement, flushing the tail buffer in the process.
|
||||
fn push(&mut self, stmt: P<Stmt>) {
|
||||
self.flush();
|
||||
|
|
Loading…
Add table
Reference in a new issue