2020-01-17 16:23:21 -05:00
|
|
|
use std::vec::IntoIter;
|
|
|
|
|
2020-04-20 03:45:28 -04:00
|
|
|
use peekmore::{PeekMore, PeekMoreIterator};
|
|
|
|
|
2020-06-16 19:38:30 -04:00
|
|
|
use crate::args::FuncArgs;
|
2020-03-17 20:13:53 -04:00
|
|
|
use crate::scope::Scope;
|
2020-06-16 19:38:30 -04:00
|
|
|
use crate::Token;
|
2020-01-12 20:15:40 -05:00
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
2020-01-20 13:15:47 -05:00
|
|
|
pub(crate) struct Mixin {
|
2020-06-16 19:38:30 -04:00
|
|
|
pub scope: Scope,
|
|
|
|
pub args: FuncArgs,
|
|
|
|
pub body: PeekMoreIterator<IntoIter<Token>>,
|
|
|
|
pub accepts_content_block: bool,
|
2020-01-12 20:15:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Mixin {
|
2020-06-16 19:38:30 -04:00
|
|
|
pub fn new(
|
|
|
|
scope: Scope,
|
|
|
|
args: FuncArgs,
|
|
|
|
body: Vec<Token>,
|
|
|
|
accepts_content_block: bool,
|
|
|
|
) -> Self {
|
2020-04-20 03:45:28 -04:00
|
|
|
let body = body.into_iter().peekmore();
|
2020-06-16 19:38:30 -04:00
|
|
|
Mixin {
|
|
|
|
scope,
|
|
|
|
args,
|
|
|
|
body,
|
|
|
|
accepts_content_block,
|
2020-01-12 20:15:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|