mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Moves further AST-specific methods out of IScope
This commit is contained in:
parent
5c70bbcd1b
commit
b916d1065e
14 changed files with 101 additions and 97 deletions
|
@ -45,29 +45,7 @@ public interface IScope {
|
|||
* @return List of IBinding
|
||||
*/
|
||||
public IBinding[] find(String name) throws DOMException;
|
||||
|
||||
/**
|
||||
* The IScope serves as a mechanism for caching IASTNames and bindings to
|
||||
* speed up resolution.
|
||||
* mstodo more work: remove the ast-specific methods.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add an IASTName to be cached in this scope
|
||||
*
|
||||
* @param name
|
||||
* @throws DOMException
|
||||
*/
|
||||
public void addName(IASTName name) throws DOMException;
|
||||
|
||||
/**
|
||||
* remove the given binding from this scope
|
||||
*
|
||||
* @param binding
|
||||
* @throws DOMException
|
||||
*/
|
||||
void removeBinding(IBinding binding) throws DOMException;
|
||||
|
||||
|
||||
/**
|
||||
* Get the binding in this scope that the given name would resolve to. Could
|
||||
* return null if there is no matching binding in this scope, if the binding has not
|
||||
|
@ -81,15 +59,5 @@ public interface IScope {
|
|||
* @return : the binding in this scope that matches the name, or null
|
||||
* @throws DOMException
|
||||
*/
|
||||
public IBinding getBinding(IASTName name, boolean resolve)
|
||||
throws DOMException;
|
||||
|
||||
/**
|
||||
* This adds an IBinding to the scope. It is primarily used by the parser to add
|
||||
* implicit IBindings to the scope (such as GCC built-in functions).
|
||||
*
|
||||
* @param binding
|
||||
* @throws DOMException
|
||||
*/
|
||||
public void addBinding(IBinding binding) throws DOMException;
|
||||
public IBinding getBinding(IASTName name, boolean resolve) throws DOMException;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
|
@ -57,4 +58,22 @@ public class ASTInternal {
|
|||
((IASTInternalScope) scope).setFullyCached(val);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addBinding(IScope scope, IBinding binding) throws DOMException {
|
||||
if (scope instanceof IASTInternalScope) {
|
||||
((IASTInternalScope) scope).addBinding(binding);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeBinding(IScope scope, IBinding binding) throws DOMException {
|
||||
if (scope instanceof IASTInternalScope) {
|
||||
((IASTInternalScope) scope).removeBinding(binding);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addName(IScope scope, IASTName name) throws DOMException {
|
||||
if (scope instanceof IASTInternalScope) {
|
||||
((IASTInternalScope) scope).addName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
package org.eclipse.cdt.internal.core.dom.parser;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
||||
/**
|
||||
* Interface for methods on scopes that are internal to the AST.
|
||||
|
@ -44,4 +46,29 @@ public interface IASTInternalScope {
|
|||
* @throws DOMException
|
||||
*/
|
||||
public void flushCache() throws DOMException;
|
||||
|
||||
/**
|
||||
* This adds an IBinding to the scope. It is primarily used by the parser to add
|
||||
* implicit IBindings to the scope (such as GCC built-in functions).
|
||||
*
|
||||
* @param binding
|
||||
* @throws DOMException
|
||||
*/
|
||||
public void addBinding(IBinding binding) throws DOMException;
|
||||
|
||||
/**
|
||||
* remove the given binding from this scope
|
||||
*
|
||||
* @param binding
|
||||
* @throws DOMException
|
||||
*/
|
||||
void removeBinding(IBinding binding) throws DOMException;
|
||||
|
||||
/**
|
||||
* Add an IASTName to be cached in this scope
|
||||
*
|
||||
* @param name
|
||||
* @throws DOMException
|
||||
*/
|
||||
public void addName(IASTName name) throws DOMException;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
IASTName name = declarator.getName();
|
||||
IBinding binding = name.resolveBinding();
|
||||
if( scope != null )
|
||||
scope.addName( name );
|
||||
ASTInternal.addName(scope, name );
|
||||
if( binding != null )
|
||||
fields = (IField[]) ArrayUtil.append( IField.class, fields, binding );
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class CStructure extends PlatformObject implements ICompositeType, ICInte
|
|||
IASTDeclarator declarator = declarators[j];
|
||||
IASTName dtorName = declarator.getName();
|
||||
if( scope != null )
|
||||
scope.addName( dtorName );
|
||||
ASTInternal.addName( scope, dtorName );
|
||||
if( name.equals( dtorName.toString() ) ){
|
||||
IBinding binding = dtorName.resolveBinding();
|
||||
if( binding instanceof IField )
|
||||
|
|
|
@ -113,8 +113,8 @@ public class CVisitor {
|
|||
ICScope scope;
|
||||
try {
|
||||
scope = (ICScope)name.resolveBinding().getScope();
|
||||
if ( scope != null )
|
||||
scope.removeBinding(name.resolveBinding());
|
||||
if ( scope != null )
|
||||
ASTInternal.removeBinding(scope, name.resolveBinding());
|
||||
} catch ( DOMException e ) {
|
||||
}
|
||||
name.setBinding( null );
|
||||
|
@ -498,7 +498,7 @@ public class CVisitor {
|
|||
} else {
|
||||
binding = new CEnumeration( name );
|
||||
try {
|
||||
scope.addName( name );
|
||||
ASTInternal.addName(scope, name);
|
||||
} catch ( DOMException e1 ) {
|
||||
}
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ public class CVisitor {
|
|||
private static IBinding createBinding( IASTEnumerator enumerator ){
|
||||
IEnumerator binding = new CEnumerator( enumerator );
|
||||
try {
|
||||
((ICScope)binding.getScope()).addName( enumerator.getName() );
|
||||
ASTInternal.addName(binding.getScope(), enumerator.getName() );
|
||||
} catch ( DOMException e ) {
|
||||
}
|
||||
return binding;
|
||||
|
@ -534,7 +534,7 @@ public class CVisitor {
|
|||
try {
|
||||
IScope scope = binding.getScope();
|
||||
if (scope instanceof ICFunctionScope)
|
||||
((ICFunctionScope) binding.getScope()).addName( name );
|
||||
ASTInternal.addName(binding.getScope(), name );
|
||||
} catch ( DOMException e ) {
|
||||
}
|
||||
return binding;
|
||||
|
@ -562,7 +562,7 @@ public class CVisitor {
|
|||
}
|
||||
|
||||
try {
|
||||
((ICScope) binding.getScope()).addName( name );
|
||||
ASTInternal.addName(binding.getScope(), name );
|
||||
} catch ( DOMException e ) {
|
||||
}
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ public class CVisitor {
|
|||
ICScope scope = (ICScope) ((IASTCompoundStatement)((IASTFunctionDefinition)declarator.getParent()).getBody()).getScope();
|
||||
if ( scope != null && binding != null )
|
||||
try {
|
||||
scope.addName(name);
|
||||
ASTInternal.addName( scope, name);
|
||||
} catch ( DOMException e ) {
|
||||
}
|
||||
}
|
||||
|
@ -903,7 +903,7 @@ public class CVisitor {
|
|||
|
||||
if( scope != null && binding != null )
|
||||
try {
|
||||
scope.addName( name );
|
||||
ASTInternal.addName( scope, name );
|
||||
} catch ( DOMException e ) {
|
||||
}
|
||||
return binding;
|
||||
|
@ -932,7 +932,7 @@ public class CVisitor {
|
|||
|
||||
try {
|
||||
scope = (ICScope) binding.getScope();
|
||||
scope.addName( name );
|
||||
ASTInternal.addName( scope, name );
|
||||
} catch ( DOMException e ) {
|
||||
}
|
||||
|
||||
|
@ -1350,7 +1350,7 @@ public class CVisitor {
|
|||
if( declSpec instanceof ICASTElaboratedTypeSpecifier ){
|
||||
tempName = ((ICASTElaboratedTypeSpecifier)declSpec).getName();
|
||||
if( scope != null )
|
||||
scope.addName( tempName );
|
||||
ASTInternal.addName( scope, tempName );
|
||||
if( typesOnly ){
|
||||
if( prefixMap != null )
|
||||
prefixMap = (CharArrayObjectMap) collectResult( tempName, n, prefixMap );
|
||||
|
@ -1360,7 +1360,7 @@ public class CVisitor {
|
|||
} else if( declSpec instanceof ICASTCompositeTypeSpecifier ){
|
||||
tempName = ((ICASTCompositeTypeSpecifier)declSpec).getName();
|
||||
if( scope != null )
|
||||
scope.addName( tempName );
|
||||
ASTInternal.addName( scope, tempName );
|
||||
|
||||
if( typesOnly ){
|
||||
if( prefixMap != null )
|
||||
|
@ -1385,7 +1385,7 @@ public class CVisitor {
|
|||
ICASTEnumerationSpecifier enumeration = (ICASTEnumerationSpecifier) declSpec;
|
||||
tempName = enumeration.getName();
|
||||
if( scope != null )
|
||||
scope.addName( tempName );
|
||||
ASTInternal.addName( scope, tempName );
|
||||
if( typesOnly ){
|
||||
if( prefixMap != null )
|
||||
prefixMap = (CharArrayObjectMap) collectResult( tempName, n, prefixMap );
|
||||
|
@ -1399,7 +1399,7 @@ public class CVisitor {
|
|||
if( enumerator == null ) break;
|
||||
tempName = enumerator.getName();
|
||||
if( scope != null )
|
||||
scope.addName( tempName );
|
||||
ASTInternal.addName( scope, tempName );
|
||||
if( !typesOnly ){
|
||||
if( prefixMap != null )
|
||||
prefixMap = (CharArrayObjectMap) collectResult( tempName, n, prefixMap );
|
||||
|
@ -1430,7 +1430,7 @@ public class CVisitor {
|
|||
}
|
||||
IASTName tempName = dtor.getName();
|
||||
if( scope != null )
|
||||
scope.addName( tempName );
|
||||
ASTInternal.addName( scope, tempName );
|
||||
|
||||
if( !typesOnly ) {
|
||||
char [] c = tempName.toCharArray();
|
||||
|
@ -1478,7 +1478,7 @@ public class CVisitor {
|
|||
}
|
||||
tempName = declarator.getName();
|
||||
if( scope != null )
|
||||
scope.addName( tempName );
|
||||
ASTInternal.addName( scope, tempName );
|
||||
|
||||
if( !typesOnly ){
|
||||
if( prefixMap != null )
|
||||
|
@ -1498,7 +1498,7 @@ public class CVisitor {
|
|||
IASTDeclarator dtor = functionDef.getDeclarator();
|
||||
tempName = dtor.getName();
|
||||
if( scope != null )
|
||||
scope.addName( tempName );
|
||||
ASTInternal.addName( scope, tempName );
|
||||
|
||||
if( !typesOnly ){
|
||||
if( prefixMap != null )
|
||||
|
|
|
@ -102,6 +102,7 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
|
|||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.BacktrackException;
|
||||
|
@ -583,7 +584,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
|
||||
IBinding[] bindings = new GCCBuiltinSymbolProvider(translationUnit.getScope(), ParserLanguage.C).getBuiltinBindings();
|
||||
for(int i=0; i<bindings.length; i++) {
|
||||
tuScope.addBinding(bindings[i]);
|
||||
ASTInternal.addBinding(tuScope, bindings[i]);
|
||||
}
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
|
@ -1295,7 +1296,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
// backup(mark);
|
||||
// throwBacktrack(bt);
|
||||
}
|
||||
if (declarator == null || declarator.getName().toCharArray().length > 0) //$NON-NLS-1$
|
||||
if (declarator == null || declarator.getName().toCharArray().length > 0)
|
||||
{
|
||||
return null;
|
||||
// backup(mark);
|
||||
|
|
|
@ -59,6 +59,7 @@ import org.eclipse.cdt.core.model.ILanguage;
|
|||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTPreprocessorSelectionResult;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
|
||||
|
@ -145,14 +146,14 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
|
|||
newTheParms[0] = new CPPBuiltinParameter(newParms[0]);
|
||||
temp = new CPPImplicitFunction(ICPPASTOperatorName.OPERATOR_NEW, theScope, newFunctionType, newTheParms, false);
|
||||
try {
|
||||
theScope.addBinding(temp);
|
||||
ASTInternal.addBinding(theScope, temp);
|
||||
} catch (DOMException de) {}
|
||||
|
||||
// void * operator new[] (std::size_t);
|
||||
temp = null;
|
||||
temp = new CPPImplicitFunction(ICPPASTOperatorName.OPERATOR_NEW_ARRAY, theScope, newFunctionType, newTheParms, false);
|
||||
try {
|
||||
theScope.addBinding(temp);
|
||||
ASTInternal.addBinding(theScope, temp);
|
||||
} catch (DOMException de) {}
|
||||
|
||||
// void operator delete(void*);
|
||||
|
@ -164,14 +165,14 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
|
|||
deleteTheParms[0] = new CPPBuiltinParameter(deleteParms[0]);
|
||||
temp = new CPPImplicitFunction(ICPPASTOperatorName.OPERATOR_DELETE, theScope, deleteFunctionType, deleteTheParms, false);
|
||||
try {
|
||||
theScope.addBinding(temp);
|
||||
ASTInternal.addBinding(theScope, temp);
|
||||
} catch (DOMException de) {}
|
||||
|
||||
// void operator delete[](void*);
|
||||
temp = null;
|
||||
temp = new CPPImplicitFunction(ICPPASTOperatorName.OPERATOR_DELETE_ARRAY, theScope, deleteFunctionType, deleteTheParms, false);
|
||||
try {
|
||||
theScope.addBinding(temp);
|
||||
ASTInternal.addBinding(theScope, temp);
|
||||
} catch (DOMException de) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -402,11 +402,11 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
|
|||
IASTDeclarator [] dtors = ((IASTSimpleDeclaration)decl).getDeclarators();
|
||||
for( int j = 0; j < dtors.length; j++ ){
|
||||
if( dtors[j] == null ) break;
|
||||
scope.addName( dtors[j].getName() );
|
||||
ASTInternal.addName(scope, dtors[j].getName() );
|
||||
}
|
||||
} else if( decl instanceof IASTFunctionDefinition ){
|
||||
IASTDeclarator dtor = ((IASTFunctionDefinition)decl).getDeclarator();
|
||||
scope.addName( dtor.getName() );
|
||||
ASTInternal.addName(scope, dtor.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -693,11 +693,11 @@ public class CPPClassType extends PlatformObject implements ICPPClassType, ICPPI
|
|||
IASTDeclarator [] dtors = ((IASTSimpleDeclaration)decl).getDeclarators();
|
||||
for( int j = 0; j < dtors.length; j++ ){
|
||||
if( dtors[j] == null ) break;
|
||||
scope.addName( dtors[j].getName() );
|
||||
ASTInternal.addName(scope, dtors[j].getName() );
|
||||
}
|
||||
} else if( decl instanceof IASTFunctionDefinition ){
|
||||
IASTDeclarator dtor = ((IASTFunctionDefinition)decl).getDeclarator();
|
||||
scope.addName( dtor.getName() );
|
||||
ASTInternal.addName(scope, dtor.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1626,14 +1626,14 @@ public class CPPSemantics {
|
|||
while( dtor.getNestedDeclarator() != null )
|
||||
dtor = dtor.getNestedDeclarator();
|
||||
IASTName declName = dtor.getName();
|
||||
scope.addName( declName );
|
||||
ASTInternal.addName( scope, declName );
|
||||
if( !data.typesOnly && nameMatches( data, declName ) ) {
|
||||
return declName;
|
||||
}
|
||||
}
|
||||
} else if( node instanceof ICPPASTTemplateParameter ){
|
||||
IASTName name = CPPTemplates.getTemplateParameterName( (ICPPASTTemplateParameter) node );
|
||||
scope.addName( name );
|
||||
ASTInternal.addName( scope, name );
|
||||
if( nameMatches( data, name ) ) {
|
||||
return name;
|
||||
}
|
||||
|
@ -1651,7 +1651,7 @@ public class CPPSemantics {
|
|||
while( declarator.getNestedDeclarator() != null )
|
||||
declarator = declarator.getNestedDeclarator();
|
||||
IASTName declaratorName = declarator.getName();
|
||||
scope.addName( declaratorName );
|
||||
ASTInternal.addName( scope, declaratorName );
|
||||
if( !data.typesOnly || simpleDeclaration.getDeclSpecifier().getStorageClass() == IASTDeclSpecifier.sc_typedef ) {
|
||||
if( nameMatches( data, declaratorName ) ) {
|
||||
if( resultName == null )
|
||||
|
@ -1715,7 +1715,7 @@ public class CPPSemantics {
|
|||
IASTEnumerator enumerator = list[i];
|
||||
if( enumerator == null ) break;
|
||||
tempName = enumerator.getName();
|
||||
scope.addName( tempName );
|
||||
ASTInternal.addName( scope, tempName );
|
||||
if( !data.typesOnly && nameMatches( data, tempName ) ) {
|
||||
if( resultName == null )
|
||||
resultName = tempName;
|
||||
|
@ -1727,7 +1727,7 @@ public class CPPSemantics {
|
|||
}
|
||||
}
|
||||
if( specName != null ) {
|
||||
scope.addName( specName );
|
||||
ASTInternal.addName( scope, specName );
|
||||
if( nameMatches( data, specName ) ) {
|
||||
if( resultName == null )
|
||||
resultName = specName;
|
||||
|
@ -1744,18 +1744,18 @@ public class CPPSemantics {
|
|||
IASTName [] ns = ((ICPPASTQualifiedName)name).getNames();
|
||||
name = ns[ ns.length - 1 ];
|
||||
}
|
||||
scope.addName( name );
|
||||
ASTInternal.addName( scope, name );
|
||||
if( nameMatches( data, name ) ) {
|
||||
return name;
|
||||
}
|
||||
} else if( declaration instanceof ICPPASTNamespaceDefinition ){
|
||||
IASTName namespaceName = ((ICPPASTNamespaceDefinition) declaration).getName();
|
||||
scope.addName( namespaceName );
|
||||
ASTInternal.addName( scope, namespaceName );
|
||||
if( nameMatches( data, namespaceName ) )
|
||||
return namespaceName;
|
||||
} else if( declaration instanceof ICPPASTNamespaceAlias ){
|
||||
IASTName alias = ((ICPPASTNamespaceAlias) declaration).getAlias();
|
||||
scope.addName( alias );
|
||||
ASTInternal.addName( scope, alias );
|
||||
if( nameMatches( data, alias ) )
|
||||
return alias;
|
||||
} else if( declaration instanceof IASTFunctionDefinition ){
|
||||
|
@ -1765,7 +1765,7 @@ public class CPPSemantics {
|
|||
|
||||
//check the function itself
|
||||
IASTName declName = declarator.getName();
|
||||
scope.addName( declName );
|
||||
ASTInternal.addName( scope, declName );
|
||||
|
||||
if( !data.typesOnly && nameMatches( data, declName ) ) {
|
||||
return declName;
|
||||
|
|
|
@ -219,7 +219,7 @@ public class CPPVisitor {
|
|||
binding = functionScope.getBinding( name, false );
|
||||
if( binding == null || !(binding instanceof ILabel) ){
|
||||
binding = new CPPLabel( name );
|
||||
functionScope.addName( name );
|
||||
ASTInternal.addName( functionScope, name );
|
||||
}
|
||||
} catch ( DOMException e ) {
|
||||
binding = e.getProblem();
|
||||
|
@ -236,7 +236,7 @@ public class CPPVisitor {
|
|||
binding = functionScope.getBinding( name, false );
|
||||
if( binding == null || !(binding instanceof ILabel) ){
|
||||
binding = new CPPLabel( name );
|
||||
functionScope.addName( name );
|
||||
ASTInternal.addName( functionScope, name );
|
||||
} else {
|
||||
((CPPLabel)binding).setLabelStatement( name );
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ public class CPPVisitor {
|
|||
enumtor = scope.getBinding( enumerator.getName(), false );
|
||||
if( enumtor == null || !( enumtor instanceof IEnumerator ) ){
|
||||
enumtor = new CPPEnumerator( enumerator.getName() );
|
||||
scope.addName( enumerator.getName() );
|
||||
ASTInternal.addName( scope, enumerator.getName() );
|
||||
}
|
||||
} catch ( DOMException e ) {
|
||||
enumtor = e.getProblem();
|
||||
|
@ -271,7 +271,7 @@ public class CPPVisitor {
|
|||
enumeration = scope.getBinding( specifier.getName(), false );
|
||||
if( enumeration == null || !(enumeration instanceof IEnumeration) ){
|
||||
enumeration = new CPPEnumeration( specifier.getName() );
|
||||
scope.addName( specifier.getName() );
|
||||
ASTInternal.addName( scope, specifier.getName() );
|
||||
}
|
||||
} catch ( DOMException e ) {
|
||||
enumeration = e.getProblem();
|
||||
|
@ -357,7 +357,7 @@ public class CPPVisitor {
|
|||
binding = new CPPClassTemplate( name );
|
||||
else
|
||||
binding = new CPPClassType( name );
|
||||
scope.addName( elabType.getName() );
|
||||
ASTInternal.addName( scope, elabType.getName() );
|
||||
}
|
||||
} else if( binding instanceof ICPPInternalBinding ){
|
||||
((ICPPInternalBinding)binding).addDeclaration( elabType );
|
||||
|
@ -398,7 +398,7 @@ public class CPPVisitor {
|
|||
else
|
||||
binding = new CPPClassType( name );
|
||||
if( scope != null )
|
||||
scope.addName( compType.getName() );
|
||||
ASTInternal.addName( scope, compType.getName() );
|
||||
} else {
|
||||
if( binding instanceof ICPPInternalBinding ){
|
||||
ICPPInternalBinding internal = (ICPPInternalBinding) binding;
|
||||
|
@ -423,7 +423,7 @@ public class CPPVisitor {
|
|||
binding = scope.getBinding( namespaceDef.getName(), false );
|
||||
if( binding == null || binding instanceof IProblemBinding ){
|
||||
binding = new CPPNamespace( namespaceDef );
|
||||
scope.addName( namespaceDef.getName() );
|
||||
ASTInternal.addName( scope, namespaceDef.getName() );
|
||||
}
|
||||
} catch ( DOMException e ) {
|
||||
binding = e.getProblem();
|
||||
|
@ -445,7 +445,7 @@ public class CPPVisitor {
|
|||
}
|
||||
if( namespace instanceof ICPPNamespace ) {
|
||||
binding = new CPPNamespaceAlias( alias.getAlias(), (ICPPNamespace) namespace );
|
||||
scope.addName( alias.getAlias() );
|
||||
ASTInternal.addName( scope, alias.getAlias() );
|
||||
} else {
|
||||
binding = new ProblemBinding( alias.getAlias(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND, alias.getAlias().toCharArray() );
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ public class CPPVisitor {
|
|||
|
||||
if( scope != null && binding != null ){
|
||||
try {
|
||||
scope.addName( name );
|
||||
ASTInternal.addName( scope, name );
|
||||
} catch ( DOMException e1 ) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,6 +141,7 @@ import org.eclipse.cdt.core.parser.ParseError;
|
|||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.BacktrackException;
|
||||
|
@ -4642,7 +4643,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
translationUnit.getScope(), ParserLanguage.CPP)
|
||||
.getBuiltinBindings();
|
||||
for (int i = 0; i < bindings.length; i++) {
|
||||
tuScope.addBinding(bindings[i]);
|
||||
ASTInternal.addBinding(tuScope, bindings[i]);
|
||||
}
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
|
|
|
@ -283,11 +283,6 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
|
|||
return this;
|
||||
}
|
||||
|
||||
public void addName(IASTName name) throws DOMException {
|
||||
// TODO - this might be a better way of adding names to scopes
|
||||
// but for now do nothing.
|
||||
}
|
||||
|
||||
public IName getScopeName() throws DOMException {
|
||||
try {
|
||||
PDOMName name = getFirstDefinition();
|
||||
|
@ -323,13 +318,8 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
|
|||
public IField findField(String name) throws DOMException {fail();return null;}
|
||||
public IBinding[] getFriends() throws DOMException {fail();return null;}
|
||||
public ICPPMethod[] getImplicitMethods() {fail(); return null;}
|
||||
public void addBinding(IBinding binding) throws DOMException {fail();}
|
||||
public IBinding[] find(String name) throws DOMException {fail();return null;}
|
||||
public void flushCache() throws DOMException {fail();}
|
||||
public ICPPField[] getDeclaredFields() throws DOMException {fail();return null;}
|
||||
public void removeBinding(IBinding binding) throws DOMException {fail();}
|
||||
public void setFullyCached(boolean b) throws DOMException {fail();}
|
||||
public IASTNode getPhysicalNode() throws DOMException {fail();return null;}
|
||||
|
||||
public IScope getScope() throws DOMException {
|
||||
try {
|
||||
|
|
|
@ -100,6 +100,9 @@ class PDOMCPPNamespace extends PDOMCPPBinding
|
|||
return new IASTNode[0];
|
||||
}
|
||||
|
||||
// mstodo this method currently does not get called, we could try to remove it.
|
||||
// an alternative an appropriate method in CPPSemantics. This implementation is not
|
||||
// correct for sure.
|
||||
public IBinding[] find(String name) throws DOMException {
|
||||
try {
|
||||
FindBindingsInBTree visitor = new FindBindingsInBTree(getLinkageImpl(), name.toCharArray());
|
||||
|
@ -199,12 +202,6 @@ class PDOMCPPNamespace extends PDOMCPPBinding
|
|||
}
|
||||
|
||||
public IBinding[] getMemberBindings() throws DOMException {fail(); return null;}
|
||||
public IASTNode getPhysicalNode() throws DOMException {fail(); return null;}
|
||||
public IName getScopeName() throws DOMException {fail(); return null;}
|
||||
public void removeBinding(IBinding binding) throws DOMException {fail();}
|
||||
public void setFullyCached(boolean b) throws DOMException {fail();}
|
||||
public void flushCache() throws DOMException {fail();}
|
||||
public void addUsingDirective(IASTNode directive) throws DOMException {fail();}
|
||||
public void addBinding(IBinding binding) throws DOMException {fail();}
|
||||
public void addName(IASTName name) throws DOMException {fail();}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue