| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // Composed tree version of |NodeTraversal::nextSkippingChildren()|. This | 75 // Composed tree version of |NodeTraversal::nextSkippingChildren()|. This |
| 76 // function is similar to |next()| but skips child nodes of a specified | 76 // function is similar to |next()| but skips child nodes of a specified |
| 77 // node. | 77 // node. |
| 78 static Node* nextSkippingChildren(const Node&); | 78 static Node* nextSkippingChildren(const Node&); |
| 79 static Node* nextSkippingChildren(const Node&, const Node* stayWithin); | 79 static Node* nextSkippingChildren(const Node&, const Node* stayWithin); |
| 80 | 80 |
| 81 // Composed tree version of |NodeTraversal::previousSkippingChildren()| | 81 // Composed tree version of |NodeTraversal::previousSkippingChildren()| |
| 82 // similar to |previous()| but skipping child nodes of the specified node. | 82 // similar to |previous()| but skipping child nodes of the specified node. |
| 83 static Node* previousSkippingChildren(const Node&); | 83 static Node* previousSkippingChildren(const Node&); |
| 84 | 84 |
| 85 // Like previous, but visits parents before their children. |
| 86 static Node* previousPostOrder(const Node&, const Node* stayWithin = nullptr
); |
| 87 |
| 85 // Composed tree version of |Node::isDescendantOf(other)|. This function | 88 // Composed tree version of |Node::isDescendantOf(other)|. This function |
| 86 // returns true if |other| contains |node|, otherwise returns | 89 // returns true if |other| contains |node|, otherwise returns |
| 87 // false. If |other| is |node|, this function returns false. | 90 // false. If |other| is |node|, this function returns false. |
| 88 static bool isDescendantOf(const Node& /*node*/, const Node& other); | 91 static bool isDescendantOf(const Node& /*node*/, const Node& other); |
| 89 | 92 |
| 90 static bool contains(const ContainerNode& container, const Node& node) | 93 static bool contains(const ContainerNode& container, const Node& node) |
| 91 { | 94 { |
| 92 assertPrecondition(container); | 95 assertPrecondition(container); |
| 93 assertPrecondition(node); | 96 assertPrecondition(node); |
| 94 return container == node || isDescendantOf(node, container); | 97 return container == node || isDescendantOf(node, container); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 306 } |
| 304 | 307 |
| 305 inline Node* ComposedTreeTraversal::traverseLastChild(const Node& node) | 308 inline Node* ComposedTreeTraversal::traverseLastChild(const Node& node) |
| 306 { | 309 { |
| 307 return traverseChild(node, TraversalDirectionBackward); | 310 return traverseChild(node, TraversalDirectionBackward); |
| 308 } | 311 } |
| 309 | 312 |
| 310 } // namespace | 313 } // namespace |
| 311 | 314 |
| 312 #endif | 315 #endif |
| OLD | NEW |