@Override public CsmFile getContainingFile() { return type.getContainingFile(); }
@Override public CsmFile getContainingFile() { return instantiatedType.getContainingFile(); }
@Override public CsmFile getContainingFile() { return type.getContainingFile(); }
@Override public CsmFile getContainingFile() { return lastType.getContainingFile(); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o instanceof CsmType) { CsmType t = (CsmType) o; return delegate.equals(t) && container.equals(t.getContainingFile()) && (start == t.getStartOffset()) && (end == t.getEndOffset()); } return false; }
public TypeBasedSpecializationParameterImpl(CsmType type, CsmScope scope) { super(type.getContainingFile(), type.getStartOffset(), type.getEndOffset()); this.type = type; if ((scope instanceof CsmIdentifiable)) { this.scope = UIDCsmConverter.scopeToUID(scope); } else { this.scope = null; } }
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 ConversionCategory getWorstConversion(CsmType from, CsmType to) { if (CsmUtilities.checkTypesEqual(from, from.getContainingFile(), to, to.getContainingFile(), new CsmUtilities.ExactMatchQualsEqualizer())) { return ConversionCategory.Identity; } else if (CsmUtilities.checkTypesEqual(from, from.getContainingFile(), to, to.getContainingFile(), new CsmUtilities.AssignableQualsEqualizer())) { return ConversionCategory.Qualification; } else if (CsmKindUtilities.isTemplateParameterType(to)) { return ConversionCategory.Template; } if (isAssignable(from, to)) { CsmClassifier fromCls = from.getClassifier(); CsmClassifier toCls = to.getClassifier(); if (CsmCompletion.isPrimitiveClass(toCls) && CsmCompletion.isPrimitiveClass(fromCls)) { if (isPromotion(from.getClassifierText().toString(), to.getClassifierText().toString())) { return ConversionCategory.Promotion; } else { return ConversionCategory.StandardConversion; } } return ConversionCategory.UserDefinedConversion; } return ConversionCategory.NotConvertable; }
protected CsmClassifier getCastOperatorCastEntity(CsmFunction operator) { assert CsmKindUtilities.isCastOperator(operator) : "Must be cast operator!"; // NOI18N CsmType retType = operator.getReturnType(); CsmClassifier castClassifier = retType != null ? CsmClassifierResolver.getDefault().getTypeClassifier(retType, retType.getContainingFile(), retType.getStartOffset(), true) : null; if (!checkResolvedClassifier(castClassifier) || (CsmKindUtilities.isTemplateParameter(castClassifier) && !retType.isTemplateBased())) { retType = CsmExpressionResolver.resolveType(retType.getText(), retType.getContainingFile(), retType.getStartOffset(), null); castClassifier = retType != null ? CsmClassifierResolver.getDefault().getTypeClassifier(retType, retType.getContainingFile(), retType.getStartOffset(), true) : null; } if (!checkResolvedClassifier(castClassifier)) { castClassifier = null; } return castClassifier; }
private static CsmClass resolveInitializerContext(List<Token<TokenId>> identSequence, CsmClass context) { for (Token<TokenId> ident : identSequence) { CsmClassifier classifier = null; if (ident.text() != null) { String fieldName = ident.text().toString(); for (CsmMember csmMember : context.getMembers()) { if (CsmKindUtilities.isField(csmMember) && fieldName.equals(csmMember.getName().toString())) { CsmType fieldType = ((CsmField)csmMember).getType(); if (fieldType != null) { classifier = CsmBaseUtilities.getOriginalClassifier(fieldType.getClassifier(), fieldType.getContainingFile()); } break; } } } if (CsmKindUtilities.isClass(classifier)) { context = (CsmClass) classifier; } if (classifier == null) { context = null; // error happened break; } } return context; }
retType = CsmExpressionResolver.resolveType( retType.getClassifierText(), retType.getContainingFile(), retType.getStartOffset(), ctx.getContextScope(),
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; }
TypeImpl(CsmType type) { super(type.getContainingFile(), type.getStartOffset(), type.getEndOffset()); this.pointerDepth = (byte) type.getPointerDepth(); this.constQualifiers = type.isConst() ? 1 : 0; setFlags(FLAGS_REFERENCE, type.isReference()); this.arrayDepth = (byte) type.getArrayDepth(); setFlags(FLAGS_CONST, type.isConst()); if (type instanceof TypeImpl) { TypeImpl ti = (TypeImpl) type; setFlags(FLAGS_TYPE_OF_TYPEDEF, ti.isTypeOfTypedef()); setFlags(FLAGS_TYPE_WITH_CLASSIFIER, ti.isTypeWithClassifier()); this.classifierUID = ti.classifierUID; this.qname = ti.qname; this.classifierText = ti.classifierText; addAllInstantiationParams(ti.instantiationParams); } trimInstantiationParams(); }