mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Minor fix for overloaded comma operator.
This commit is contained in:
parent
ed8c6d8a9a
commit
a2d89b3d85
1 changed files with 15 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2009 IBM Corporation and others.
|
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
@ -19,7 +20,10 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
|
import org.eclipse.cdt.core.dom.ast.IASTImplicitName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpressionList;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpressionList;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
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.ASTNode;
|
||||||
|
@ -29,7 +33,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
|
|
||||||
|
|
||||||
public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionList, IASTAmbiguityParent {
|
public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionList, IASTAmbiguityParent {
|
||||||
|
private static final ICPPFunction[] NO_FUNCTIONS = new ICPPFunction[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caution: may contain nulls.
|
* Caution: may contain nulls.
|
||||||
|
@ -137,8 +141,15 @@ public class CPPASTExpressionList extends ASTNode implements ICPPASTExpressionLi
|
||||||
private ICPPFunction[] getOverloads() {
|
private ICPPFunction[] getOverloads() {
|
||||||
if(overloads == null) {
|
if(overloads == null) {
|
||||||
IASTExpression[] exprs = getExpressions();
|
IASTExpression[] exprs = getExpressions();
|
||||||
if(exprs.length < 2 || getPropertyInParent() == IASTFunctionCallExpression.PARAMETERS)
|
if(exprs.length < 2)
|
||||||
return overloads = new ICPPFunction[0];
|
return overloads = NO_FUNCTIONS;
|
||||||
|
|
||||||
|
ASTNodeProperty prop = getPropertyInParent();
|
||||||
|
if (prop == IASTFunctionCallExpression.PARAMETERS ||
|
||||||
|
prop == ICPPASTConstructorChainInitializer.INITIALIZER ||
|
||||||
|
prop == ICPPASTConstructorInitializer.EXPRESSION ||
|
||||||
|
prop == ICPPASTNewExpression.NEW_INITIALIZER)
|
||||||
|
return overloads = NO_FUNCTIONS;
|
||||||
|
|
||||||
overloads = new ICPPFunction[exprs.length-1];
|
overloads = new ICPPFunction[exprs.length-1];
|
||||||
IType lookupType = exprs[0].getExpressionType();
|
IType lookupType = exprs[0].getExpressionType();
|
||||||
|
|
Loading…
Add table
Reference in a new issue