mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Modified the IASTFactory to take three expression lists for the createNewDescriptor() instead of just one.
They are : newPlacementExpressions, typeIdExpressions, and newInitializerExpressions.
This commit is contained in:
parent
4f65c461c3
commit
c64fbade9d
8 changed files with 68 additions and 25 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-08-25 Hoda Amer
|
||||
Modified the IASTFactory to take three expression lists
|
||||
for the createNewDescriptor() instead of just one.
|
||||
They are : newPlacementExpressions, typeIdExpressions, and
|
||||
newInitializerExpressions.
|
||||
|
||||
2003-08-25 John Camelon
|
||||
Updated Structure.java to keep JDK 1.3 compliance.
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.core.parser.Enum;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
|
||||
|
@ -124,7 +124,9 @@ public interface IASTExpression extends ISourceElementCallbackDelegate
|
|||
|
||||
public interface IASTNewExpressionDescriptor
|
||||
{
|
||||
public List getExpressions();
|
||||
public Iterator getNewPlacementExpressions();
|
||||
public Iterator getNewTypeIdExpressions();
|
||||
public Iterator getNewInitializerExpressions();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public interface IASTFactory
|
|||
IToken id,
|
||||
ITokenDuple typeId,
|
||||
String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException;
|
||||
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List expressions);
|
||||
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions);
|
||||
public IASTInitializerClause createInitializerClause(
|
||||
IASTInitializerClause.Kind kind,
|
||||
IASTExpression assignmentExpression,
|
||||
|
|
|
@ -3540,7 +3540,9 @@ public class Parser implements IParser
|
|||
IToken beforeSecondParen = null;
|
||||
IToken backtrackMarker = null;
|
||||
ITokenDuple typeId = null;
|
||||
ArrayList expressions = new ArrayList();
|
||||
ArrayList newPlacementExpressions = new ArrayList();
|
||||
ArrayList newTypeIdExpressions = new ArrayList();
|
||||
ArrayList newInitializerExpressions = new ArrayList();
|
||||
|
||||
if (LT(1) == IToken.tLPAREN)
|
||||
{
|
||||
|
@ -3550,7 +3552,7 @@ public class Parser implements IParser
|
|||
// Try to consume placement list
|
||||
// Note: since expressionList and expression are the same...
|
||||
backtrackMarker = mark();
|
||||
expressions.add(expression(scope));
|
||||
newPlacementExpressions.add(expression(scope));
|
||||
consume(IToken.tRPAREN);
|
||||
placementParseFailure = false;
|
||||
if (LT(1) == IToken.tLPAREN)
|
||||
|
@ -3634,7 +3636,7 @@ public class Parser implements IParser
|
|||
return astFactory.createExpression(
|
||||
scope, IASTExpression.Kind.NEW_TYPEID,
|
||||
null, null, null, null, typeId, "",
|
||||
astFactory.createNewDescriptor(expressions));
|
||||
astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
|
@ -3663,7 +3665,7 @@ public class Parser implements IParser
|
|||
{
|
||||
// array new
|
||||
consume();
|
||||
expressions.add(assignmentExpression(scope));
|
||||
newTypeIdExpressions.add(assignmentExpression(scope));
|
||||
consume(IToken.tRBRACKET);
|
||||
}
|
||||
// newinitializer
|
||||
|
@ -3671,7 +3673,7 @@ public class Parser implements IParser
|
|||
{
|
||||
consume(IToken.tLPAREN);
|
||||
if (LT(1) != IToken.tRPAREN)
|
||||
expressions.add(expression(scope));
|
||||
newInitializerExpressions.add(expression(scope));
|
||||
consume(IToken.tRPAREN);
|
||||
}
|
||||
try
|
||||
|
@ -3679,7 +3681,7 @@ public class Parser implements IParser
|
|||
return astFactory.createExpression(
|
||||
scope, IASTExpression.Kind.NEW_TYPEID,
|
||||
null, null, null, null, typeId, "",
|
||||
astFactory.createNewDescriptor(expressions));
|
||||
astFactory.createNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions));
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.ast.complete;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
|
||||
|
@ -22,19 +23,28 @@ import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescripto
|
|||
*/
|
||||
public class ASTNewDescriptor implements IASTNewExpressionDescriptor {
|
||||
|
||||
List expressions;
|
||||
|
||||
public ASTNewDescriptor(List expressions) {
|
||||
List newPlacementExpressions;
|
||||
List newTypeIdExpressions;
|
||||
List newInitializerExpressions;
|
||||
public ASTNewDescriptor(List newPlacementExpressions, List newTypeIdExpressions, List newInitializerExpressions) {
|
||||
super();
|
||||
this.expressions = expressions;
|
||||
this.newPlacementExpressions = newPlacementExpressions;
|
||||
this.newTypeIdExpressions = newTypeIdExpressions;
|
||||
this.newInitializerExpressions = newInitializerExpressions;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getExpressions()
|
||||
*/
|
||||
public List getExpressions() {
|
||||
return expressions;
|
||||
public Iterator getNewPlacementExpressions() {
|
||||
return newPlacementExpressions.iterator();
|
||||
}
|
||||
public Iterator getNewTypeIdExpressions() {
|
||||
return newTypeIdExpressions.iterator();
|
||||
}
|
||||
public Iterator getNewInitializerExpressions() {
|
||||
return newInitializerExpressions.iterator();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -641,12 +641,21 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
getExpressionReferences(rhs, references);
|
||||
getExpressionReferences(thirdExpression,references);
|
||||
|
||||
// add newDescriptor's references & add to references
|
||||
// if there is a newDescriptor, check related expressions
|
||||
if(newDescriptor != null){
|
||||
Iterator i = newDescriptor.getExpressions().iterator();
|
||||
Iterator i = newDescriptor.getNewPlacementExpressions();
|
||||
while (i.hasNext()){
|
||||
getExpressionReferences((IASTExpression)i.next(), references);
|
||||
}
|
||||
i = newDescriptor.getNewTypeIdExpressions();
|
||||
while (i.hasNext()){
|
||||
getExpressionReferences((IASTExpression)i.next(), references);
|
||||
}
|
||||
i = newDescriptor.getNewInitializerExpressions();
|
||||
while (i.hasNext()){
|
||||
getExpressionReferences((IASTExpression)i.next(), references);
|
||||
}
|
||||
}
|
||||
|
||||
//look up id & add to references
|
||||
|
@ -672,7 +681,6 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
if( typeId != null )
|
||||
lookupQualifiedName( startingScope, typeId, references, false );
|
||||
|
||||
//TODO add newDescriptor's references & add to references
|
||||
return new ASTExpression( kind, lhs, rhs, thirdExpression,
|
||||
id == null ? "" : id.getImage(),
|
||||
typeId == null ? "" : typeId.toString(),
|
||||
|
@ -690,11 +698,9 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewDescriptor()
|
||||
*/
|
||||
public IASTNewExpressionDescriptor createNewDescriptor(List expressions)
|
||||
public IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions)
|
||||
{
|
||||
// TODO FIX THIS
|
||||
// return null;
|
||||
return new ASTNewDescriptor(expressions);
|
||||
return new ASTNewDescriptor(newPlacementExpressions, newTypeIdExpressions, newInitializerExpressions);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.ast.quick;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
|
||||
|
||||
|
@ -19,10 +19,27 @@ import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescripto
|
|||
*/
|
||||
public class ASTNewDescriptor implements IASTNewExpressionDescriptor {
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getExpressions()
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getNewInitializerExpressions()
|
||||
*/
|
||||
public List getExpressions() {
|
||||
public Iterator getNewInitializerExpressions() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getNewPlacementExpressions()
|
||||
*/
|
||||
public Iterator getNewPlacementExpressions() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor#getTypeIdExpressions()
|
||||
*/
|
||||
public Iterator getNewTypeIdExpressions() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewDescriptor()
|
||||
*/
|
||||
public IASTNewExpressionDescriptor createNewDescriptor(List expressions) {
|
||||
public IASTNewExpressionDescriptor createNewDescriptor(List newPlacementEpressions, List newTypeIdExpressions, List newInitializerExpressions) {
|
||||
return new ASTNewDescriptor();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue