mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 03:15:33 +02:00
Patch for Hoda Amer
Core: - Changed the ASTExpression of the complete package to store the whole ITokenDuple for the typeId instead of just the string. - Changed the ASTExpression in both quick and complete packages and deleted the "id" parameter. - Added partial solution to bug #42453: Exception result types not computed. Now they are computed for simple types only. Tests: Call to ASTExpression getTypeId() changed to getTypeIdString(). UI: Solution to bug#42414 :Extraneous semi-colons in generated class methods
This commit is contained in:
parent
5022fcb844
commit
1c6c93560a
12 changed files with 156 additions and 102 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
2003-09-04 Hoda Amer
|
||||||
|
Call to ASTExpression getTypeId() changed to getTypeIdString().
|
||||||
|
|
||||||
2003-09-03 Andrew Niefer
|
2003-09-03 Andrew Niefer
|
||||||
Modified ParserSymbolTableTest.testConstructors to test > 2 constructors
|
Modified ParserSymbolTableTest.testConstructors to test > 2 constructors
|
||||||
|
|
||||||
|
|
|
@ -1429,7 +1429,7 @@ public class QuickParseASTTests extends BaseASTTest
|
||||||
assertFalse( enumerators.hasNext() );
|
assertFalse( enumerators.hasNext() );
|
||||||
assertEquals( enumerator.getName(), "isPointer");
|
assertEquals( enumerator.getName(), "isPointer");
|
||||||
assertEquals( enumerator.getInitialValue().getExpressionKind(), IASTExpression.Kind.ID_EXPRESSION );
|
assertEquals( enumerator.getInitialValue().getExpressionKind(), IASTExpression.Kind.ID_EXPRESSION );
|
||||||
assertEquals( enumerator.getInitialValue().getTypeId(), "PointerTraits<T>::result");
|
assertEquals( enumerator.getInitialValue().getTypeIdString(), "PointerTraits<T>::result");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug36690() throws Exception {
|
public void testBug36690() throws Exception {
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
2003-09-04 Hoda Amer
|
||||||
|
- Changed the ASTExpression of the complete package to store the
|
||||||
|
whole ITOkenDuple for the typeId instead of just the string.
|
||||||
|
- Changed the ASTExpression in both quick and complete packages and
|
||||||
|
deleted the "id" parameter.
|
||||||
|
- Added partial solution to bug #42453: Exception result types not computed.
|
||||||
|
Now they are computed for simple types only.
|
||||||
|
|
||||||
2003-09-03 David Inglis
|
2003-09-03 David Inglis
|
||||||
Added shared preference key for error parsers
|
Added shared preference key for error parsers
|
||||||
|
|
||||||
|
|
|
@ -136,8 +136,7 @@ public interface IASTExpression extends ISourceElementCallbackDelegate
|
||||||
public IASTExpression getRHSExpression();
|
public IASTExpression getRHSExpression();
|
||||||
public IASTExpression getThirdExpression();
|
public IASTExpression getThirdExpression();
|
||||||
public String getLiteralString();
|
public String getLiteralString();
|
||||||
public String getTypeId();
|
public String getTypeIdString();
|
||||||
public String getId();
|
|
||||||
public IASTNewExpressionDescriptor getNewExpressionDescriptor();
|
public IASTNewExpressionDescriptor getNewExpressionDescriptor();
|
||||||
|
|
||||||
public int evaluateExpression() throws ExpressionEvaluationException;
|
public int evaluateExpression() throws ExpressionEvaluationException;
|
||||||
|
|
|
@ -103,7 +103,6 @@ public interface IASTFactory
|
||||||
IASTExpression lhs,
|
IASTExpression lhs,
|
||||||
IASTExpression rhs,
|
IASTExpression rhs,
|
||||||
IASTExpression thirdExpression,
|
IASTExpression thirdExpression,
|
||||||
IToken id,
|
|
||||||
ITokenDuple typeId,
|
ITokenDuple typeId,
|
||||||
String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException;
|
String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException;
|
||||||
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions);
|
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions);
|
||||||
|
|
|
@ -2743,7 +2743,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -2827,7 +2826,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -2861,7 +2859,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -2894,7 +2891,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
thirdExpression,
|
thirdExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -2929,7 +2925,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -2962,7 +2957,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -2996,7 +2990,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3030,7 +3023,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3063,7 +3055,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3104,7 +3095,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3181,7 +3171,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3225,7 +3214,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3268,7 +3256,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3322,7 +3309,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3364,7 +3350,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3413,7 +3398,6 @@ public class Parser implements IParser
|
||||||
castExpression,
|
castExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
duple,
|
duple,
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
|
@ -3527,7 +3511,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3660,7 +3643,7 @@ public class Parser implements IParser
|
||||||
{
|
{
|
||||||
return astFactory.createExpression(
|
return astFactory.createExpression(
|
||||||
scope, IASTExpression.Kind.NEW_TYPEID,
|
scope, IASTExpression.Kind.NEW_TYPEID,
|
||||||
null, null, null, null, typeId, "",
|
null, null, null, typeId, "",
|
||||||
astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
|
astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3705,7 +3688,7 @@ public class Parser implements IParser
|
||||||
{
|
{
|
||||||
return astFactory.createExpression(
|
return astFactory.createExpression(
|
||||||
scope, IASTExpression.Kind.NEW_TYPEID,
|
scope, IASTExpression.Kind.NEW_TYPEID,
|
||||||
null, null, null, null, typeId, "",
|
null, null, null, typeId, "",
|
||||||
astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
|
astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3729,7 +3712,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -3811,7 +3793,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
d,
|
d,
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
|
@ -3830,7 +3811,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e1)
|
catch (ASTSemanticException e1)
|
||||||
|
@ -3970,7 +3950,6 @@ public class Parser implements IParser
|
||||||
lhs,
|
lhs,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
typeId,
|
typeId,
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
|
@ -4003,7 +3982,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e2)
|
catch (ASTSemanticException e2)
|
||||||
|
@ -4027,7 +4005,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e3)
|
catch (ASTSemanticException e3)
|
||||||
|
@ -4048,7 +4025,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e1)
|
catch (ASTSemanticException e1)
|
||||||
|
@ -4069,7 +4045,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e4)
|
catch (ASTSemanticException e4)
|
||||||
|
@ -4099,7 +4074,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e5)
|
catch (ASTSemanticException e5)
|
||||||
|
@ -4129,7 +4103,6 @@ public class Parser implements IParser
|
||||||
secondExpression,
|
secondExpression,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -4163,7 +4136,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -4189,7 +4161,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
@ -4220,7 +4191,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
t.getImage(), null);
|
t.getImage(), null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e1)
|
catch (ASTSemanticException e1)
|
||||||
|
@ -4239,7 +4209,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
t.getImage(), null);
|
t.getImage(), null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e2)
|
catch (ASTSemanticException e2)
|
||||||
|
@ -4252,7 +4221,7 @@ public class Parser implements IParser
|
||||||
t = consume();
|
t = consume();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return astFactory.createExpression( scope, IASTExpression.Kind.PRIMARY_STRING_LITERAL, null, null, null, null, null, t.getImage(), null );
|
return astFactory.createExpression( scope, IASTExpression.Kind.PRIMARY_STRING_LITERAL, null, null, null, null, t.getImage(), null );
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e5)
|
catch (ASTSemanticException e5)
|
||||||
{
|
{
|
||||||
|
@ -4272,7 +4241,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
t.getImage(), null);
|
t.getImage(), null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e3)
|
catch (ASTSemanticException e3)
|
||||||
|
@ -4294,7 +4262,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
t.getImage(), null);
|
t.getImage(), null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e4)
|
catch (ASTSemanticException e4)
|
||||||
|
@ -4314,7 +4281,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e7)
|
catch (ASTSemanticException e7)
|
||||||
|
@ -4335,7 +4301,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e6)
|
catch (ASTSemanticException e6)
|
||||||
|
@ -4353,7 +4318,6 @@ public class Parser implements IParser
|
||||||
IASTExpression.Kind.ID_EXPRESSION,
|
IASTExpression.Kind.ID_EXPRESSION,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
null,
|
null,
|
||||||
duple,
|
duple,
|
||||||
"", null);
|
"", null);
|
||||||
|
@ -4373,7 +4337,6 @@ public class Parser implements IParser
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
|
||||||
"", null);
|
"", null);
|
||||||
}
|
}
|
||||||
catch (ASTSemanticException e)
|
catch (ASTSemanticException e)
|
||||||
|
|
|
@ -10,9 +10,11 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.parser.ast.complete;
|
package org.eclipse.cdt.internal.core.parser.ast.complete;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||||
|
import org.eclipse.cdt.core.parser.ITokenDuple;
|
||||||
import org.eclipse.cdt.core.parser.ast.ExpressionEvaluationException;
|
import org.eclipse.cdt.core.parser.ast.ExpressionEvaluationException;
|
||||||
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
import org.eclipse.cdt.core.parser.ast.IASTExpression;
|
||||||
|
|
||||||
|
@ -27,15 +29,15 @@ public class ASTExpression implements IASTExpression
|
||||||
private final IASTExpression rhs;
|
private final IASTExpression rhs;
|
||||||
private final IASTExpression thirdExpression;
|
private final IASTExpression thirdExpression;
|
||||||
private final String literal;
|
private final String literal;
|
||||||
private final String typeId;
|
private final ITokenDuple typeId;
|
||||||
private final String id;
|
|
||||||
private final IASTNewExpressionDescriptor newDescriptor;
|
private final IASTNewExpressionDescriptor newDescriptor;
|
||||||
private final List references;
|
private final List references;
|
||||||
|
private List resultType;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public ASTExpression( Kind kind, IASTExpression lhs, IASTExpression rhs,
|
public ASTExpression( Kind kind, IASTExpression lhs, IASTExpression rhs,
|
||||||
IASTExpression thirdExpression, String literal, String typeId, String id, IASTNewExpressionDescriptor newDescriptor, List references )
|
IASTExpression thirdExpression, ITokenDuple typeId, String literal, IASTNewExpressionDescriptor newDescriptor, List references )
|
||||||
{
|
{
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.lhs = lhs;
|
this.lhs = lhs;
|
||||||
|
@ -43,9 +45,9 @@ public class ASTExpression implements IASTExpression
|
||||||
this.thirdExpression = thirdExpression;
|
this.thirdExpression = thirdExpression;
|
||||||
this.literal = literal;
|
this.literal = literal;
|
||||||
this.typeId = typeId;
|
this.typeId = typeId;
|
||||||
this.id = id;
|
|
||||||
this.newDescriptor = newDescriptor;
|
this.newDescriptor = newDescriptor;
|
||||||
this.references = references;
|
this.references = references;
|
||||||
|
resultType = new ArrayList();
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getExpressionKind()
|
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getExpressionKind()
|
||||||
|
@ -85,17 +87,17 @@ public class ASTExpression implements IASTExpression
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getTypeId()
|
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getTypeId()
|
||||||
*/
|
*/
|
||||||
public String getTypeId()
|
public String getTypeIdString()
|
||||||
|
{
|
||||||
|
return typeId == null ? "" : typeId.toString();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* returns the type id token
|
||||||
|
*/
|
||||||
|
public ITokenDuple getTypeId()
|
||||||
{
|
{
|
||||||
return typeId;
|
return typeId;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getId()
|
|
||||||
*/
|
|
||||||
public String getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getNewExpressionDescriptor()
|
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getNewExpressionDescriptor()
|
||||||
*/
|
*/
|
||||||
|
@ -139,4 +141,18 @@ public class ASTExpression implements IASTExpression
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List getResultType() {
|
||||||
|
return resultType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param i
|
||||||
|
*/
|
||||||
|
public void setResultType(List i) {
|
||||||
|
resultType = i;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,11 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, List references, boolean throwOnError ) throws ASTSemanticException
|
protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, List references, boolean throwOnError ) throws ASTSemanticException{
|
||||||
|
return lookupQualifiedName(startingScope, name, TypeInfo.t_any, null, references, throwOnError);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ISymbol lookupQualifiedName( IContainerSymbol startingScope, ITokenDuple name, TypeInfo.eType type, List parameters, List references, boolean throwOnError ) throws ASTSemanticException
|
||||||
{
|
{
|
||||||
ISymbol result = null;
|
ISymbol result = null;
|
||||||
IToken firstSymbol = null;
|
IToken firstSymbol = null;
|
||||||
|
@ -143,6 +147,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
firstSymbol = name.getFirstToken();
|
firstSymbol = name.getFirstToken();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if(type == TypeInfo.t_function)
|
||||||
|
result = startingScope.unqualifiedFunctionLookup( firstSymbol.getImage(), new LinkedList(parameters));
|
||||||
|
else
|
||||||
result = startingScope.lookup( firstSymbol.getImage());
|
result = startingScope.lookup( firstSymbol.getImage());
|
||||||
if( result != null )
|
if( result != null )
|
||||||
references.add( createReference( result, firstSymbol.getImage(), firstSymbol.getOffset() ));
|
references.add( createReference( result, firstSymbol.getImage(), firstSymbol.getOffset() ));
|
||||||
|
@ -160,6 +167,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
throw new ASTSemanticException();
|
throw new ASTSemanticException();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if(type == TypeInfo.t_function)
|
||||||
|
result = pst.getCompilationUnit().unqualifiedFunctionLookup( name.getLastToken().getImage(), new LinkedList(parameters));
|
||||||
|
else
|
||||||
result = pst.getCompilationUnit().lookup( name.getLastToken().getImage() );
|
result = pst.getCompilationUnit().lookup( name.getLastToken().getImage() );
|
||||||
references.add( createReference( result, name.getLastToken().getImage(), name.getLastToken().getOffset() ));
|
references.add( createReference( result, name.getLastToken().getImage(), name.getLastToken().getOffset() ));
|
||||||
}
|
}
|
||||||
|
@ -181,6 +191,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( t == name.getLastToken() )
|
if( t == name.getLastToken() )
|
||||||
|
if(type == TypeInfo.t_function)
|
||||||
|
result = ((IContainerSymbol)result).qualifiedFunctionLookup( t.getImage(), new LinkedList(parameters) );
|
||||||
|
else
|
||||||
result = ((IContainerSymbol)result).qualifiedLookup( t.getImage() );
|
result = ((IContainerSymbol)result).qualifiedLookup( t.getImage() );
|
||||||
else
|
else
|
||||||
result = ((IContainerSymbol)result).lookupNestedNameSpecifier( t.getImage() );
|
result = ((IContainerSymbol)result).lookupNestedNameSpecifier( t.getImage() );
|
||||||
|
@ -391,9 +404,6 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
{
|
{
|
||||||
extension.addDefinition( astSymbol );
|
extension.addDefinition( astSymbol );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -670,7 +680,6 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
IASTExpression lhs,
|
IASTExpression lhs,
|
||||||
IASTExpression rhs,
|
IASTExpression rhs,
|
||||||
IASTExpression thirdExpression,
|
IASTExpression thirdExpression,
|
||||||
IToken id,
|
|
||||||
ITokenDuple typeId,
|
ITokenDuple typeId,
|
||||||
String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException
|
String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException
|
||||||
{
|
{
|
||||||
|
@ -700,32 +709,94 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
||||||
//look up id & add to references
|
//look up id & add to references
|
||||||
IContainerSymbol startingScope = scopeToSymbol( scope );
|
IContainerSymbol startingScope = scopeToSymbol( scope );
|
||||||
|
|
||||||
if( id != null )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ISymbol s = startingScope.lookup( id.getImage() );
|
|
||||||
if( s != null )
|
|
||||||
references.add( createReference( s, id.getImage(), id.getOffset() ));
|
|
||||||
else
|
|
||||||
throw new ASTSemanticException();
|
|
||||||
}
|
|
||||||
catch (ParserSymbolTableException e)
|
|
||||||
{
|
|
||||||
throw new ASTSemanticException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//look up typeId & add to references
|
//look up typeId & add to references
|
||||||
if( typeId != null )
|
if( typeId != null )
|
||||||
lookupQualifiedName( startingScope, typeId, references, false );
|
lookupQualifiedName( startingScope, typeId, references, false );
|
||||||
|
|
||||||
return new ASTExpression( kind, lhs, rhs, thirdExpression,
|
if (kind == IASTExpression.Kind.POSTFIX_FUNCTIONCALL){
|
||||||
id == null ? "" : id.getImage(),
|
ITokenDuple functionId = ((ASTExpression)lhs).getTypeId();
|
||||||
typeId == null ? "" : typeId.toString(),
|
List parameters = ((ASTExpression)rhs).getResultType();
|
||||||
literal, newDescriptor, references);
|
lookupQualifiedName(startingScope, functionId, TypeInfo.t_function, parameters, references, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASTExpression expression = new ASTExpression( kind, lhs, rhs, thirdExpression,
|
||||||
|
typeId, literal, newDescriptor, references);
|
||||||
|
|
||||||
|
expression.setResultType (getExpressionResultType(expression));
|
||||||
|
|
||||||
|
return expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected List getExpressionResultType(IASTExpression expression){
|
||||||
|
List result = new ArrayList();
|
||||||
|
|
||||||
|
if (expression.getExpressionKind() == IASTExpression.Kind.PRIMARY_EMPTY) {
|
||||||
|
TypeInfo info = new TypeInfo();
|
||||||
|
info.setType(TypeInfo.t_void);
|
||||||
|
result.add(info);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (expression.getExpressionKind() == IASTExpression.Kind.PRIMARY_INTEGER_LITERAL) {
|
||||||
|
TypeInfo info = new TypeInfo();
|
||||||
|
info.setType(TypeInfo.t_int);
|
||||||
|
result.add(info);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (expression.getExpressionKind() == IASTExpression.Kind.PRIMARY_CHAR_LITERAL){
|
||||||
|
TypeInfo info = new TypeInfo();
|
||||||
|
info.setType(TypeInfo.t_char);
|
||||||
|
result.add(info);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (expression.getExpressionKind() == IASTExpression.Kind.PRIMARY_FLOAT_LITERAL){
|
||||||
|
TypeInfo info = new TypeInfo();
|
||||||
|
info.setType(TypeInfo.t_float);
|
||||||
|
result.add(info);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if (expression.getExpressionKind() == IASTExpression.Kind.PRIMARY_BOOLEAN_LITERAL){
|
||||||
|
TypeInfo info = new TypeInfo();
|
||||||
|
info.setType(TypeInfo.t_bool);
|
||||||
|
result.add(info);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if ((expression.getExpressionKind() == IASTExpression.Kind.ADDITIVE_PLUS)
|
||||||
|
|| (expression.getExpressionKind() == IASTExpression.Kind.ADDITIVE_MINUS) ){
|
||||||
|
ASTExpression right = (ASTExpression)expression.getLHSExpression();
|
||||||
|
ASTExpression left = (ASTExpression)expression.getRHSExpression();
|
||||||
|
if((right != null) && (left != null)){
|
||||||
|
TypeInfo rightType =(TypeInfo)right.getResultType().iterator().next();
|
||||||
|
TypeInfo leftType =(TypeInfo)left.getResultType().iterator().next();
|
||||||
|
if ( rightType.equals(leftType) ){
|
||||||
|
result.add(rightType);
|
||||||
|
} else {
|
||||||
|
// TODO: two different types added or subtracted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(expression.getExpressionKind() == IASTExpression.Kind.EXPRESSIONLIST){
|
||||||
|
if(expression.getLHSExpression() != null){
|
||||||
|
Iterator i = ((ASTExpression)expression.getLHSExpression()).getResultType().iterator();
|
||||||
|
while (i.hasNext()){
|
||||||
|
result.add(i.next());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(expression.getRHSExpression() != null){
|
||||||
|
Iterator i = ((ASTExpression)expression.getRHSExpression()).getResultType().iterator();
|
||||||
|
while (i.hasNext()){
|
||||||
|
result.add(i.next());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if(expression.getExpressionKind() == IASTExpression.Kind.POSTFIX_FUNCTIONCALL){
|
||||||
|
TypeInfo type = new TypeInfo();
|
||||||
|
type.setType(TypeInfo.t_function);
|
||||||
|
result.add(type);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
protected void getExpressionReferences(IASTExpression expression, List references)
|
protected void getExpressionReferences(IASTExpression expression, List references)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class ASTExpression implements IASTExpression {
|
||||||
|
|
||||||
private final Kind kind;
|
private final Kind kind;
|
||||||
private final IASTExpression lhs, rhs, third;
|
private final IASTExpression lhs, rhs, third;
|
||||||
private final String id, typeId, literal;
|
private final String typeId, literal;
|
||||||
private final IASTNewExpressionDescriptor newDescriptor;
|
private final IASTNewExpressionDescriptor newDescriptor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,13 +33,12 @@ public class ASTExpression implements IASTExpression {
|
||||||
* @param typeId
|
* @param typeId
|
||||||
* @param literal
|
* @param literal
|
||||||
*/
|
*/
|
||||||
public ASTExpression(Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression third, String id, String typeId, String literal, IASTNewExpressionDescriptor newDescriptor) {
|
public ASTExpression(Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression third, String typeId, String literal, IASTNewExpressionDescriptor newDescriptor) {
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.lhs =lhs;
|
this.lhs =lhs;
|
||||||
this.rhs = rhs;
|
this.rhs = rhs;
|
||||||
this.third = third;
|
this.third = third;
|
||||||
this.typeId = typeId;
|
this.typeId = typeId;
|
||||||
this.id = id;
|
|
||||||
this.literal = literal;
|
this.literal = literal;
|
||||||
this.newDescriptor = newDescriptor;
|
this.newDescriptor = newDescriptor;
|
||||||
}
|
}
|
||||||
|
@ -75,17 +74,10 @@ public class ASTExpression implements IASTExpression {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getTypeId()
|
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getTypeId()
|
||||||
*/
|
*/
|
||||||
public String getTypeId() {
|
public String getTypeIdString() {
|
||||||
return typeId;
|
return typeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getId()
|
|
||||||
*/
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getNewExpressionDescriptor()
|
* @see org.eclipse.cdt.core.parser.ast.IASTExpression#getNewExpressionDescriptor()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -149,8 +149,8 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExpression(org.eclipse.cdt.core.parser.ast.IASTExpression.ExpressionKind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, java.lang.String, java.lang.String, java.lang.String)
|
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExpression(org.eclipse.cdt.core.parser.ast.IASTExpression.ExpressionKind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, java.lang.String, java.lang.String, java.lang.String)
|
||||||
*/
|
*/
|
||||||
public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IToken id, ITokenDuple typeId, String literal, IASTNewExpressionDescriptor newDescriptor) {
|
public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, ITokenDuple typeId, String literal, IASTNewExpressionDescriptor newDescriptor) {
|
||||||
return new ASTExpression( kind, lhs, rhs, thirdExpression, id == null ? "" : id.getImage(), typeId == null ? "" : typeId.toString(), literal, newDescriptor );
|
return new ASTExpression( kind, lhs, rhs, thirdExpression, typeId == null ? "" : typeId.toString(), literal, newDescriptor );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
* src/org/eclipse/cdt/internal/ui/search/CSearchOperation.java
|
* src/org/eclipse/cdt/internal/ui/search/CSearchOperation.java
|
||||||
* src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties
|
* src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties
|
||||||
|
|
||||||
|
2003-09-04 Hoda Amer
|
||||||
|
- Solution to bug#42414 :Extraneous semi-colons in generated class methods
|
||||||
|
|
||||||
2003-09-03 David Inglis
|
2003-09-03 David Inglis
|
||||||
Fixed parser block to save ids properly.
|
Fixed parser block to save ids properly.
|
||||||
Use shared preference key for error parsers.
|
Use shared preference key for error parsers.
|
||||||
|
|
|
@ -811,7 +811,7 @@ public class NewClassWizardPage extends WizardPage implements Listener {
|
||||||
text.append(getNewClassName());
|
text.append(getNewClassName());
|
||||||
text.append("()");
|
text.append("()");
|
||||||
if(isInline()){
|
if(isInline()){
|
||||||
text.append(" {};");
|
text.append(" {}");
|
||||||
text.append(lineDelimiter);
|
text.append(lineDelimiter);
|
||||||
}else {
|
}else {
|
||||||
text.append(";");
|
text.append(";");
|
||||||
|
@ -827,7 +827,7 @@ public class NewClassWizardPage extends WizardPage implements Listener {
|
||||||
text.append(getNewClassName());
|
text.append(getNewClassName());
|
||||||
text.append("()");
|
text.append("()");
|
||||||
if(isInline()){
|
if(isInline()){
|
||||||
text.append(" {};");
|
text.append(" {}");
|
||||||
text.append(lineDelimiter);
|
text.append(lineDelimiter);
|
||||||
}else {
|
}else {
|
||||||
text.append(";");
|
text.append(";");
|
||||||
|
@ -864,7 +864,7 @@ public class NewClassWizardPage extends WizardPage implements Listener {
|
||||||
text.append(getNewClassName());
|
text.append(getNewClassName());
|
||||||
text.append("()");
|
text.append("()");
|
||||||
text.append(lineDelimiter);
|
text.append(lineDelimiter);
|
||||||
text.append("{};");
|
text.append("{}");
|
||||||
text.append(lineDelimiter);
|
text.append(lineDelimiter);
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
|
@ -873,7 +873,7 @@ public class NewClassWizardPage extends WizardPage implements Listener {
|
||||||
text.append(getNewClassName());
|
text.append(getNewClassName());
|
||||||
text.append("()");
|
text.append("()");
|
||||||
text.append(lineDelimiter);
|
text.append(lineDelimiter);
|
||||||
text.append("{};");
|
text.append("{}");
|
||||||
text.append(lineDelimiter);
|
text.append(lineDelimiter);
|
||||||
return text.toString();
|
return text.toString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue