mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Minor performance optimization.
This commit is contained in:
parent
d199768e64
commit
ede42e1820
1 changed files with 5 additions and 1 deletions
|
@ -242,7 +242,11 @@ public abstract class ASTNode implements IASTNode {
|
|||
|
||||
@Override
|
||||
public IASTTranslationUnit getTranslationUnit() {
|
||||
return parent != null ? parent.getTranslationUnit() : null;
|
||||
IASTNode node = this;
|
||||
for (IASTNode p = parent; p != null; p = p.getParent()) {
|
||||
node = p;
|
||||
}
|
||||
return node instanceof IASTTranslationUnit ? (IASTTranslationUnit) node : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue