[hg] main-silver: Additional fi

  • From: Petr Kudryavtsev < >
  • To: , , ,
  • Subject: [hg] main-silver: Additional fi
  • Date: Wed, 03 Jul 2013 09:52:25 -0700

changeset 1d84697101c0 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/1d84697101c0
description:
        Additional fi

diffstat:

 
cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CompletionResolverImpl.java
                               |   4 +
 
cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CsmContextUtilities.java
                                  |   5 +
 cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/TemplateUtils.java  
                                        |  11 ++-
 
cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/core/AstRenderer.java
                                       |  28 +++++-----
 
cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/c_namespaces.c.dat
  |   2 +
 
cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/iz165038.cc.dat
     |   1 +
 
cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/iz199899.c.dat
      |   2 +
 
cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModelTest/templateParams.h.dat
 |   6 ++
 8 files changed, 41 insertions(+), 18 deletions(-)

diffs (192 lines):

diff --git 
a/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CompletionResolverImpl.java
 
b/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CompletionResolverImpl.java
--- 
a/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CompletionResolverImpl.java
+++ 
b/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CompletionResolverImpl.java
@@ -744,6 +744,10 @@
             hideTypes &= ~RESOLVE_CLASS_METHODS;
             hideTypes &= ~RESOLVE_CLASS_ENUMERATORS;
         }
+        if (CsmContextUtilities.isInForwardDeclaration(context, offset)) {
+            hideTypes &= ~RESOLVE_CLASS_FIELDS;
+            hideTypes &= ~RESOLVE_CLASS_METHODS;            
+        }
         return hideTypes;
     }
 
diff --git 
a/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CsmContextUtilities.java
 
b/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CsmContextUtilities.java
--- 
a/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CsmContextUtilities.java
+++ 
b/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CsmContextUtilities.java
@@ -680,6 +680,11 @@
                 CsmOffsetUtilities.isInObject(type, offset);
     }
     
+    public static boolean isInForwardDeclaration(CsmContext context, int 
offset) {
+        CsmObject last = context.getLastObject();
+        return CsmKindUtilities.isClassForwardDeclaration(last);
+    }
+    
     public static boolean isInType(CsmContext context, int offset) {
         CsmType type = extractLastType(context, offset);
         return (type != null) && CsmOffsetUtilities.isInObject(type, offset);
diff --git 
a/cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/TemplateUtils.java 
b/cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/TemplateUtils.java
--- 
a/cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/TemplateUtils.java
+++ 
b/cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/TemplateUtils.java
@@ -242,19 +242,22 @@
                                     parameterStart = null;
                                     break;
                                 } else if (type.getType() == 
CPPTokenTypes.LITERAL_struct
-                                        || type.getType() == 
CPPTokenTypes.LITERAL_class) {      
+                                        || type.getType() == 
CPPTokenTypes.LITERAL_class
+                                        || type.getType() == 
CPPTokenTypes.LITERAL_union) {      
                                     // This is for types like DDD in the 
next code:
                                     //  template<typename TAG = struct DDD>
                                     //  struct copy {};                      
            
                                     
                                     MutableObject<CsmNamespace> targetScope 
= new MutableObject<CsmNamespace>();
-                                    MutableObject<CsmNamespaceDefinition> 
targetNamespaceDefinition = new MutableObject<CsmNamespaceDefinition>();
-                                    getClosestNamespaceInfo(scope, file, 
OffsetableBase.getStartOffset(ast), targetScope, targetNamespaceDefinition);
+                                    
MutableObject<MutableDeclarationsContainer> targetDefinitionContainer = new 
MutableObject<MutableDeclarationsContainer>();
+                                    
+                                    // TODO: need fileContent here
+                                    getClosestNamespaceInfo(scope, file, 
null, OffsetableBase.getStartOffset(ast), targetScope, 
targetDefinitionContainer); 
                                     
                                     FakeAST fakeParent = new FakeAST();
                                     
fakeParent.setType(CPPTokenTypes.CSM_GENERIC_DECLARATION);
                                     fakeParent.addChild(type);               
                     
-                                    
ClassForwardDeclarationImpl.create(fakeParent, file, targetScope.value, 
(MutableDeclarationsContainer) targetNamespaceDefinition.value, global);
+                                    
ClassForwardDeclarationImpl.create(fakeParent, file, targetScope.value, 
targetDefinitionContainer.value, global);
                                 }
                             }
                         }
diff --git 
a/cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/core/AstRenderer.java
 
b/cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/core/AstRenderer.java
--- 
a/cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/core/AstRenderer.java
+++ 
b/cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/csm/core/AstRenderer.java
@@ -1401,12 +1401,12 @@
                     if (scope != null) {
                         // Find first namespace scope to add elaborated 
forwards in it
                         MutableObject<CsmNamespace> targetScope = new 
MutableObject<CsmNamespace>();
-                        MutableObject<CsmNamespaceDefinition> 
targetNamespaceDefinition = new MutableObject<CsmNamespaceDefinition>();
-                        getClosestNamespaceInfo(scope, file, 
OffsetableBase.getStartOffset(tokenTypeStart), targetScope, 
targetNamespaceDefinition);
+                        MutableObject<MutableDeclarationsContainer> 
targetDefinitionContainer = new MutableObject<MutableDeclarationsContainer>();
+                        getClosestNamespaceInfo(scope, file, fileContent, 
OffsetableBase.getStartOffset(tokenTypeStart), targetScope, 
targetDefinitionContainer);
                                                 
                         FakeAST fakeParent = new FakeAST();
                         fakeParent.addChild(tokenTypeStart);
-                        ClassForwardDeclarationImpl.create(fakeParent, file, 
targetScope.value, (MutableDeclarationsContainer) 
targetNamespaceDefinition.value, global);
+                        ClassForwardDeclarationImpl.create(fakeParent, file, 
targetScope.value, targetDefinitionContainer.value, global);
                     }
                     
                     return TypeFactory.createType(typeAST, file, 
ptrOperator, 0);
@@ -1713,10 +1713,10 @@
                 }
                 if (createForwardClass) {
                     MutableObject<CsmNamespace> targetScope = new 
MutableObject<CsmNamespace>();
-                    MutableObject<CsmNamespaceDefinition> 
targetNamespaceDefinition = new MutableObject<CsmNamespaceDefinition>();
-                    getClosestNamespaceInfo(scope, file, 
OffsetableBase.getStartOffset(ast), targetScope, targetNamespaceDefinition);  
                  
+                    MutableObject<MutableDeclarationsContainer> 
targetDefinitionContainer = new MutableObject<MutableDeclarationsContainer>();
+                    getClosestNamespaceInfo(scope, file, fileContent, 
OffsetableBase.getStartOffset(ast), targetScope, targetDefinitionContainer);  
                  
                     
-                    ClassForwardDeclarationImpl.create(ast, file, 
targetScope.value, (MutableDeclarationsContainer) 
targetNamespaceDefinition.value, !isRenderingLocalContext());
+                    ClassForwardDeclarationImpl.create(ast, file, 
targetScope.value, (MutableDeclarationsContainer) 
targetDefinitionContainer.value, !isRenderingLocalContext());
                 }
                 return true;
             }
@@ -2273,24 +2273,24 @@
 //        
 //    }      
     
-    public static boolean getClosestNamespaceInfo(CsmScope scope, CsmFile 
file, int offset, 
+    public static boolean getClosestNamespaceInfo(CsmScope scope, CsmFile 
file, FileContent fileContent, int offset, 
                                                   
MutableObject<CsmNamespace> closestNamespace, 
-                                                  
MutableObject<CsmNamespaceDefinition> closestNamespaceDefinition) 
+                                                  
MutableObject<MutableDeclarationsContainer> closestDefinitionContainer) 
     {
         // Find first namespace scope to add elaborated forwards in it
         NamespaceImpl targetScope = findClosestNamespace(scope);  
 
         closestNamespace.value = null;
-        closestNamespaceDefinition.value = null;
+        closestDefinitionContainer.value = null;
         
         if (targetScope != null) {
-            CsmNamespaceDefinition targetNamespaceDefinition; 
+            MutableDeclarationsContainer targetDefinitionContainer; 
             
             if (targetScope.isGlobal()) {
-                targetNamespaceDefinition = null;
-                targetScope = null;
+                targetDefinitionContainer = fileContent;
+//                targetDefinitionContainer = null;
             } else {                                
-                targetNamespaceDefinition = getContainingNamespaceDefinition(
+                targetDefinitionContainer = (MutableDeclarationsContainer) 
getContainingNamespaceDefinition(
                         targetScope.getDefinitions(),
                         file,
                         offset
@@ -2298,7 +2298,7 @@
             }
             
             closestNamespace.value = targetScope;
-            closestNamespaceDefinition.value = targetNamespaceDefinition;
+            closestDefinitionContainer.value = targetDefinitionContainer;
             
             return true;
         }
diff --git 
a/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/c_namespaces.c.dat
 
b/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/c_namespaces.c.dat
--- 
a/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/c_namespaces.c.dat
+++ 
b/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/c_namespaces.c.dat
@@ -12,6 +12,7 @@
 Macros:
     <no macros>
 VARIABLE cnst1 [1:1/0-1:23/22]  TYPE: s_aaabbb TEXT=s_aaabbb  
[1:8/7-1:16/15]  INIT: null  SCOPE: $Global$ 
+CLASS_FORWARD_DECLARATION s_aaabbb [1:1/0-1:16/15]
 STRUCT s_leaf_value (s_leaf_value ) [3:1/25-7:2/97] lcurly=45 SCOPE: 
$Global$ 
     BASE CLASSES:
     MEMBERS:
@@ -20,6 +21,7 @@
             MEMBERS:
                 FIELD PUBLIC AAA [5:9/80-5:17/88]  TYPE: int TEXT=int  
[5:9/80-5:12/83]  INIT: null  SCOPE: s_aaabbb 
 VARIABLE cnst2 [9:1/100-9:23/122]  TYPE: u_aaabbb TEXT=u_aaabbb  
[9:8/107-9:16/115]  INIT: null  SCOPE: $Global$ 
+CLASS_FORWARD_DECLARATION u_aaabbb [9:1/100-9:16/115]
 UNION u_leaf_value (u_leaf_value ) [11:1/125-15:2/196] lcurly=144 SCOPE: 
$Global$ 
     BASE CLASSES:
     MEMBERS:
diff --git 
a/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/iz165038.cc.dat
 
b/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/iz165038.cc.dat
--- 
a/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/iz165038.cc.dat
+++ 
b/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/iz165038.cc.dat
@@ -26,6 +26,7 @@
                 FIELD PUBLIC dummy_pointer [10:5/144-10:26/165]  TYPE: *void 
TEXT=void*  [10:5/144-10:12/151]  INIT: null  SCOPE:  
                 FIELD PUBLIC dummy_long [11:5/170-11:23/188]  TYPE: long 
TEXT=long  [11:5/170-11:9/174]  INIT: null  SCOPE:  
         FIELD PUBLIC aligned_pad_u [12:5/193-12:18/206]  TYPE: 
_GStaticMutex:: TEXT=aligned_pad_u  [7:3/87-12:4/192]  INIT: null  SCOPE: 
_GStaticMutex 
+CLASS_FORWARD_DECLARATION _GMutex [6:3/54-6:17/68]
 TYPEDEF GStaticMutex  [13:3/210-13:15/222] TYPE: _GStaticMutex 
TEXT=_GStaticMutex  [4:1/20-13:16/223] SCOPE: $Global$ 
 VARIABLE g__GModule_lock [16:1/226-16:118/343]  TYPE: GStaticMutex 
TEXT=GStaticMutex  [16:1/226-16:22/247]  INIT: text='{ ((void*) 0) , { { 
0,0,0,0,0,0,88,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} } }'  SCOPE: iz165038.cc
 
diff --git 
a/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/iz199899.c.dat
 
b/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/iz199899.c.dat
--- 
a/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/iz199899.c.dat
+++ 
b/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModel2Test/iz199899.c.dat
@@ -13,7 +13,9 @@
     <no macros>
 VARIABLE x199899 [1:1/0-1:26/25]  TYPE: int TEXT=int  [1:1/0-1:13/12]  INIT: 
text='4'  SCOPE: $Global$ 
 CLASS_FORWARD_DECLARATION BinaryTree199899 [2:1/26-2:25/50]
+CLASS_FORWARD_DECLARATION BinaryTree199899 [3:1/51-3:35/85]
 VARIABLE node199899 [3:1/51-3:47/97]  TYPE: BinaryTree199899 
TEXT=BinaryTree199899  [3:19/69-3:35/85]  INIT: null  SCOPE: $Global$ 
+CLASS_FORWARD_DECLARATION BinaryTree199899 [4:1/98-4:44/141]
 VARIABLE node199899_2 [4:1/98-4:58/155]  TYPE: BinaryTree199899 
TEXT=BinaryTree199899  [4:28/125-4:44/141]  INIT: null  SCOPE: $Global$ 
 VARIABLE lversion199899 [5:1/156-5:43/198]  TYPE: const float TEXT=const 
float  [5:1/156-5:21/176]  INIT: text='1.2'  SCOPE: $Global$ 
 VARIABLE taxrate199899 [6:1/199-6:30/228]  TYPE: int TEXT=int  
[6:1/199-6:15/213]  INIT: null  SCOPE: $Global$ 
diff --git 
a/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModelTest/templateParams.h.dat
 
b/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModelTest/templateParams.h.dat
--- 
a/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModelTest/templateParams.h.dat
+++ 
b/cnd.modelimpl/test/unit/data/goldenfiles/org/netbeans/modules/cnd/modelimpl/trace/FileModelTest/templateParams.h.dat
@@ -198,6 +198,12 @@
         STATEMENT RETURN  [57:5/1477-57:34/1506] SCOPE: Stmt  
[56:27/1471-58:2/1508] text: 'return ch_p('.').parse(scan);'
 TYPEDEF null_tl  [60:1/1510-60:40/1549] TYPE: 
$unresolved$::MakeTypelist::Result TEXT=MakeTypelist::Result  
[60:9/1518-60:31/1540] SCOPE: $Global$ 
 TYPEDEF ClassList  [62:1/1551-66:19/1612] TYPE: 
$unresolved$::Loki::Seq::Type TEXT=Loki::Seq<Foo,Boo>::Type  
[62:9/1559-66:8/1601] SCOPE: $Global$ 
+STRUCT Foo (Foo ) [64:1/1571-64:11/1581] lcurly=1580 SCOPE: $Global$ 
+    BASE CLASSES:
+    MEMBERS:
+STRUCT Boo (Boo ) [65:1/1583-65:11/1593] lcurly=1592 SCOPE: $Global$ 
+    BASE CLASSES:
+    MEMBERS:
 ENUM level_type [69:1/1675-71:2/1707] SCOPE: $Global$ 
     ONE
     TWO

[hg] main-silver: Additional fi

Petr Kudryavtsev 07/03/2013

Project Features

About this Project

DB was started in November 2009, is owned by Antonin Nebuzelsky, and has 136 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20150626.29986a4). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close