Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Changes to ASTExpression + Solution to bug#42414 & Partial solution to bug#42453


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

Hoda Amer
Staff Software Engineer
Rational Software - IBM Software Group

 
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.157
diff -u -r1.157 ChangeLog
--- ChangeLog	4 Sep 2003 03:03:45 -0000	1.157
+++ ChangeLog	4 Sep 2003 13:49:53 -0000
@@ -1,3 +1,6 @@
+2003-09-04 Hoda Amer
+	- Solution to bug#42414 :Extraneous semi-colons in generated class methods
+	
 2003-09-03 David Inglis
 	Fixed parser block to save ids properly.
 	Use shared preference key for error parsers.
Index: src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java,v
retrieving revision 1.6
diff -u -r1.6 NewClassWizardPage.java
--- src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java	12 Aug 2003 20:20:12 -0000	1.6
+++ src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java	4 Sep 2003 13:49:54 -0000
@@ -811,7 +811,7 @@
 		text.append(getNewClassName());
 		text.append("()");
 		if(isInline()){
-			text.append(" {};");
+			text.append(" {}");
 			text.append(lineDelimiter);						
 		}else {
 			text.append(";");
@@ -827,7 +827,7 @@
 		text.append(getNewClassName());
 		text.append("()");
 		if(isInline()){
-			text.append(" {};");
+			text.append(" {}");
 			text.append(lineDelimiter);						
 		}else {
 			text.append(";");
@@ -864,7 +864,7 @@
 		text.append(getNewClassName());
 		text.append("()");
 		text.append(lineDelimiter);			
-		text.append("{};");
+		text.append("{}");
 		text.append(lineDelimiter);			
 		
 		// destructor
@@ -873,7 +873,7 @@
 		text.append(getNewClassName());
 		text.append("()"); 
 		text.append(lineDelimiter);			
-		text.append("{};"); 
+		text.append("{}"); 
 		text.append(lineDelimiter);				
 		return text.toString();
 	}
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.139
diff -u -r1.139 ChangeLog
--- ChangeLog	4 Sep 2003 02:59:23 -0000	1.139
+++ ChangeLog	4 Sep 2003 13:48:59 -0000
@@ -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
 	Added shared preference key for error parsers
 	
Index: parser/org/eclipse/cdt/core/parser/ast/IASTExpression.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTExpression.java,v
retrieving revision 1.6
diff -u -r1.6 IASTExpression.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTExpression.java	25 Aug 2003 15:41:30 -0000	1.6
+++ parser/org/eclipse/cdt/core/parser/ast/IASTExpression.java	4 Sep 2003 13:48:59 -0000
@@ -119,7 +119,7 @@
         {
             super(enumValue);
         }
-		
+        		
 	}
 	
 	public interface IASTNewExpressionDescriptor
@@ -136,8 +136,7 @@
 	public IASTExpression getRHSExpression();
 	public IASTExpression getThirdExpression();
 	public String getLiteralString(); 
-	public String getTypeId(); 	
-	public String getId();
+	public String getTypeIdString(); 	
 	public IASTNewExpressionDescriptor getNewExpressionDescriptor(); 
 	
 	public int evaluateExpression() throws ExpressionEvaluationException;
Index: parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java,v
retrieving revision 1.27
diff -u -r1.27 IASTFactory.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java	28 Aug 2003 15:50:31 -0000	1.27
+++ parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java	4 Sep 2003 13:48:59 -0000
@@ -103,7 +103,6 @@
         IASTExpression lhs,
         IASTExpression rhs,
         IASTExpression thirdExpression,
-        IToken id,
         ITokenDuple typeId,
         String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException;
     public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions);
Index: parser/org/eclipse/cdt/internal/core/parser/Parser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java,v
retrieving revision 1.99
diff -u -r1.99 Parser.java
--- parser/org/eclipse/cdt/internal/core/parser/Parser.java	28 Aug 2003 15:02:52 -0000	1.99
+++ parser/org/eclipse/cdt/internal/core/parser/Parser.java	4 Sep 2003 13:49:01 -0000
@@ -2743,7 +2743,6 @@
                         secondExpression,
                         null,
                         null,
-                        null,
                         "", null);
             }
             catch (ASTSemanticException e)
@@ -2827,7 +2826,6 @@
                 null,
                 null,
                 null,
-                null,
                 "", null);
         }
         catch (ASTSemanticException e)
@@ -2861,7 +2859,6 @@
                 null,
                 null,
                 null,
-                null,
                 "", null);
         }
         catch (ASTSemanticException e)
@@ -2894,7 +2891,6 @@
                     secondExpression,
                     thirdExpression,
                     null,
-                    null,
                     "", null);
             }
             catch (ASTSemanticException e)
@@ -2929,7 +2925,6 @@
                         secondExpression,
                         null,
                         null,
-                        null,
                         "", null);
             }
             catch (ASTSemanticException e)
@@ -2962,7 +2957,6 @@
                         secondExpression,
                         null,
                         null,
-                        null,
                         "", null);
             }
             catch (ASTSemanticException e)
@@ -2996,7 +2990,6 @@
                         secondExpression,
                         null,
                         null,
-                        null,
                         "", null);
             }
             catch (ASTSemanticException e)
@@ -3030,7 +3023,6 @@
                         secondExpression,
                         null,
                         null,
-                        null,
                         "", null);
             }
             catch (ASTSemanticException e)
@@ -3063,7 +3055,6 @@
                         secondExpression,
                         null,
                         null,
-                        null,
                         "", null);
             }
             catch (ASTSemanticException e)
@@ -3104,7 +3095,6 @@
                                 secondExpression,
                                 null,
                                 null,
-                                null,
                                 "", null);
                     }
                     catch (ASTSemanticException e)
@@ -3181,7 +3171,6 @@
                                     secondExpression,
                                     null,
                                     null,
-                                    null,
                                     "", null);
                         }
                         catch (ASTSemanticException e)
@@ -3225,7 +3214,6 @@
                                 secondExpression,
                                 null,
                                 null,
-                                null,
                                 "", null);
                     }
                     catch (ASTSemanticException e)
@@ -3268,7 +3256,6 @@
                                 secondExpression,
                                 null,
                                 null,
-                                null,
                                 "", null);
                     }
                     catch (ASTSemanticException e)
@@ -3322,7 +3309,6 @@
                                 secondExpression,
                                 null,
                                 null,
-                                null,
                                 "", null);
                     }
                     catch (ASTSemanticException e)
@@ -3364,7 +3350,6 @@
                                 secondExpression,
                                 null,
                                 null,
-                                null,
                                 "", null);
                     }
                     catch (ASTSemanticException e)
@@ -3413,7 +3398,6 @@
                         castExpression,
                         null,
                         null,
-                        null,
                         duple,
                         "", null);
                 }
@@ -3527,7 +3511,6 @@
                 null,
                 null,
                 null,
-                null,
                 "", null);
         }
         catch (ASTSemanticException e)
@@ -3660,7 +3643,7 @@
 							{
 							return astFactory.createExpression(
 								scope, IASTExpression.Kind.NEW_TYPEID, 
-								null, null,	null, null, typeId, "", 
+								null, null, null, typeId, "", 
 								astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
 							}
 							catch (ASTSemanticException e)
@@ -3705,7 +3688,7 @@
 		{
         return astFactory.createExpression(
         	scope, IASTExpression.Kind.NEW_TYPEID, 
-			null, null,	null, null, typeId, "", 
+			null, null, null, typeId, "", 
 			astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
 		}
 		catch (ASTSemanticException e)
@@ -3729,7 +3712,6 @@
                 null,
                 null,
                 null,
-                null,
                 "", null);
         }
         catch (ASTSemanticException e)
@@ -3811,7 +3793,6 @@
                             null,
                             null,
                             null,
-                            null,
                             d,
                             "", null);
                     }
@@ -3830,7 +3811,6 @@
                             null,
                             null,
                             null,
-                            null,
                             "", null);
                     }
                     catch (ASTSemanticException e1)
@@ -3970,7 +3950,6 @@
                             lhs,
                             null,
                             null,
-                            null,
                             typeId,
                             "", null);
                 }
@@ -4002,7 +3981,6 @@
                                 firstExpression,
                                 secondExpression,
                                 null,
-                        		null,
                                 null,
                                 "", null);
                     }
@@ -4027,7 +4005,6 @@
                                 secondExpression,
                                 null,
                                 null,
-                                null,
                                 "", null);
                     }
                     catch (ASTSemanticException e3)
@@ -4048,7 +4025,6 @@
                                 null,
                                 null,
                                 null,
-                                null,
                                 "", null);
                     }
                     catch (ASTSemanticException e1)
@@ -4069,7 +4045,6 @@
                                 null,
                                 null,
                                 null,
-                                null,
                                 "", null);
                     }
                     catch (ASTSemanticException e4)
@@ -4099,7 +4074,6 @@
                                 secondExpression,
                                 null,
                                 null,
-                                null,
                                 "", null);
                     }
                     catch (ASTSemanticException e5)
@@ -4129,7 +4103,6 @@
                                 secondExpression,
                                 null,
                                 null,
-                                null,
                                 "", null);
                     }
                     catch (ASTSemanticException e)
@@ -4163,7 +4136,6 @@
                 null,
                 null,
                 null,
-                null,
                 "", null);
         }
         catch (ASTSemanticException e)
@@ -4189,7 +4161,6 @@
                 null,
                 null,
                 null,
-                null,
                 "", null);
         }
         catch (ASTSemanticException e)
@@ -4220,7 +4191,6 @@
                         null,
                         null,
                         null,
-                        null,
                         t.getImage(), null);
                 }
                 catch (ASTSemanticException e1)
@@ -4239,7 +4209,6 @@
                         null,
                         null,
                         null,
-                        null,
                         t.getImage(), null);
                 }
                 catch (ASTSemanticException e2)
@@ -4252,7 +4221,7 @@
 				t = consume();
 				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)
                 {
@@ -4270,7 +4239,6 @@
                         IASTExpression.Kind.PRIMARY_BOOLEAN_LITERAL,
                         null,
                         null,
-                        null,
                     	null,
                         null,
                         t.getImage(), null);
@@ -4294,7 +4262,6 @@
                         null,
                         null,
                         null,
-                        null,
                         t.getImage(), null);
                 }
                 catch (ASTSemanticException e4)
@@ -4314,7 +4281,6 @@
                         null,
                         null,
                         null,
-                        null,
                         "", null);
                 }
                 catch (ASTSemanticException e7)
@@ -4334,7 +4300,6 @@
                         lhs,
                         null,
                         null,
-                    	null,
                         null,
                         "", null);
                 }
@@ -4353,7 +4318,6 @@
                         IASTExpression.Kind.ID_EXPRESSION,
                         null,
                         null,
-                        null,
                     	null,
 						duple,
                         "", null);
@@ -4369,7 +4333,6 @@
                     return astFactory.createExpression(
                         scope,
                         IASTExpression.Kind.PRIMARY_EMPTY,
-                        null,
                         null,
                         null,
                     	null,
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java,v
retrieving revision 1.2
diff -u -r1.2 ASTExpression.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java	13 Aug 2003 23:54:05 -0000	1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTExpression.java	4 Sep 2003 13:49:01 -0000
@@ -10,9 +10,11 @@
 ***********************************************************************/
 package org.eclipse.cdt.internal.core.parser.ast.complete;
 
+import java.util.ArrayList;
 import java.util.List;
 
 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.IASTExpression;
 
@@ -27,15 +29,15 @@
     private final IASTExpression rhs;
     private final IASTExpression thirdExpression;
     private final String literal;
-    private final String typeId;
-    private final String id;
+    private final ITokenDuple typeId;
     private final IASTNewExpressionDescriptor newDescriptor;
     private final List references; 
+    private List resultType;
     /**
      * 
      */
     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.lhs = lhs;
@@ -43,9 +45,9 @@
     	this.thirdExpression = thirdExpression;
     	this.literal = literal;
     	this.typeId = typeId;
-    	this.id = id; 
     	this.newDescriptor = newDescriptor;
     	this.references = references;
+    	resultType = new ArrayList();
     }
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getExpressionKind()
@@ -85,16 +87,16 @@
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getTypeId()
      */
-    public String getTypeId()
+    public String getTypeIdString()
     {
-        return typeId;
+        return typeId == null ? "" : typeId.toString();
     }
-    /* (non-Javadoc)
-     * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getId()
+    /*
+     * returns the type id token
      */
-    public String getId()
+    public ITokenDuple getTypeId()
     {
-        return id;
+    	return typeId;
     }
     /* (non-Javadoc)
      * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getNewExpressionDescriptor()
@@ -139,4 +141,18 @@
     {
     }
  
+	/**
+	 * @return
+	 */
+	public List getResultType() {
+		return resultType;
+	}
+
+	/**
+	 * @param i
+	 */
+	public void setResultType(List i) {
+		resultType = i;
+	}
+
 }
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java,v
retrieving revision 1.24
diff -u -r1.24 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	3 Sep 2003 15:15:59 -0000	1.24
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java	4 Sep 2003 13:49:01 -0000
@@ -126,7 +126,11 @@
 		
 	}
 
-	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;
 		IToken firstSymbol = null;
@@ -143,7 +147,10 @@
 					firstSymbol = name.getFirstToken();
 					try
 	                {
-	                    result = startingScope.lookup( firstSymbol.getImage());
+	                	if(type == TypeInfo.t_function)	                	
+							result = startingScope.unqualifiedFunctionLookup( firstSymbol.getImage(), new LinkedList(parameters));
+						else
+	                    	result = startingScope.lookup( firstSymbol.getImage());
 	                    if( result != null ) 
 							references.add( createReference( result, firstSymbol.getImage(), firstSymbol.getOffset() ));
 						else
@@ -160,7 +167,10 @@
 						throw new ASTSemanticException();
 					try
 					{
-						result = pst.getCompilationUnit().lookup( name.getLastToken().getImage() );
+						if(type == TypeInfo.t_function)	                	
+							result = pst.getCompilationUnit().unqualifiedFunctionLookup( name.getLastToken().getImage(), new LinkedList(parameters));
+						else
+							result = pst.getCompilationUnit().lookup( name.getLastToken().getImage() );
 						references.add( createReference( result, name.getLastToken().getImage(), name.getLastToken().getOffset() ));
 					}
 					catch( ParserSymbolTableException e)
@@ -181,7 +191,10 @@
 						try
 						{
 							if( t == name.getLastToken() ) 
-								result = ((IContainerSymbol)result).qualifiedLookup( t.getImage() );
+								if(type == TypeInfo.t_function)	                	
+									result = ((IContainerSymbol)result).qualifiedFunctionLookup( t.getImage(), new LinkedList(parameters) );
+								else						
+									result = ((IContainerSymbol)result).qualifiedLookup( t.getImage() );
 							else
 								result = ((IContainerSymbol)result).lookupNestedNameSpecifier( t.getImage() );
 							references.add( createReference( result, t.getImage(), t.getOffset() ));
@@ -391,9 +404,6 @@
 		{
 			extension.addDefinition( astSymbol );
 		}
-		
-		
-
 	}
     
     /* (non-Javadoc)
@@ -670,7 +680,6 @@
         IASTExpression lhs,
         IASTExpression rhs,
         IASTExpression thirdExpression,
-        IToken id,
         ITokenDuple typeId,
         String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException
     {
@@ -699,33 +708,95 @@
     	
         //look up id & add to references
         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
         if( typeId != null )
         	lookupQualifiedName( startingScope, typeId, references, false );
-        
-        return new ASTExpression( kind, lhs, rhs, thirdExpression, 
-        							id == null ? "" : id.getImage(), 
-        							typeId == null ? "" : typeId.toString(), 
-        							literal, newDescriptor, references);
-    }
-
+		
+		if (kind == IASTExpression.Kind.POSTFIX_FUNCTIONCALL){        							
+			ITokenDuple functionId = ((ASTExpression)lhs).getTypeId();
+			List parameters = ((ASTExpression)rhs).getResultType();
+			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)
     {
@@ -937,7 +1008,7 @@
 					(IParameterizedSymbol) lookupQualifiedName(parentScope, functionName, TypeInfo.t_function, parameters, 0, functionReferences, false);
 				if(methodDeclaration != null){
 					ASTMethodReference reference = (ASTMethodReference) functionReferences.iterator().next();
-					visibility = ((IASTMethod)reference.getReferencedElement()).getVisiblity();		
+				visibility = ((IASTMethod)reference.getReferencedElement()).getVisiblity();		
 				}
 				return createMethod(scope, functionName, parameters, returnType,
 				exception, isInline, isFriend, isStatic, startOffset, offset,
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java,v
retrieving revision 1.2
diff -u -r1.2 ASTExpression.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java	13 Aug 2003 21:51:48 -0000	1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTExpression.java	4 Sep 2003 13:49:01 -0000
@@ -22,7 +22,7 @@
 
 	private final Kind kind; 
 	private final IASTExpression lhs, rhs, third; 
-	private final String id, typeId, literal; 
+	private final String typeId, literal; 
 	private final IASTNewExpressionDescriptor newDescriptor;
 
 	/**
@@ -33,13 +33,12 @@
 	 * @param typeId
 	 * @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.lhs =lhs; 
 		this.rhs = rhs; 
 		this.third = third;
 		this.typeId = typeId; 
-		this.id = id; 
 		this.literal = literal;
 		this.newDescriptor = newDescriptor;
 	}
@@ -75,15 +74,8 @@
 	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getTypeId()
 	 */
-	public String getTypeId() {
+	public String getTypeIdString() {
 		return typeId;
-	}
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.cdt.core.parser.ast.IASTExpression#getId()
-	 */
-	public String getId() {
-		return id;
 	}
 
 	/* (non-Javadoc)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java,v
retrieving revision 1.29
diff -u -r1.29 QuickParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java	28 Aug 2003 15:50:31 -0000	1.29
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java	4 Sep 2003 13:49:02 -0000
@@ -149,8 +149,8 @@
 	/* (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)
 	 */
-	public IASTExpression createExpression(IASTScope scope, Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, IToken id, ITokenDuple typeId, String literal, IASTNewExpressionDescriptor newDescriptor) {
-		return new ASTExpression( kind, lhs, rhs, thirdExpression, id == null ? "" : id.getImage(), typeId == null ? "" : typeId.toString(), literal, 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, typeId == null ? "" : typeId.toString(), literal, newDescriptor );
 	}
 
 	/* (non-Javadoc)
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.75
diff -u -r1.75 ChangeLog
--- ChangeLog	3 Sep 2003 20:57:51 -0000	1.75
+++ ChangeLog	4 Sep 2003 13:56:28 -0000
@@ -1,3 +1,6 @@
+2003-09-04 Hoda Amer
+	Call to ASTExpression getTypeId() changed to getTypeIdString().
+	
 2003-09-03 Andrew Niefer
 	Modified ParserSymbolTableTest.testConstructors to test > 2 constructors
 
Index: parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java,v
retrieving revision 1.15
diff -u -r1.15 QuickParseASTTests.java
--- parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java	28 Aug 2003 15:02:29 -0000	1.15
+++ parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java	4 Sep 2003 13:56:29 -0000
@@ -1429,7 +1429,7 @@
 		assertFalse( enumerators.hasNext() );
 		assertEquals( enumerator.getName(), "isPointer");
 		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 {

Back to the top