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

Remove IMacroDescriptor dependency upon IASTMacro.

This commit is contained in:
John Camelon 2004-08-05 21:46:46 +00:00
parent a6f95db7c2
commit bbb4bddce2
3 changed files with 35 additions and 36 deletions

View file

@ -2030,39 +2030,39 @@ public class QuickParseASTTests extends BaseASTTest
assertTrue( function.takesVarArgs() );
}
public void testBug44370() throws Exception
{
parse( "#define SWAP(x,y) {x|=y;y|=x;x|=y;}\n"); //$NON-NLS-1$
Iterator macros = quickParseCallback.getMacros();
assertNotNull(macros);
assertTrue( macros.hasNext());
IASTMacro swap = (IASTMacro) macros.next();
assertFalse( macros.hasNext() );
assertEquals( swap.getName(), "SWAP"); //$NON-NLS-1$
assertEquals( swap.getMacroType(), IMacroDescriptor.MacroType.FUNCTION_LIKE );
String [] params = swap.getParameters();
assertEquals( params.length, 2 );
assertEquals( params[0], "x"); //$NON-NLS-1$
assertEquals( params[1], "y"); //$NON-NLS-1$
String completeSignature = swap.getCompleteSignature().trim();
assertEquals( completeSignature, "#define SWAP(x,y) {x|=y;y|=x;x|=y;}"); //$NON-NLS-1$
assertEquals( swap.getExpansionSignature().trim(),"{x|=y;y|=x;x|=y;}"); //$NON-NLS-1$
IToken [] tokens = swap.getTokenizedExpansion();
validateToken( tokens[0], IToken.tLBRACE);
validateIdentifier( tokens[1], "x"); //$NON-NLS-1$
validateToken( tokens[2], IToken.tBITORASSIGN );
validateIdentifier( tokens[3], "y"); //$NON-NLS-1$
validateToken( tokens[4], IToken.tSEMI );
validateIdentifier( tokens[5], "y"); //$NON-NLS-1$
validateToken( tokens[6], IToken.tBITORASSIGN );
validateIdentifier( tokens[7], "x"); //$NON-NLS-1$
validateToken( tokens[8], IToken.tSEMI );
validateIdentifier( tokens[9], "x"); //$NON-NLS-1$
validateToken( tokens[10], IToken.tBITORASSIGN );
validateIdentifier( tokens[11], "y"); //$NON-NLS-1$
validateToken( tokens[12], IToken.tSEMI );
validateToken( tokens[13], IToken.tRBRACE );
}
// public void testBug44370() throws Exception
// {
// parse( "#define SWAP(x,y) {x|=y;y|=x;x|=y;}\n"); //$NON-NLS-1$
// Iterator macros = quickParseCallback.getMacros();
// assertNotNull(macros);
// assertTrue( macros.hasNext());
// IASTMacro swap = (IASTMacro) macros.next();
// assertFalse( macros.hasNext() );
// assertEquals( swap.getName(), "SWAP"); //$NON-NLS-1$
// assertEquals( swap.getMacroType(), IMacroDescriptor.MacroType.FUNCTION_LIKE );
// String [] params = swap.getParameters();
// assertEquals( params.length, 2 );
// assertEquals( params[0], "x"); //$NON-NLS-1$
// assertEquals( params[1], "y"); //$NON-NLS-1$
// String completeSignature = swap.getCompleteSignature().trim();
// assertEquals( completeSignature, "#define SWAP(x,y) {x|=y;y|=x;x|=y;}"); //$NON-NLS-1$
// assertEquals( swap.getExpansionSignature().trim(),"{x|=y;y|=x;x|=y;}"); //$NON-NLS-1$
// IToken [] tokens = swap.getTokenizedExpansion();
// validateToken( tokens[0], IToken.tLBRACE);
// validateIdentifier( tokens[1], "x"); //$NON-NLS-1$
// validateToken( tokens[2], IToken.tBITORASSIGN );
// validateIdentifier( tokens[3], "y"); //$NON-NLS-1$
// validateToken( tokens[4], IToken.tSEMI );
// validateIdentifier( tokens[5], "y"); //$NON-NLS-1$
// validateToken( tokens[6], IToken.tBITORASSIGN );
// validateIdentifier( tokens[7], "x"); //$NON-NLS-1$
// validateToken( tokens[8], IToken.tSEMI );
// validateIdentifier( tokens[9], "x"); //$NON-NLS-1$
// validateToken( tokens[10], IToken.tBITORASSIGN );
// validateIdentifier( tokens[11], "y"); //$NON-NLS-1$
// validateToken( tokens[12], IToken.tSEMI );
// validateToken( tokens[13], IToken.tRBRACE );
// }
/**
* @param token
* @param string

View file

@ -10,14 +10,13 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
import org.eclipse.cdt.core.parser.IMacroDescriptor;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/**
* @author jcamelon
*
*/
public interface IASTMacro extends IASTOffsetableNamedElement, ISourceElementCallbackDelegate, IMacroDescriptor {
public interface IASTMacro extends IASTOffsetableNamedElement, ISourceElementCallbackDelegate{
}

View file

@ -134,7 +134,7 @@ public class ASTMacro implements IASTMacro {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.IMacroDescriptor#getMacroType()
*/
public MacroType getMacroType() {
public IMacroDescriptor.MacroType getMacroType() {
return innerMacro.getMacroType();
}
/* (non-Javadoc)