mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Replaced unsafe getBases() method.
This commit is contained in:
parent
11171b06ad
commit
c801d2545d
2 changed files with 10 additions and 9 deletions
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPUnknownType;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface ICPPBase extends Cloneable {
|
public interface ICPPBase extends Cloneable {
|
||||||
public static final ICPPBase[] EMPTY_BASE_ARRAY = new ICPPBase[0];
|
public static final ICPPBase[] EMPTY_BASE_ARRAY = {};
|
||||||
|
|
||||||
public static final int v_private = ICPPASTBaseSpecifier.v_private;
|
public static final int v_private = ICPPASTBaseSpecifier.v_private;
|
||||||
public static final int v_protected = ICPPASTBaseSpecifier.v_protected;
|
public static final int v_protected = ICPPASTBaseSpecifier.v_protected;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2012 Google, Inc and others.
|
* Copyright (c) 2009, 2013 Google, Inc 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
|
||||||
|
@ -177,9 +177,10 @@ public class AccessContext {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns access level to the members of a class.
|
* Returns access level to the members of a class.
|
||||||
|
*
|
||||||
* @param classType A class
|
* @param classType A class
|
||||||
* @param inheritedAccessLevel Access level inherited from derived class. One of: v_public, v_protected,
|
* @param inheritedAccessLevel Access level inherited from derived class.
|
||||||
* v_private.
|
* One of: v_public, v_protected, v_private.
|
||||||
* @return One of: v_public, v_protected, v_private.
|
* @return One of: v_public, v_protected, v_private.
|
||||||
*/
|
*/
|
||||||
private int getMemberAccessLevel(ICPPClassType classType, int inheritedAccessLevel) {
|
private int getMemberAccessLevel(ICPPClassType classType, int inheritedAccessLevel) {
|
||||||
|
@ -197,14 +198,14 @@ public class AccessContext {
|
||||||
return accessLevel;
|
return accessLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAccessibleBaseClass(ICPPClassType classType, ICPPClassType defived, int depth) {
|
private boolean isAccessibleBaseClass(ICPPClassType classType, ICPPClassType derived, int depth) {
|
||||||
if (depth > CPPSemantics.MAX_INHERITANCE_DEPTH)
|
if (depth > CPPSemantics.MAX_INHERITANCE_DEPTH)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (defived.isSameType(classType))
|
if (derived.isSameType(classType))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
ICPPBase[] bases = defived.getBases();
|
ICPPBase[] bases = ClassTypeHelper.getBases(derived, name);
|
||||||
if (bases != null) {
|
if (bases != null) {
|
||||||
for (ICPPBase base : bases) {
|
for (ICPPBase base : bases) {
|
||||||
IBinding baseClass = base.getBaseClass();
|
IBinding baseClass = base.getBaseClass();
|
||||||
|
|
Loading…
Add table
Reference in a new issue