From 6ffa80bd87e320e55af64cba412b81201df5b0c7 Mon Sep 17 00:00:00 2001 From: Hoda Amer Date: Thu, 10 Jun 2004 14:36:45 +0000 Subject: [PATCH] Bug Fixing --- core/org.eclipse.cdt.core/ChangeLog | 3 +++ .../core/parser/StructuralParseCallback.java | 3 +++ .../core/parser/ast/complete/ASTClassSpecifier.java | 10 ++++++++-- .../core/parser/ast/complete/ASTCodeScope.java | 11 +++++++++-- .../core/parser/ast/complete/ASTCompilationUnit.java | 8 ++++++-- .../core/parser/ast/complete/ASTFunction.java | 12 ++++++++++-- .../parser/ast/complete/ASTNamespaceDefinition.java | 9 +++++++-- .../internal/core/parser/ast/complete/ASTScope.java | 3 +++ 8 files changed, 49 insertions(+), 10 deletions(-) diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index ed06bfdca67..b60b3de45e9 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -1,3 +1,6 @@ +2004-06-10 Hoda Amer + Fix for PR 65970: [Outline View] Contents of Includes displayed in Outline for STRUCTURAL_PARSE mode + 2004-06-09 Alain Magloire Patch from Sam Rob to resolve 64022 diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java index de08142b989..89ed99cd9fc 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/StructuralParseCallback.java @@ -57,6 +57,9 @@ public class StructuralParseCallback extends QuickParseCallback{ private void enterScope(IASTNode node){ if(node instanceof IASTScope){ + if(node instanceof ASTScope){ + ((ASTScope)node).initDeclarations(); + } pushScope((IASTScope)node); } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java index 5a205f78bbb..6d3792049c4 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java @@ -37,7 +37,7 @@ import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol.IParen */ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier { - private List declarations = new ArrayList(); + private List declarations = null; public class BaseIterator implements Iterator { @@ -271,7 +271,7 @@ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier //If a callback (ie StructuralParseCallback) populates the declarations list //then return that iterator, otherwise use the ASTScope implementation which //gets one from the symbol table. - if( !declarations.isEmpty() ){ + if( declarations != null ){ return declarations.iterator(); } return super.getDeclarations(); @@ -281,6 +281,12 @@ public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier { declarations.add(declaration); } + + public void initDeclarations() + { + declarations = new ArrayList(0); + } + /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java index be03cecbb2c..ccd4de59af6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java @@ -23,7 +23,7 @@ import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol; */ public class ASTCodeScope extends ASTScope implements IASTCodeScope { - private List declarations = new ArrayList(); + private List declarations = null; private final IASTCodeScope ownerCodeScope; /** @@ -80,13 +80,20 @@ public class ASTCodeScope extends ASTScope implements IASTCodeScope { public Iterator getDeclarations() { - return declarations.iterator(); + if(declarations != null) + return declarations.iterator(); + else + return super.getDeclarations(); } public void addDeclaration(IASTDeclaration declaration) { declarations.add(declaration); } + public void initDeclarations() + { + declarations = new ArrayList(0); + } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getContainingFunction() diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java index 9a5be66ee6e..07d03cd21bf 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java @@ -28,7 +28,7 @@ public class ASTCompilationUnit extends ASTScope implements IASTCompilationUnit { - private List declarations = new ArrayList(); + private List declarations = null; /** * @param symbol */ @@ -77,7 +77,7 @@ public class ASTCompilationUnit //If a callback (ie StructuralParseCallback) populates the declarations list //then return that iterator, otherwise use the ASTScope implementation which //gets one from the symbol table. - if( !declarations.isEmpty() ) + if( declarations != null ) return declarations.iterator(); return super.getDeclarations(); @@ -87,4 +87,8 @@ public class ASTCompilationUnit { declarations.add(declaration); } + public void initDeclarations() + { + declarations = new ArrayList(0); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java index 28e596819e9..c2eca1e0b79 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java @@ -45,7 +45,7 @@ public class ASTFunction extends ASTScope implements IASTFunction private final ASTQualifiedNamedElement qualifiedName; private final List parameters; protected List references; - private List declarations = new ArrayList(); + private List declarations = null; /** * @param symbol * @param parameters @@ -328,12 +328,20 @@ public class ASTFunction extends ASTScope implements IASTFunction public Iterator getDeclarations() { - return declarations.iterator(); + if(declarations != null) + return declarations.iterator(); + else + return super.getDeclarations(); } + public void addDeclaration(IASTDeclaration declaration) { declarations.add(declaration); } + public void initDeclarations() + { + declarations = new ArrayList(0); + } /* (non-Javadoc) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java index b5c290c0763..8448c31f1b6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java @@ -33,7 +33,7 @@ public class ASTNamespaceDefinition private NamedOffsets offsets = new NamedOffsets(); private final ASTQualifiedNamedElement qualifiedName; - private List declarations = new ArrayList(); + private List declarations = null; /** * @param namespaceSymbol @@ -171,7 +171,7 @@ public class ASTNamespaceDefinition //If a callback (ie StructuralParseCallback) populates the declarations list //then return that iterator, otherwise use the ASTScope implementation which //gets one from the symbol table. - if( !declarations.isEmpty() ) + if( declarations != null ) return declarations.iterator(); return super.getDeclarations(); @@ -181,6 +181,11 @@ public class ASTNamespaceDefinition declarations.add(declaration); } + public void initDeclarations() + { + declarations = new ArrayList(0); + } + /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingLine() */ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java index 845fee4f63e..9132b6ea994 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java @@ -52,4 +52,7 @@ public abstract class ASTScope extends ASTSymbol implements IASTScope { } + public void initDeclarations() + { + } }