# HG changeset patch # User Alexander Simon # Date 1443544404 -10800 # Tue Sep 29 19:33:24 2015 +0300 # Node ID bcd8ade69e5e9c9dc8844c3898415fc16536cf49 # Parent 195b3d6766b164b9981a8eb288e61dd973a846d2 fixing #Bug 255548 inaccuracy tests: IDE can't parse gunichartables.h file for a 30 minutes diff --git a/cnd.completion/src/org/netbeans/modules/cnd/completion/cplusplus/ext/CompletionSupport.java b/cnd.completion/src/org/netbeans/modules/cnd/completion/cplusplus/ext/CompletionSupport.java --- a/cnd.completion/src/org/netbeans/modules/cnd/completion/cplusplus/ext/CompletionSupport.java +++ b/cnd.completion/src/org/netbeans/modules/cnd/completion/cplusplus/ext/CompletionSupport.java @@ -87,6 +87,7 @@ import org.netbeans.modules.cnd.api.model.CsmTemplateParameterType; import org.netbeans.modules.cnd.api.model.CsmType; import org.netbeans.modules.cnd.api.model.CsmVariable; +import org.netbeans.modules.cnd.api.model.deep.CsmExpression; import org.netbeans.modules.cnd.api.model.deep.CsmReturnStatement; import org.netbeans.modules.cnd.api.model.deep.CsmStatement; import org.netbeans.modules.cnd.api.model.deep.CsmStatement.Kind; @@ -324,6 +325,17 @@ return ((CsmOffsetable) retType).getStartOffset(); } } + if (CsmKindUtilities.isVariable(lastObj)) { + CsmVariable v = (CsmVariable)lastObj; + CsmExpression initialValue = v.getInitialValue(); + if (CsmOffsetUtilities.isInObject(initialValue, pos)) { + List lambdas = initialValue.getLambdas(); + if (lambdas == null || lambdas.isEmpty()) { + // client should use cached last separaror offset + return -1; + } + } + } if (CsmKindUtilities.isOffsetable(lastObj)) { CsmOffsetable offs = (CsmOffsetable) lastObj; if (offs.getStartOffset() < pos && offs.getEndOffset() > pos) { diff --git a/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CsmOffsetResolver.java b/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CsmOffsetResolver.java --- a/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CsmOffsetResolver.java +++ b/cnd.completion/src/org/netbeans/modules/cnd/completion/csm/CsmOffsetResolver.java @@ -351,14 +351,15 @@ } public static CsmContext findContext(CsmFile file, int offset, FileReferencesContext fileReferncesContext) { - CsmContext context = (CsmContext) CsmCacheManager.get(new CsmContextKey(file, offset)); - if (context == null) { - context = new CsmContext(file, offset); + //CsmContext context = (CsmContext) CsmCacheManager.get(new CsmContextKey(file, offset)); + //if (context == null) { + CsmContext context = new CsmContext(file, offset); findObjectWithContext(file, offset, context, fileReferncesContext); exploreTypeObject(context, context.getLastObject(), offset); - CsmCacheManager.put(new CsmContextKey(file, offset), context); - } - return new CsmContext(context); // return a clone of context + return context; + //CsmCacheManager.put(new CsmContextKey(file, offset), context); + //} + //return new CsmContext(context); // return a clone of context } public static CsmContext findContextFromScope(CsmFile file, int offset, CsmScope contextScope) {