зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1683295 - Make next_in_preorder generate slightly better code. r=heycam
This avoids the panic code in release builds. Differential Revision: https://phabricator.services.mozilla.com/D100094
This commit is contained in:
Родитель
30f7439a31
Коммит
2c49116410
|
@ -188,22 +188,18 @@ pub trait TNode: Sized + Copy + Clone + Debug + NodeInfo + PartialEq {
|
|||
return Some(c);
|
||||
}
|
||||
|
||||
if Some(*self) == scoped_to {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut current = *self;
|
||||
let mut current = Some(*self);
|
||||
loop {
|
||||
if let Some(s) = current.next_sibling() {
|
||||
return Some(s);
|
||||
}
|
||||
|
||||
let parent = current.parent_node();
|
||||
if parent == scoped_to {
|
||||
if current == scoped_to {
|
||||
return None;
|
||||
}
|
||||
|
||||
current = parent.expect("Not a descendant of the scope?");
|
||||
debug_assert!(current.is_some(), "not a descendant of the scope?");
|
||||
if let Some(s) = current?.next_sibling() {
|
||||
return Some(s);
|
||||
}
|
||||
|
||||
current = current?.parent_node();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче