Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug-only dynamic checks for layout and GC use of DOMRefCell #3797

Merged
merged 6 commits into from Oct 25, 2014

task_state: Generate the list of task types

Also fix warnings.
  • Loading branch information
kmcallister committed Oct 24, 2014
commit 4dee8ecdf09af1d3e2650b22e3bac02cc3107900
@@ -27,29 +27,29 @@ bitflags! {
}
}

// Exactly one of these should be set.
static task_types: &'static [TaskState]
= &[Script, Layout, Render];

macro_rules! predicates ( ( $( $f:ident = $c:ident ; )* ) => (
macro_rules! task_types ( ( $( $fun:ident = $flag:ident ; )* ) => (
impl TaskState {
$(
pub fn $f(self) -> bool {
self.contains($c)
pub fn $fun(self) -> bool {
self.contains($flag)
}
)*
}

#[cfg(not(ndebug))]
static TYPES: &'static [TaskState]
= &[ $( $flag ),* ];
))

predicates! {
task_types! {
is_script = Script;
is_layout = Layout;
is_render = Render;
}

#[cfg(not(ndebug))]
mod imp {
use super::{TaskState, task_types};
use super::{TaskState, TYPES};

local_data_key!(STATE: TaskState)

@@ -68,7 +68,7 @@ mod imp {
};

// Exactly one of the task type flags should be set.
assert_eq!(1, task_types.iter().filter(|&&ty| state.contains(ty)).count());
assert_eq!(1, TYPES.iter().filter(|&&ty| state.contains(ty)).count());
state
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.