mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
This commit is contained in:
parent
2a4baf63a4
commit
3a6ffef8f8
5 changed files with 368 additions and 308 deletions
File diff suppressed because it is too large
Load diff
|
@ -29,7 +29,6 @@ public interface IASTSimpleTypeSpecifier extends IASTTypeSpecifier
|
|||
public static final Type DOUBLE = new Type( 6 );
|
||||
public static final Type VOID = new Type( 7 );
|
||||
public static final Type CLASS_OR_TYPENAME = new Type( 8 );
|
||||
public static final Type TEMPLATE = new Type( 9 );
|
||||
public static final Type _BOOL = new Type( 10 );
|
||||
|
||||
protected static final int LAST_TYPE = 10;
|
||||
|
|
|
@ -20,4 +20,5 @@ public interface IASTTypedefDeclaration extends IASTDeclaration, IASTOffsetableN
|
|||
public String getName();
|
||||
public IASTAbstractDeclaration getAbstractDeclarator();
|
||||
|
||||
public IASTTypeSpecifier getFinalTypeSpecifier() throws ASTNotImplementedException;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,10 @@ package org.eclipse.cdt.internal.core.parser.ast.complete;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
|
||||
|
@ -185,4 +188,28 @@ public class ASTTypedef extends ASTSymbol implements IASTTypedefDeclaration
|
|||
public int getNameLineNumber() {
|
||||
return offsets.getNameLineNumber();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration#getFinalTypeSpecifier()
|
||||
*/
|
||||
public IASTTypeSpecifier getFinalTypeSpecifier() throws ASTNotImplementedException {
|
||||
IASTTypeSpecifier currentTypeSpec = mapping.getTypeSpecifier();
|
||||
while( currentTypeSpec instanceof IASTSimpleTypeSpecifier ||
|
||||
currentTypeSpec instanceof IASTTypedefDeclaration )
|
||||
{
|
||||
if( currentTypeSpec instanceof IASTSimpleTypeSpecifier )
|
||||
{
|
||||
IASTSimpleTypeSpecifier simpleTypeSpec = (IASTSimpleTypeSpecifier) currentTypeSpec;
|
||||
if( simpleTypeSpec.getType() == IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME )
|
||||
currentTypeSpec = simpleTypeSpec.getTypeSpecifier();
|
||||
else
|
||||
break;
|
||||
}
|
||||
else if( currentTypeSpec instanceof IASTTypedefDeclaration )
|
||||
{
|
||||
currentTypeSpec = ((IASTTypedefDeclaration)currentTypeSpec).getAbstractDeclarator().getTypeSpecifier();
|
||||
}
|
||||
}
|
||||
return currentTypeSpec;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
package org.eclipse.cdt.internal.core.parser.ast.quick;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
|
||||
|
@ -23,7 +25,8 @@ import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
|
|||
*/
|
||||
public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedefDeclaration
|
||||
{
|
||||
private final String name;
|
||||
protected static final ASTNotImplementedException NOT_IMPLEMENTED = new ASTNotImplementedException();
|
||||
private final String name;
|
||||
private final IASTAbstractDeclaration mapping;
|
||||
private NamedOffsets offsets = new NamedOffsets();
|
||||
private final ASTQualifiedNamedElement qualifiedName;
|
||||
|
@ -167,4 +170,10 @@ public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedef
|
|||
public int getNameLineNumber() {
|
||||
return offsets.getNameLineNumber();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration#getFinalTypeSpecifier()
|
||||
*/
|
||||
public IASTTypeSpecifier getFinalTypeSpecifier() throws ASTNotImplementedException {
|
||||
throw NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue