mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Code formatting.
This commit is contained in:
parent
65b3044dca
commit
8f45aeca2f
2 changed files with 103 additions and 109 deletions
|
@ -86,7 +86,6 @@ import org.eclipse.cdt.internal.core.parser.scanner.CPreprocessor;
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
*/
|
*/
|
||||||
public class AST2BaseTest extends BaseTestCase {
|
public class AST2BaseTest extends BaseTestCase {
|
||||||
|
|
||||||
protected static final IParserLogService NULL_LOG = new NullLogService();
|
protected static final IParserLogService NULL_LOG = new NullLogService();
|
||||||
|
|
||||||
public AST2BaseTest() {
|
public AST2BaseTest() {
|
||||||
|
@ -104,31 +103,31 @@ public class AST2BaseTest extends BaseTestCase {
|
||||||
protected IASTTranslationUnit parse(String code, ParserLanguage lang, boolean useGNUExtensions) throws ParserException {
|
protected IASTTranslationUnit parse(String code, ParserLanguage lang, boolean useGNUExtensions) throws ParserException {
|
||||||
return parse(code, lang, useGNUExtensions, true);
|
return parse(code, lang, useGNUExtensions, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string
|
* @param string
|
||||||
* @param c
|
* @param c
|
||||||
* @return
|
* @return
|
||||||
* @throws ParserException
|
* @throws ParserException
|
||||||
*/
|
*/
|
||||||
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems ) throws ParserException{
|
protected IASTTranslationUnit parse(String code, ParserLanguage lang, boolean useGNUExtensions,
|
||||||
|
boolean expectNoProblems) throws ParserException {
|
||||||
return parse(code, lang, useGNUExtensions, expectNoProblems, false);
|
return parse(code, lang, useGNUExtensions, expectNoProblems, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IASTTranslationUnit parse( String code, ParserLanguage lang, boolean useGNUExtensions, boolean expectNoProblems , boolean parseComments) throws ParserException {
|
protected IASTTranslationUnit parse(String code, ParserLanguage lang, boolean useGNUExtensions,
|
||||||
|
boolean expectNoProblems, boolean parseComments) throws ParserException {
|
||||||
IScanner scanner = createScanner(new CodeReader(code.toCharArray()), lang, ParserMode.COMPLETE_PARSE,
|
IScanner scanner = createScanner(new CodeReader(code.toCharArray()), lang, ParserMode.COMPLETE_PARSE,
|
||||||
new ScannerInfo(), parseComments);
|
new ScannerInfo(), parseComments);
|
||||||
ISourceCodeParser parser2 = null;
|
ISourceCodeParser parser2 = null;
|
||||||
if( lang == ParserLanguage.CPP )
|
if (lang == ParserLanguage.CPP) {
|
||||||
{
|
|
||||||
ICPPParserExtensionConfiguration config = null;
|
ICPPParserExtensionConfiguration config = null;
|
||||||
if (useGNUExtensions)
|
if (useGNUExtensions)
|
||||||
config = new GPPParserExtensionConfiguration();
|
config = new GPPParserExtensionConfiguration();
|
||||||
else
|
else
|
||||||
config = new ANSICPPParserExtensionConfiguration();
|
config = new ANSICPPParserExtensionConfiguration();
|
||||||
parser2 = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE, NULL_LOG,config, null);
|
parser2 = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE, NULL_LOG,config, null);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ICParserExtensionConfiguration config = null;
|
ICParserExtensionConfiguration config = null;
|
||||||
|
|
||||||
if (useGNUExtensions)
|
if (useGNUExtensions)
|
||||||
|
@ -144,20 +143,16 @@ public class AST2BaseTest extends BaseTestCase {
|
||||||
if (parser2.encounteredError() && expectNoProblems)
|
if (parser2.encounteredError() && expectNoProblems)
|
||||||
throw new ParserException("FAILURE"); //$NON-NLS-1$
|
throw new ParserException("FAILURE"); //$NON-NLS-1$
|
||||||
|
|
||||||
if( lang == ParserLanguage.C && expectNoProblems )
|
if (lang == ParserLanguage.C && expectNoProblems) {
|
||||||
{
|
|
||||||
assertEquals(CVisitor.getProblems(tu).length, 0);
|
assertEquals(CVisitor.getProblems(tu).length, 0);
|
||||||
assertEquals(tu.getPreprocessorProblems().length, 0);
|
assertEquals(tu.getPreprocessorProblems().length, 0);
|
||||||
}
|
} else if (lang == ParserLanguage.CPP && expectNoProblems) {
|
||||||
else if ( lang == ParserLanguage.CPP && expectNoProblems )
|
|
||||||
{
|
|
||||||
assertEquals(CPPVisitor.getProblems(tu).length, 0);
|
assertEquals(CPPVisitor.getProblems(tu).length, 0);
|
||||||
assertEquals(0, tu.getPreprocessorProblems().length);
|
assertEquals(0, tu.getPreprocessorProblems().length);
|
||||||
}
|
}
|
||||||
if (expectNoProblems)
|
if (expectNoProblems)
|
||||||
assertEquals(0, tu.getPreprocessorProblems().length);
|
assertEquals(0, tu.getPreprocessorProblems().length);
|
||||||
|
|
||||||
|
|
||||||
return tu;
|
return tu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,9 +281,10 @@ public class AST2BaseTest extends BaseTestCase {
|
||||||
|
|
||||||
if (binding == null) assertTrue(false);
|
if (binding == null) assertTrue(false);
|
||||||
|
|
||||||
for( int i = 0; i < collector.size(); i++ )
|
for (int i = 0; i < collector.size(); i++) {
|
||||||
if (collector.getName(i).resolveBinding() == binding)
|
if (collector.getName(i).resolveBinding() == binding)
|
||||||
count++;
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
assertEquals(count, num);
|
assertEquals(count, num);
|
||||||
}
|
}
|
||||||
|
@ -328,7 +324,6 @@ public class AST2BaseTest extends BaseTestCase {
|
||||||
assertEquals(num, count);
|
assertEquals(num, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void isExpressionStringEqual(IASTExpression exp, String str) {
|
protected void isExpressionStringEqual(IASTExpression exp, String str) {
|
||||||
String expressionString = ASTSignatureUtil.getExpressionString(exp);
|
String expressionString = ASTSignatureUtil.getExpressionString(exp);
|
||||||
assertEquals(str, expressionString);
|
assertEquals(str, expressionString);
|
||||||
|
|
|
@ -546,7 +546,6 @@ public class CPPSemantics {
|
||||||
if (n instanceof ICPPASTQualifiedName) {
|
if (n instanceof ICPPASTQualifiedName) {
|
||||||
n = ((ICPPASTQualifiedName) n).getLastName();
|
n = ((ICPPASTQualifiedName) n).getLastName();
|
||||||
}
|
}
|
||||||
|
|
||||||
scope = CPPVisitor.getContainingScope(n);
|
scope = CPPVisitor.getContainingScope(n);
|
||||||
} else if (parent instanceof ICPPASTConstructorChainInitializer) {
|
} else if (parent instanceof ICPPASTConstructorChainInitializer) {
|
||||||
ICPPASTConstructorChainInitializer initializer = (ICPPASTConstructorChainInitializer) parent;
|
ICPPASTConstructorChainInitializer initializer = (ICPPASTConstructorChainInitializer) parent;
|
||||||
|
|
Loading…
Add table
Reference in a new issue