mixin stores body as Vec<Token>

This commit is contained in:
Connor Skees 2020-06-30 06:53:17 -04:00
parent f476f4af25
commit 6ea036581b
2 changed files with 4 additions and 7 deletions

View File

@ -1,14 +1,10 @@
use std::vec::IntoIter;
use peekmore::{PeekMore, PeekMoreIterator};
use crate::{args::FuncArgs, scope::Scope, Token}; use crate::{args::FuncArgs, scope::Scope, Token};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub(crate) struct Mixin { pub(crate) struct Mixin {
pub scope: Scope, pub scope: Scope,
pub args: FuncArgs, pub args: FuncArgs,
pub body: PeekMoreIterator<IntoIter<Token>>, pub body: Vec<Token>,
pub accepts_content_block: bool, pub accepts_content_block: bool,
} }
@ -19,7 +15,6 @@ impl Mixin {
body: Vec<Token>, body: Vec<Token>,
accepts_content_block: bool, accepts_content_block: bool,
) -> Self { ) -> Self {
let body = body.into_iter().peekmore();
Mixin { Mixin {
scope, scope,
args, args,

View File

@ -2,6 +2,8 @@ use std::mem;
use codemap::Spanned; use codemap::Spanned;
use peekmore::PeekMore;
use crate::{ use crate::{
args::{CallArgs, FuncArgs}, args::{CallArgs, FuncArgs},
atrule::Mixin, atrule::Mixin,
@ -97,7 +99,7 @@ impl<'a> Parser<'a> {
self.eval_mixin_args(&mut mixin, args)?; self.eval_mixin_args(&mut mixin, args)?;
let body = Parser { let body = Parser {
toks: &mut mixin.body, toks: &mut mixin.body.into_iter().peekmore(),
map: self.map, map: self.map,
path: self.path, path: self.path,
scopes: &mut NeverEmptyVec::new(mixin.scope), scopes: &mut NeverEmptyVec::new(mixin.scope),