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

Removal of some java.util.Lists.

This commit is contained in:
John Camelon 2005-04-05 19:04:42 +00:00
parent a11aba0b33
commit 66fdaff822
3 changed files with 22 additions and 25 deletions

View file

@ -9,8 +9,6 @@
* IBM Rational Software - Initial API and implementation */
package org.eclipse.cdt.internal.core.dom.parser;
import java.util.List;
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
@ -2058,11 +2056,10 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
* @param declarators
* @return
*/
protected int figureEndOffset(IASTDeclSpecifier declSpec, List declarators) {
if (declarators.isEmpty())
protected int figureEndOffset(IASTDeclSpecifier declSpec, IASTDeclarator [] declarators) {
if (declarators.length == 0 )
return calculateEndOffset(declSpec);
return calculateEndOffset((IASTDeclarator) declarators.get(declarators
.size() - 1));
return calculateEndOffset(declarators[ declarators.length - 1 ] );
}
/**

View file

@ -94,6 +94,7 @@ import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ParseError;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser;
@ -106,8 +107,6 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
private final boolean supportGCCStyleDesignators;
private static final int DEFAULT_DECLARATOR_LIST_SIZE = 4;
/**
* @param scanner
* @param parserMode
@ -433,16 +432,16 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
IASTDeclSpecifier declSpec = declSpecifierSeq(false);
List declarators = Collections.EMPTY_LIST;
IASTDeclarator [] declarators = new IASTDeclarator[2];
if (LT(1) != IToken.tSEMI) {
declarators = new ArrayList(DEFAULT_DECLARATOR_LIST_SIZE);
declarators.add(initDeclarator());
declarators = (IASTDeclarator[]) ArrayUtil.append( IASTDeclarator.class, declarators, initDeclarator());
while (LT(1) == IToken.tCOMMA) {
consume(IToken.tCOMMA);
declarators.add(initDeclarator());
declarators = (IASTDeclarator[]) ArrayUtil.append( IASTDeclarator.class, declarators, initDeclarator());
}
}
declarators = (IASTDeclarator[]) ArrayUtil.removeNulls( IASTDeclarator.class, declarators );
boolean hasFunctionBody = false;
boolean hasFunctionTryBlock = false;
@ -470,10 +469,10 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
}
if (hasFunctionBody) {
if (declarators.size() != 1)
if (declarators.length != 1)
throwBacktrack(firstOffset, LA(1).getEndOffset());
IASTDeclarator declarator = (IASTDeclarator) declarators.get(0);
IASTDeclarator declarator = declarators[0];
if (!(declarator instanceof IASTFunctionDeclarator))
throwBacktrack(firstOffset, LA(1).getEndOffset());
@ -508,8 +507,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
declSpec.setParent(simpleDeclaration);
declSpec.setPropertyInParent(IASTSimpleDeclaration.DECL_SPECIFIER);
for (int i = 0; i < declarators.size(); ++i) {
IASTDeclarator declarator = (IASTDeclarator) declarators.get(i);
for (int i = 0; i < declarators.length; ++i) {
IASTDeclarator declarator = declarators[i];
simpleDeclaration.addDeclarator(declarator);
declarator.setParent(simpleDeclaration);
declarator.setPropertyInParent(IASTSimpleDeclaration.DECLARATOR);

View file

@ -131,6 +131,7 @@ import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ParseError;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser;
import org.eclipse.cdt.internal.core.dom.parser.BacktrackException;
@ -1860,7 +1861,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
private final boolean supportLongLong;
private static final int DEFAULT_PARM_LIST_SIZE = 4;
private static final int DEFAULT_DECLARATOR_LIST_SIZE = 4;
private static final int DEFAULT_POINTEROPS_LIST_SIZE = 4;
private static final int DEFAULT_SIZE_EXCEPTIONS_LIST = 2;
private static final int DEFAULT_CONSTRUCTOR_CHAIN_LIST_SIZE = 4;
@ -2697,16 +2697,17 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
ICPPASTDeclSpecifier declSpec = declSpecifierSeq(false,
strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR);
List declarators = Collections.EMPTY_LIST;
IASTDeclarator [] declarators = new IASTDeclarator[2];
if (LT(1) != IToken.tSEMI && LT(1) != IToken.tEOC) {
declarators = new ArrayList(DEFAULT_DECLARATOR_LIST_SIZE);
declarators.add(initDeclarator(strategy));
declarators = (IASTDeclarator []) ArrayUtil.append( IASTDeclarator.class, declarators,initDeclarator(strategy) );
while (LT(1) == IToken.tCOMMA) {
consume(IToken.tCOMMA);
declarators.add(initDeclarator(strategy));
declarators = (IASTDeclarator []) ArrayUtil.append( IASTDeclarator.class, declarators,initDeclarator(strategy) );
}
}
declarators = (IASTDeclarator[]) ArrayUtil.removeNulls( IASTDeclarator.class, declarators );
boolean hasFunctionBody = false;
boolean hasFunctionTryBlock = false;
boolean consumedSemi = false;
@ -2756,10 +2757,10 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
}
if (hasFunctionBody) {
if (declarators.size() != 1)
if (declarators.length != 1)
throwBacktrack(firstOffset, LA(1).getEndOffset() - firstOffset);
IASTDeclarator declarator = (IASTDeclarator) declarators.get(0);
IASTDeclarator declarator = declarators[0];
if (!(declarator instanceof IASTStandardFunctionDeclarator))
throwBacktrack(firstOffset, LA(1).getEndOffset() - firstOffset);
@ -2835,8 +2836,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
declSpec.setParent(simpleDeclaration);
declSpec.setPropertyInParent(IASTSimpleDeclaration.DECL_SPECIFIER);
for (int i = 0; i < declarators.size(); ++i) {
IASTDeclarator declarator = (IASTDeclarator) declarators.get(i);
for (int i = 0; i < declarators.length; ++i) {
IASTDeclarator declarator = declarators[i];
simpleDeclaration.addDeclarator(declarator);
declarator.setParent(simpleDeclaration);
declarator.setPropertyInParent(IASTSimpleDeclaration.DECLARATOR);