1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

bug 89389

This commit is contained in:
Andrew Niefer 2005-03-30 20:20:41 +00:00
parent 82b1a286d2
commit f25c314c0a
23 changed files with 94 additions and 69 deletions

View file

@ -33,6 +33,11 @@ public interface IProblemBinding extends IBinding, IScope, IType {
*/
String getMessage();
/**
* get the AST node that this problem was created for
* @return
*/
public IASTNode getASTNode();
/*
* Parser Semantic Problems
* All Semantic problems take a char[] as an argument

View file

@ -32,12 +32,17 @@ import org.eclipse.cdt.internal.core.parser.ParserMessages;
public class ProblemBinding implements IProblemBinding, IType, IScope {
private final int id;
private final char [] arg;
private IASTNode node;
private String message = null;
public ProblemBinding( int id, char [] arg ){
public ProblemBinding( IASTNode node, int id, char [] arg ){
this.id = id;
this.arg = arg;
this.node = node;
}
public IASTNode getASTNode(){
return node;
}
protected final static String PROBLEM_PATTERN = "BaseProblemFactory.problemPattern"; //$NON-NLS-1$

View file

@ -123,7 +123,7 @@ public class CEnumeration implements IEnumeration {
if( definition == null ){
checkForDefinition();
if( definition == null )
return new IEnumerator[] { new CEnumerator.CEnumeratorProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, declarations[0].toCharArray() ) };
return new IEnumerator[] { new CEnumerator.CEnumeratorProblem( declarations[0], IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, declarations[0].toCharArray() ) };
}
IASTEnumerationSpecifier enumSpec = (IASTEnumerationSpecifier) definition.getParent();

View file

@ -30,8 +30,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
*/
public class CEnumerator implements IEnumerator {
public static class CEnumeratorProblem extends ProblemBinding implements IEnumerator {
public CEnumeratorProblem( int id, char[] arg ) {
super( id, arg );
public CEnumeratorProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public IType getType() throws DOMException {

View file

@ -12,6 +12,7 @@
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IField;
/**
@ -20,8 +21,8 @@ import org.eclipse.cdt.core.dom.ast.IField;
*/
public class CField extends CVariable implements IField {
public static class CFieldProblem extends CVariable.CVariableProblem implements IField {
public CFieldProblem( int id, char[] arg ) {
super( id, arg );
public CFieldProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
}
/**

View file

@ -125,7 +125,7 @@ public class CFunction implements IFunction, ICInternalBinding {
if( decl != null ) {
result[i] = (IParameter) decl.getName().resolveBinding();
} else {
result[i] = new CParameter.CParameterProblem( IProblemBinding.SEMANTIC_KNR_PARAMETER_DECLARATION_NOT_FOUND, names[i].toCharArray() );
result[i] = new CParameter.CParameterProblem( names[i], IProblemBinding.SEMANTIC_KNR_PARAMETER_DECLARATION_NOT_FOUND, names[i].toCharArray() );
}
}
}

View file

@ -28,8 +28,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
public class CLabel implements ILabel {
public static class CLabelProblem extends ProblemBinding implements ILabel {
public CLabelProblem( int id, char[] arg ) {
super( id, arg );
public CLabelProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public IASTLabelStatement getLabelStatement() throws DOMException{

View file

@ -31,8 +31,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
*/
public class CParameter implements IParameter {
public static class CParameterProblem extends ProblemBinding implements IParameter {
public CParameterProblem( int id, char[] arg ) {
super( id, arg );
public CParameterProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public IType getType() throws DOMException {

View file

@ -95,7 +95,7 @@ public class CStructure implements ICompositeType, ICInternalBinding {
if( definition == null ){
ICASTCompositeTypeSpecifier temp = checkForDefinition( (IASTElaboratedTypeSpecifier) declarations[0].getParent() );
if( temp == null )
return new IField [] { new CField.CFieldProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
return new IField [] { new CField.CFieldProblem( declarations[0], IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
definition = temp.getName();
}
ICASTCompositeTypeSpecifier compSpec = (ICASTCompositeTypeSpecifier) definition.getParent();
@ -134,7 +134,7 @@ public class CStructure implements ICompositeType, ICInternalBinding {
if( definition == null ){
ICASTCompositeTypeSpecifier temp = checkForDefinition( (IASTElaboratedTypeSpecifier) declarations[0].getParent() );
if( temp == null )
return new CField.CFieldProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() );
return new CField.CFieldProblem( declarations[0], IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() );
definition = temp.getName();
}

View file

@ -29,8 +29,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
*/
public class CVariable implements IVariable, ICInternalBinding {
public static class CVariableProblem extends ProblemBinding implements IVariable {
public CVariableProblem( int id, char[] arg ) {
super( id, arg );
public CVariableProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public IType getType() throws DOMException {

View file

@ -475,7 +475,7 @@ public class CVisitor {
if( binding instanceof CEnumeration )
((CEnumeration)binding).addDefinition( name );
else
return new ProblemBinding(IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
return new ProblemBinding( name, IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
} else {
binding = new CEnumeration( name );
try {
@ -507,7 +507,7 @@ public class CVisitor {
}
}
//label not found
return new CLabel.CLabelProblem( IProblemBinding.SEMANTIC_LABEL_STATEMENT_NOT_FOUND, gotoName );
return new CLabel.CLabelProblem( ((IASTGotoStatement)statement).getName(), IProblemBinding.SEMANTIC_LABEL_STATEMENT_NOT_FOUND, gotoName );
}
} else if( statement instanceof IASTLabelStatement ){
IASTName name = ((IASTLabelStatement)statement).getName();
@ -655,7 +655,7 @@ public class CVisitor {
if( binding instanceof IFunction )
((CFunction)binding).addDeclarator( (IASTStandardFunctionDeclarator) declarator );
else
binding = new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
binding = new ProblemBinding( name, IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
} else {
binding = createBinding(declarator);
}
@ -666,7 +666,7 @@ public class CVisitor {
if( binding instanceof IFunction )
((CFunction)binding).addDeclarator( (ICASTKnRFunctionDeclarator) declarator );
else
binding = new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
binding = new ProblemBinding( name, IProblemBinding.SEMANTIC_INVALID_OVERLOAD, name.toCharArray() );
} else {
binding = createBinding(declarator);
}

View file

@ -15,6 +15,7 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
@ -27,8 +28,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
*/
public class CPPBaseClause implements ICPPBase {
static public class CPPBaseProblem extends ProblemBinding implements ICPPBase {
public CPPBaseProblem( int id, char[] arg ) {
super( id, arg );
public CPPBaseProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public ICPPClassType getBaseClass() throws DOMException {
throw new DOMException( this );
@ -56,10 +57,10 @@ public class CPPBaseClause implements ICPPBase {
if( baseClass instanceof ICPPClassType )
return (ICPPClassType) baseClass;
else if( baseClass instanceof IProblemBinding ){
return new CPPClassType.CPPClassTypeProblem( ((IProblemBinding)baseClass).getID(), base.getName().toCharArray() );
return new CPPClassType.CPPClassTypeProblem( base.getName(), ((IProblemBinding)baseClass).getID(), base.getName().toCharArray() );
}
return new CPPClassType.CPPClassTypeProblem( IProblemBinding.SEMANTIC_NAME_NOT_FOUND, base.getName().toCharArray() );
return new CPPClassType.CPPClassTypeProblem( base.getName(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND, base.getName().toCharArray() );
}
/* (non-Javadoc)

View file

@ -239,7 +239,7 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
*/
public ICPPMethod[] getImplicitMethods() {
if( implicits == null )
implicits = new ICPPMethod[] { new CPPMethod.CPPMethodProblem( IProblemBinding.SEMANTIC_INVALID_TYPE, CPPSemantics.EMPTY_NAME_ARRAY ) };
implicits = new ICPPMethod[] { new CPPMethod.CPPMethodProblem( null, IProblemBinding.SEMANTIC_INVALID_TYPE, CPPSemantics.EMPTY_NAME_ARRAY ) };
return implicits;
}

View file

@ -98,8 +98,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
}
}
public static class CPPClassTypeProblem extends ProblemBinding implements ICPPClassType{
public CPPClassTypeProblem( int id, char[] arg ) {
super( id, arg );
public CPPClassTypeProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public ICPPBase[] getBases() throws DOMException {
@ -249,8 +249,10 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
public IField[] getFields() throws DOMException {
if( definition == null ){
checkForDefinition();
if( definition == null )
return new IField [] { new CPPField.CPPFieldProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
if( definition == null ){
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
return new IField [] { new CPPField.CPPFieldProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
}
}
IField[] fields = getDeclaredFields();
@ -272,7 +274,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
if( field == null )
field = (IField) bindings[i];
else {
return new CPPField.CPPFieldProblem( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, name.toCharArray() );
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
return new CPPField.CPPFieldProblem( node, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, name.toCharArray() );
}
}
}
@ -369,7 +372,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
if( definition == null ){
checkForDefinition();
if( definition == null ){
return new ICPPBase [] { new CPPBaseClause.CPPBaseProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
return new ICPPBase [] { new CPPBaseClause.CPPBaseProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
}
}
ICPPASTBaseSpecifier [] bases = getCompositeTypeSpecifier().getBaseSpecifiers();
@ -391,7 +395,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
if( definition == null ){
checkForDefinition();
if( definition == null ){
return new ICPPField[] { new CPPField.CPPFieldProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
return new ICPPField[] { new CPPField.CPPFieldProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
}
}
IBinding binding = null;
@ -445,8 +450,10 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
public ICPPMethod[] getAllDeclaredMethods() throws DOMException {
if( definition == null ){
checkForDefinition();
if( definition == null )
return new ICPPMethod [] { new CPPMethod.CPPMethodProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
if( definition == null ){
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
return new ICPPMethod [] { new CPPMethod.CPPMethodProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
}
}
ICPPMethod[] methods = getDeclaredMethods();
@ -464,7 +471,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
if( definition == null ){
checkForDefinition();
if( definition == null ){
return new ICPPMethod[] { new CPPMethod.CPPMethodProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
return new ICPPMethod[] { new CPPMethod.CPPMethodProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
}
}
IBinding binding = null;
@ -520,7 +528,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
if( definition == null ){
checkForDefinition();
if( definition == null ){
return new ICPPConstructor [] { new CPPConstructor.CPPConstructorProblem( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
return new ICPPConstructor [] { new CPPConstructor.CPPConstructorProblem( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
}
}
@ -552,7 +561,8 @@ public class CPPClassType implements ICPPClassType, ICPPInternalBinding {
if( definition == null ){
checkForDefinition();
if( definition == null ){
return new IBinding [] { new ProblemBinding( IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
IASTNode node = (declarations != null && declarations.length > 0) ? declarations[0] : null;
return new IBinding [] { new ProblemBinding( node, IProblemBinding.SEMANTIC_DEFINITION_NOT_FOUND, getNameCharArray() ) };
}
}
ObjectSet resultSet = new ObjectSet(2);

View file

@ -14,6 +14,7 @@
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
@ -23,8 +24,8 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
public class CPPConstructor extends CPPMethod implements ICPPConstructor {
static public class CPPConstructorProblem extends CPPMethod.CPPMethodProblem implements ICPPConstructor {
public CPPConstructorProblem( int id, char[] arg ) {
super( id, arg );
public CPPConstructorProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public boolean isExplicit() throws DOMException{

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
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.cpp.ICPPDelegate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
@ -35,8 +36,8 @@ public class CPPField extends CPPVariable implements ICPPField, ICPPInternalBind
* @param id
* @param arg
*/
public CPPFieldProblem( int id, char[] arg ) {
super( id, arg );
public CPPFieldProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public int getVisibility() throws DOMException {

View file

@ -62,8 +62,8 @@ public class CPPFunction implements ICPPFunction, ICPPInternalBinding {
}
}
public static class CPPFunctionProblem extends ProblemBinding implements ICPPFunction {
public CPPFunctionProblem( int id, char[] arg ) {
super( id, arg );
public CPPFunctionProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public IParameter[] getParameters() throws DOMException {

View file

@ -19,6 +19,7 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
@ -48,8 +49,8 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
* @param id
* @param arg
*/
public CPPMethodProblem( int id, char[] arg ) {
super( id, arg );
public CPPMethodProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public int getVisibility() throws DOMException {

View file

@ -77,7 +77,7 @@ public class CPPPointerToMemberType extends CPPPointerType implements
if( binding instanceof ICPPClassType ){
clsType = (ICPPClassType) binding;
} else {
clsType = new CPPClassType.CPPClassTypeProblem( IProblemBinding.SEMANTIC_INVALID_TYPE, name.toCharArray() );
clsType = new CPPClassType.CPPClassTypeProblem( name, IProblemBinding.SEMANTIC_INVALID_TYPE, name.toCharArray() );
}
}
return clsType;

View file

@ -31,8 +31,8 @@ import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
*/
abstract public class CPPScope implements ICPPScope{
public static class CPPScopeProblem extends ProblemBinding implements ICPPScope {
public CPPScopeProblem( int id, char[] arg ) {
super( id, arg );
public CPPScopeProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public void addName( IASTName name ) throws DOMException {
throw new DOMException( this );
@ -59,8 +59,8 @@ abstract public class CPPScope implements ICPPScope{
}
}
public static class CPPTemplateProblem extends CPPScopeProblem {
public CPPTemplateProblem(int id, char[] arg) {
super(id, arg);
public CPPTemplateProblem( IASTNode node, int id, char[] arg) {
super( node, id, arg);
}
}

View file

@ -467,7 +467,7 @@ public class CPPSemantics {
}
if( data.astName.getPropertyInParent() == IASTNamedTypeSpecifier.NAME && !( binding instanceof IType || binding instanceof ICPPConstructor) ){
binding = new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_TYPE, data.name );
binding = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_INVALID_TYPE, data.name );
}
if( binding != null && !( binding instanceof IProblemBinding ) ){
@ -476,7 +476,7 @@ public class CPPSemantics {
}
}
if( binding == null )
binding = new ProblemBinding(IProblemBinding.SEMANTIC_NAME_NOT_FOUND, data.name );
binding = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, data.name );
return binding;
}
@ -807,7 +807,7 @@ public class CPPSemantics {
visitVirtualBaseClasses( data, cls );
}
} else {
data.problem = new ProblemBinding( IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, bases[i].getName().toCharArray() );
data.problem = new ProblemBinding( bases[i].getName(), IProblemBinding.SEMANTIC_CIRCULAR_INHERITANCE, bases[i].getName().toCharArray() );
return null;
}
}
@ -821,13 +821,13 @@ public class CPPSemantics {
Object [] r = (Object[]) result;
for( int j = 0; j < r.length && r[j] != null; j++ ) {
if( checkForAmbiguity( r[j], inherited ) ){
data.problem = new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
data.problem = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
return null;
}
}
} else {
if( checkForAmbiguity( result, inherited ) ){
data.problem = new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
data.problem = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
return null;
}
}
@ -1377,7 +1377,7 @@ public class CPPSemantics {
if( type == null ){
type = temp;
} else if( type != temp ) {
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
}
} else if( temp instanceof IFunction ){
fns = (IFunction[]) ArrayUtil.append( IFunction.class, fns, temp );
@ -1385,14 +1385,14 @@ public class CPPSemantics {
if( obj == null )
obj = temp;
else if( obj != temp ){
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
}
}
}
if( data.forUsingDeclaration() ){
IBinding [] bindings = null;
if( obj != null ){
if( fns != null ) return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
if( fns != null ) return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
// if( type == null ) return obj;
bindings = (IBinding[]) ArrayUtil.append( IBinding.class, bindings, obj );
bindings = (IBinding[]) ArrayUtil.append( IBinding.class, bindings, type );
@ -1412,7 +1412,7 @@ public class CPPSemantics {
}
if( fns != null){
if( obj != null )
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
return resolveFunction( data, fns );
}
@ -1690,7 +1690,7 @@ public class CPPSemantics {
if( ambiguous || bestHasAmbiguousParam ){
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
}
return bestFn;
@ -1724,7 +1724,7 @@ public class CPPSemantics {
while( type != null ){
type = (type != null) ? getUltimateType( type, false ) : null;
if( type == null || !( type instanceof IFunctionType ) )
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
for( int i = 0; i < fns.length; i++ ){
IFunction fn = (IFunction) fns[i];
@ -1738,7 +1738,7 @@ public class CPPSemantics {
if( result == null )
result = fn;
else
return new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
}
}
@ -1749,7 +1749,7 @@ public class CPPSemantics {
}
}
return ( result != null ) ? result : new ProblemBinding( IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
return ( result != null ) ? result : new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
}
private static Object getTargetType( LookupData data ){

View file

@ -45,8 +45,8 @@ public class CPPVariable implements ICPPVariable, ICPPInternalBinding {
}
}
public static class CPPVariableProblem extends ProblemBinding implements ICPPVariable{
public CPPVariableProblem( int id, char[] arg ) {
super( id, arg );
public CPPVariableProblem( IASTNode node, int id, char[] arg ) {
super( node, id, arg );
}
public IType getType() throws DOMException {

View file

@ -367,7 +367,7 @@ public class CPPVisitor {
binding = new CPPNamespaceAlias( alias.getAlias(), (ICPPNamespace) namespace );
scope.addName( alias.getAlias() );
} else {
binding = new ProblemBinding( IProblemBinding.SEMANTIC_NAME_NOT_FOUND, alias.getAlias().toCharArray() );
binding = new ProblemBinding( alias.getAlias(), IProblemBinding.SEMANTIC_NAME_NOT_FOUND, alias.getAlias().toCharArray() );
}
}
} catch( DOMException e ){
@ -494,7 +494,7 @@ public class CPPVisitor {
if( t1.equals( t2 ) ){
((CPPVariable)binding).addDeclaration( declarator.getName() );
} else {
binding = new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_REDECLARATION, declarator.getName().toCharArray() );
binding = new ProblemBinding( declarator.getName(), IProblemBinding.SEMANTIC_INVALID_REDECLARATION, declarator.getName().toCharArray() );
}
} else if( simpleDecl.getParent() instanceof ICPPASTCompositeTypeSpecifier ){
binding = new CPPField( declarator.getName() );
@ -637,7 +637,7 @@ public class CPPVisitor {
} else if( binding instanceof IProblemBinding ){
if( binding instanceof ICPPScope )
return (IScope) binding;
return new CPPScope.CPPScopeProblem( IProblemBinding.SEMANTIC_BAD_SCOPE, names[i-1].toCharArray() );
return new CPPScope.CPPScopeProblem( names[i-1], IProblemBinding.SEMANTIC_BAD_SCOPE, names[i-1].toCharArray() );
}
}
else if( ((ICPPASTQualifiedName)parent).isFullyQualified() )
@ -1481,7 +1481,7 @@ public class CPPVisitor {
return e.getProblem();
}
}
return new ProblemBinding( IProblemBinding.SEMANTIC_INVALID_TYPE, new char[0] );
return new ProblemBinding( binary, IProblemBinding.SEMANTIC_INVALID_TYPE, new char[0] );
}
return type;
}