1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Fix for Bug 151207 - Content assist fails due to lack of completion node (patch by Bryan Wilkinson)

This commit is contained in:
Anton Leherbauer 2007-01-26 15:46:53 +00:00
parent dedbb3093d
commit b07a1851fa
29 changed files with 175 additions and 193 deletions

View file

@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -4471,6 +4472,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
break;
case IToken.tCOLONCOLON:
case IToken.tIDENTIFIER:
case IToken.tCOMPLETION:
// to get templates right we need to use the class as the scope
ITokenDuple d = name();
name = createName(d);
@ -4506,6 +4508,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
continue baseSpecifierLoop;
case IToken.tLBRACE:
case IToken.tEOC:
if (name == null)
name = createName();
baseSpec = createBaseSpecifier();

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others.
* Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
*******************************************************************************/
package org.eclipse.cdt.internal.core.parser.scanner2;
@ -2036,7 +2037,7 @@ abstract class BaseScanner implements IScanner {
}
// We've run out of contexts, our work is done here
return contentAssistMode ? eocToken : null;
return contentAssistMode ? new SimpleToken(IToken.tCOMPLETION, Integer.MAX_VALUE, null, Integer.MAX_VALUE) : null;
}
protected CharTable ident = new CharTable(1024);

View file

@ -41,8 +41,8 @@ public class CompletionTest_ArgumentType_NoPrefix extends CompletionProposalsBa
public CompletionTest_ArgumentType_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -41,8 +41,8 @@ public class CompletionTest_ArgumentType_NoPrefix2 extends CompletionProposalsB
public CompletionTest_ArgumentType_NoPrefix2(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -33,20 +33,11 @@ public class CompletionTest_ArgumentType_Prefix extends CompletionProposalsBase
"anEnumeration",
// missing proposal:
"AStruct"
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool
Result: anotherFunction(void) void
Result: aSecondEnum
Result: aThirdEnum
Result: aVariable : int
*/
};
public CompletionTest_ArgumentType_Prefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724
// and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(109724);
}

View file

@ -33,20 +33,11 @@ public class CompletionTest_ArgumentType_Prefix2 extends CompletionProposalsBas
"anEnumeration",
// missing proposal:
"AStruct"
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool
Result: anotherFunction(void) void
Result: aSecondEnum
Result: aThirdEnum
Result: aVariable : int
*/
};
public CompletionTest_ArgumentType_Prefix2(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724
// and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(109724);
}

View file

@ -36,8 +36,8 @@ public class CompletionTest_ClassReference_NoPrefix extends CompletionProposals
public CompletionTest_ClassReference_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -30,22 +30,12 @@ public class CompletionTest_ClassReference_Prefix extends CompletionProposalsBa
private final String[] expectedResults = {
"aClass", //$NON-NLS-1$
"anotherClass" //$NON-NLS-1$
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool
Result: aNamespace
Result: anEnumeration
Result: anotherFunction(void) void
Result: aSecondEnum
Result: aThirdEnum
Result: aVariable : int
*/
};
public CompletionTest_ClassReference_Prefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(88787);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -30,14 +30,15 @@ public class CompletionTest_ConstructorReference extends CompletionProposalsBas
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
// missing proposals:
"xOtherClass(char*)",
"xOtherClass(int)"
};
public CompletionTest_ConstructorReference(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// unknown failure
setExpectFailure(77777);
}
public static Test suite() {

View file

@ -29,13 +29,21 @@ public class CompletionTest_ExceptionReference_NoPrefix extends CompletionPropo
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
"..." // TODO
"AStruct",
"XStruct",
"aClass",
"aNamespace",
"anEnumeration",
"anotherClass",
"xEnumeration",
"xNamespace",
"xOtherClass"
};
public CompletionTest_ExceptionReference_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -35,22 +35,11 @@ public class CompletionTest_ExceptionReference_Prefix extends CompletionProposa
"anEnumeration",
// missing proposal:
"AStruct"
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool
Result: anotherField : int
Result: anotherFunction(void) void
Result: anotherMethod(void) void
Result: aSecondEnum
Result: aThirdEnum
Result: aVariable : int
*/
};
public CompletionTest_ExceptionReference_Prefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724
// and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(109724);
}

View file

@ -26,13 +26,22 @@ public class CompletionTest_FieldType_NoPrefix extends CompletionProposalsBaseT
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
"<aType>" // TODO
"AStruct",
"XStruct",
"aClass",
"aNamespace",
"aThirdClass",
"anEnumeration",
"anotherClass",
"xEnumeration",
"xNamespace",
"xOtherClass"
};
public CompletionTest_FieldType_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -27,13 +27,22 @@ public class CompletionTest_FieldType_NoPrefix2 extends CompletionProposalsBase
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
"<aType>" // TODO
"AStruct",
"XStruct",
"aClass",
"aNamespace",
"aThirdClass",
"anEnumeration",
"anotherClass",
"xEnumeration",
"xNamespace",
"xOtherClass"
};
public CompletionTest_FieldType_NoPrefix2(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -32,20 +32,11 @@ public class CompletionTest_FieldType_Prefix extends CompletionProposalsBaseTes
"anEnumeration",
// missing proposal:
"AStruct"
/* FIXME: Additional results which should not be returned. Run with tracing enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool
Result: anotherFunction(void) void
Result: aSecondEnum
Result: aThirdEnum
Result: aVariable : int
*/
};
public CompletionTest_FieldType_Prefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724
// and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(109724);
}

View file

@ -27,15 +27,27 @@ public class CompletionTest_MacroRef_NoPrefix extends CompletionProposalsBaseTe
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
// missing results:
"aMacro(x)",
"Debug",
"xMacro(x,y)"
/* superfluous results:
AStruct
XStruct
aClass
aNamespace
anEnumeration
anotherClass
xEnumeration
xNamespace
xOtherClass
*/
};
public CompletionTest_MacroRef_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=171708
setExpectFailure(171708);
}
public static Test suite() {

View file

@ -27,13 +27,14 @@ public class CompletionTest_MacroRef_Prefix extends CompletionProposalsBaseTest
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "D";
private final String[] expectedResults = {
// missing result:
"Debug"
};
public CompletionTest_MacroRef_Prefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=171708
setExpectFailure(171708);
}
public static Test suite() {

View file

@ -33,8 +33,8 @@ public class CompletionTest_NamespaceRef_NoPrefix extends CompletionProposalsBa
public CompletionTest_NamespaceRef_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -29,13 +29,12 @@ public class CompletionTest_NamespaceRef_Prefix extends CompletionProposalsBase
private final String expectedPrefix = "a";
private final String[] expectedResults = {
"aNamespace"
/* FIXME: extra results */
};
public CompletionTest_NamespaceRef_Prefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(88787);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -32,13 +32,19 @@ public class CompletionTest_NewTypeReference_NoPrefix extends CompletionProposa
"anotherClass",
"AStruct",
"xOtherClass",
"XStruct"
"XStruct",
"aNamespace",
"xNamespace"
/* extra results:
anEnumeration
xEnumeration
*/
};
public CompletionTest_NewTypeReference_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// unknown problem
setExpectFailure(77777);
}
public static Test suite() {

View file

@ -30,23 +30,17 @@ public class CompletionTest_NewTypeReference_Prefix extends CompletionProposals
private final String[] expectedResults = {
"aClass",
"anotherClass",
"aNamespace",
// missing proposal:
"AStruct"
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aFirstEnum
Result: aFunction(void) bool
Result: anotherField : int
Result: anotherFunction(void) void
Result: anotherMethod(void) void
Result: aSecondEnum
Result: aThirdEnum
Result: aVariable : int
*/ };
// extra proposal:
// anEnumeration
};
public CompletionTest_NewTypeReference_Prefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724
// and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(109724);
}

View file

@ -27,19 +27,17 @@ public class CompletionTest_ScopedReference_NonCodeScope extends CompletionProp
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
"Foo",
"x : int",
"Foo(void) ",
"bar(void) void",
"fum(void) void"
"fum(void) void",
// missing:
"x : int"
};
/* FIXME: Unexpected results; run with tracing to reproduce
Result: y : int
*/
public CompletionTest_ScopedReference_NonCodeScope(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(88787);
// unknown problem
setExpectFailure(77777);
}
public static Test suite() {

View file

@ -28,14 +28,38 @@ public class CompletionTest_SingleName_Method_NoPrefix extends CompletionPropos
//TODO Hoda - please update this constant with what it is supposed to be
private final String[] expectedResults = {
"AStruct",
"XStruct",
"aClass",
"aFirstEnum",
"aFunction(void) bool",
"aNamespace",
"aSecondEnum",
"aThirdEnum",
"aVariable : int",
"anEnumeration",
"anotherClass",
"anotherField : int",
"anotherMethod() void"
"anotherFunction(void) void",
"anotherMethod(void) void",
"xEnumeration",
"xFirstEnum",
"xFunction(void) bool",
"xNamespace",
"xOtherClass",
"xOtherFunction(void) void",
"xSecondEnum",
"xThirdEnum",
"xVariable : int",
"~anotherClass(void) "
// extra result
// "operator =(const anotherClass &) anotherClass &",
};
public CompletionTest_SingleName_Method_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -26,46 +26,47 @@ public class CompletionTest_SingleName_NoPrefix extends CompletionProposalsBase
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
"x : int"
// "aVariable : int",
// "xVariable : int",
// "aFunction() bool",
// "anotherFunction() void",
// "foo(int) void",
// "xFunction() bool",
// "xOtherFunction() void",
// "aClass",
// "anotherClass",
// "xOtherClass",
// "AStruct",
// "XStruct",
// "aNamespace",
// "xNamespace",
// "anEnumeration",
// "xEnumeration",
// "aFirstEnum",
// "aSecondEnum",
// "aThirdEnum",
// "xFirstEnum",
// "xSecondEnum",
// "xThirdEnum",
// "__cplusplus",
// "__DATE__",
// "__FILE__",
// "__LINE__",
// "__STDC__",
// "__STDC_HOSTED__",
// "__STDC_VERSION__",
// "__TIME__",
// "AMacro(x)",
// "DEBUG",
// "XMacro(x,y)"
"x : int",
"aVariable : int",
"xVariable : int",
"aFunction(void) bool",
"anotherFunction(void) void",
"foo(int) void",
"xFunction(void) bool",
"xOtherFunction(void) void",
"aClass",
"anotherClass",
"xOtherClass",
"AStruct",
"XStruct",
"aNamespace",
"xNamespace",
"anEnumeration",
"xEnumeration",
"aFirstEnum",
"aSecondEnum",
"aThirdEnum",
"xFirstEnum",
"xSecondEnum",
"xThirdEnum",
// missing:
"__cplusplus",
"__DATE__",
"__FILE__",
"__LINE__",
"__STDC__",
"__STDC_HOSTED__",
"__STDC_VERSION__",
"__TIME__",
"AMacro(x)",
"DEBUG",
"XMacro(x,y)"
};
public CompletionTest_SingleName_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=171708
setExpectFailure(171708);
}
public static Test suite() {

View file

@ -25,11 +25,15 @@ public class CompletionTest_SingleName_Prefix extends CompletionProposalsBaseTe
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "AM";
private final String[] expectedResults = {
// missing results
"AMacro(x)"
};
public CompletionTest_SingleName_Prefix(String name) {
super(name);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=171708
// setExpectFailure(171708);
}
public static Test suite() {

View file

@ -29,32 +29,12 @@ public class CompletionTest_TypeRef_NoPrefix extends CompletionProposalsBaseTes
private final String[] expectedResults = {
"aNamespace",
"xNamespace"
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aClass
Result: aFirstEnum
Result: aFunction(void) bool
Result: anEnumeration
Result: anotherClass
Result: anotherFunction(void) void
Result: aSecondEnum
Result: AStruct
Result: aThirdEnum
Result: aVariable : int
Result: xEnumeration
Result: xFirstEnum
Result: xFunction(void) bool
Result: xOtherClass
Result: xOtherFunction(void) void
Result: xSecondEnum
Result: XStruct
Result: xThirdEnum
Result: xVariable : int
*/ };
};
public CompletionTest_TypeRef_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(88787);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -29,22 +29,12 @@ public class CompletionTest_TypeRef_Prefix extends CompletionProposalsBaseTest{
private final String expectedPrefix = "a";
private final String[] expectedResults = {
"aNamespace"
/* FIXME: Additional results which should not be there. Run with trace enabled to reproduce:
Result: aClass
Result: aFirstEnum
Result: aFunction(void) bool
Result: anEnumeration
Result: anotherClass
Result: anotherFunction(void) void
Result: aSecondEnum
Result: aThirdEnum
Result: aVariable : int
*/ };
};
public CompletionTest_TypeRef_Prefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(88787);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -27,19 +27,18 @@ public class CompletionTest_VariableType_NestedPrefix extends CompletionProposa
private final String headerFileFullPath ="resources/contentassist/" + headerFileName;
private final String expectedPrefix = "";
private final String[] expectedResults = {
"Foo",
"DEF",
"Foo(void) ",
"bar(void) void",
"fum(void) void",
// missing:
"DEF",
"x : int"
};
/* FIXME: Unexpected result. Rerun with tracing to reproduce
Result: y : int
*/
public CompletionTest_VariableType_NestedPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(88787);
// unknown problem
setExpectFailure(77777);
}
public static Test suite() {

View file

@ -38,8 +38,8 @@ public class CompletionTest_VariableType_NoPrefix extends CompletionProposalsBa
public CompletionTest_VariableType_NoPrefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=151207
setExpectFailure(151207);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169860
setExpectFailure(169860);
}
public static Test suite() {

View file

@ -31,20 +31,11 @@ public class CompletionTest_VariableType_Prefix extends CompletionProposalsBase
"anEnumeration",
// missing proposal:
"AStruct"
/* Superfluous proposals:
"aFirstEnum",
"aFunction(void) bool",
"aSecondEnum",
"aThirdEnum",
"aVariable : int",
"anotherFunction(void) void"
*/
};
public CompletionTest_VariableType_Prefix(String name) {
super(name);
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=109724
// and https://bugs.eclipse.org/bugs/show_bug.cgi?id=88787
setExpectFailure(109724);
}