Bug 1267551 - Use MOZ_MUST_USE in js/public/UbiNodePostOrder.h; r=jimb

This commit is contained in:
Nick Fitzgerald 2016-06-17 13:52:44 +01:00
Родитель 3a2a30627d
Коммит 5545da0648
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -7,6 +7,7 @@
#ifndef js_UbiNodePostOrder_h
#define js_UbiNodePostOrder_h
#include "mozilla/Attributes.h"
#include "mozilla/Maybe.h"
#include "mozilla/Move.h"
@ -90,7 +91,7 @@ struct PostOrder {
#endif
private:
bool fillEdgesFromRange(EdgeVector& edges, js::UniquePtr<EdgeRange>& range) {
MOZ_MUST_USE bool fillEdgesFromRange(EdgeVector& edges, js::UniquePtr<EdgeRange>& range) {
MOZ_ASSERT(range);
for ( ; !range->empty(); range->popFront()) {
if (!edges.append(mozilla::Move(range->front())))
@ -99,7 +100,7 @@ struct PostOrder {
return true;
}
bool pushForTraversing(const Node& node) {
MOZ_MUST_USE bool pushForTraversing(const Node& node) {
EdgeVector edges;
auto range = node.edges(rt, /* wantNames */ false);
return range &&
@ -124,11 +125,11 @@ struct PostOrder {
{ }
// Initialize this traversal object. Return false on OOM.
bool init() { return seen.init(); }
MOZ_MUST_USE bool init() { return seen.init(); }
// Add `node` as a starting point for the traversal. You may add
// as many starting points as you like. Returns false on OOM.
bool addStart(const Node& node) {
MOZ_MUST_USE bool addStart(const Node& node) {
if (!seen.put(node))
return false;
return pushForTraversing(node);
@ -144,7 +145,7 @@ struct PostOrder {
// Return false on OOM or error return from `onNode::operator()` or
// `onEdge::operator()`.
template<typename NodeVisitor, typename EdgeVisitor>
bool traverse(NodeVisitor onNode, EdgeVisitor onEdge) {
MOZ_MUST_USE bool traverse(NodeVisitor onNode, EdgeVisitor onEdge) {
#ifdef DEBUG
MOZ_ASSERT(!traversed, "Can only traverse() once!");
traversed = true;