@Override public boolean isPointer() { return delegate.isPointer(); }
@Override public boolean isPointer() { return type.isPointer(); }
@Override public boolean isPointer() { return type.isPointer(); }
private CsmResultItem.SubstitutionHint getSubstitutionHint(ExprKind kind, CsmType type) { CsmResultItem.SubstitutionHint hint = CsmResultItem.SubstitutionHint.NONE; if (openingSource) { return hint; } if (type != null) { if (kind == ExprKind.DOT) { type = CsmUtilities.iterateTypeChain(type, new CsmUtilities.Predicate<CsmType>() { @Override public boolean check(CsmType value) { return value.isPointer(); } }); if (type.isPointer()) { hint = CsmResultItem.SubstitutionHint.DOT_TO_ARROW; } } else if (kind == ExprKind.ARROW && !type.isPointer()) { } } return hint; }
public boolean isPointer(List<CsmInstantiation> instantiations) { CsmType type = resolve(); return type != null ? type.isPointer() : false; }
private static boolean isPointerImpl(CsmType type, List<CsmInstantiation> instantiations) { if (type instanceof Decltype) { return ((Decltype) type).isPointer(instantiations); } else if (type instanceof DeclTypeImpl) { return ((DeclTypeImpl) type).isPointer(instantiations); } else { return type.isPointer(); } }
private static boolean isPointer(CsmType type) { int iteration = MAX_DEPTH; while (type != null && iteration != 0) { if (CsmKindUtilities.isFunctionPointerType(type)) { return (type.getPointerDepth() > 0); } if (type.isPointer()) { return true; } CsmClassifier cls = type.getClassifier(); if (CsmKindUtilities.isTypedef(cls) || CsmKindUtilities.isTypeAlias(cls)) { CsmTypedef td = (CsmTypedef) cls; type = td.getType(); } else { break; } iteration--; } return false; }
private static CsmType getOverloadedOperatorReturnType(CsmType type, CsmFile contextFile, int offset, CsmFunction.OperatorKind operator, int level) { if (type == null || type.isPointer() || type.getArrayDepth() > 0) { return null; } CsmType opType = null; CsmClassifier cls = getClassifier(type, contextFile, offset); if (CsmKindUtilities.isClass(cls)) { CsmFunction op = CsmCompletionQuery.getOperator((CsmClass) cls, contextFile, offset, operator); if (op != null) { opType = op.getReturnType(); if ((!type.equals(opType)) && (level > 0)) { if (operator == CsmFunction.OperatorKind.ARROW) { // recursion only for -> CsmType opType2 = getOverloadedOperatorReturnType(opType, contextFile, offset, operator, level - 1); if (opType2 != null) { opType = opType2; } } } else { CsmFile typeFile = type.getContainingFile(); System.err.printf("circular pointer delegation detected:%s, line %d/n", (typeFile != null ? typeFile.getAbsolutePath() : type), type.getStartOffset());//NOI18N CndUtils.assertTrueInConsole(false, "Infinite recursion in file " + typeFile + " type " + type); //NOI18N } } } return opType; }
public static int getSizeOfType(CsmType type, CsmFile context) { if (!CsmBaseUtilities.isValid(type)) { return SIZEOF_UNKNOWN; } if (type.isReference()) { return getSizeOfReference(type.getContainingFile()); } else if (type.isPointer()) { return getSizeOfPointer(type.getContainingFile()); } else if (type.getArrayDepth() > 0) { // TODO: all arrays have size of classifier*2 until TypeImpl will store its array definition expression CsmClassifier cls = type.getClassifier(); return getSizeOfClassifier(cls, type.getContainingFile()); } else { CsmClassifier cls = type.getClassifier(); return getSizeOfClassifier(cls, type.getContainingFile()); } }
public static boolean isInObject(CsmObject obj, int offset) { if (!CsmKindUtilities.isOffsetable(obj)) { return false; } CsmOffsetable offs = (CsmOffsetable)obj; if ((offs.getStartOffset() <= offset) && (offset <= offs.getEndOffset())) { if (CsmKindUtilities.isNamespaceDefinition(obj)) { CsmNamespaceDefinition nsd = (CsmNamespaceDefinition) obj; // return false if we're not inside the namespace scope if (offset <= CsmObjectAttributeQuery.getDefault().getLeftBracketOffset(nsd)) { return false; } } if (offset == offs.getEndOffset()) { if (CsmKindUtilities.isType(obj)) { CsmType type = (CsmType)obj; // we do not accept type if offset is after '*', '&' or '[]' return !type.isPointer() && !type.isReference() && (type.getArrayDepth() == 0); } else if (endsWithBrace(offs)) { // if we right after closed "}" it means we are out of scope object return false; } } return true; } else { return false; } }