public MethodResultItem(CsmFunction mtd, CsmCompletionExpression substituteExp, int priotity, boolean isDeclaration, boolean instantiateTypes) { super(mtd, substituteExp, priotity, isDeclaration, instantiateTypes); typeName = CsmResultItem.getTypeName(mtd.getReturnType(), instantiateTypes); typeColor = CsmResultItem.getTypeColor(mtd.getReturnType()); }
public Function(CsmFunction function, Map<CsmTemplateParameter, CsmSpecializationParameter> mapping) { super(function, mapping); this.retType = createType(function.getReturnType(), Function.this); }
private static String createRightName(CsmMember item) { if (item == null || CsmKindUtilities.isDestructor(item)) { return ""; } else if (CsmKindUtilities.isConstructor(item)) { return ""; } else { return ((CsmFunction)item).getReturnType().getText().toString(); } }
private static String createRightName(CsmFunction item) { if (CsmKindUtilities.isConstructor(item)) { return ""; } else if (CsmKindUtilities.isDestructor(item)) { return ""; } else { return ((CsmFunction)item).getReturnType().getText().toString(); } }
@Override public String getReturnType() { if (CsmKindUtilities.isConstructor(decl) || CsmKindUtilities.isDestructor(decl)) { return null; } return ((CsmFunction)decl).getReturnType().getCanonicalText().toString(); } @Override
txt.append(fun.getReturnType().getText()).append(' '); // NOI18N
String type = ""; if (item != null && !CsmKindUtilities.isConstructor(item) && !CsmKindUtilities.isDestructor(item)) { final CsmType returnType = ((CsmFunction)item).getReturnType(); type = returnType.getText().toString()+" "; //NOI18N if (type.indexOf("::") < 0) { //NOI18N
String type = ""; if (!CsmKindUtilities.isConstructor(item) && !CsmKindUtilities.isDestructor(item)) { final CsmType returnType = ((CsmFunction)item).getReturnType(); type = returnType.getText().toString()+" "; //NOI18N if (!returnType.isTemplateBased()) {
@Override public void initialize() { if (initialized) { return; } CsmFunction fun = ((CsmFunction) CsmRefactoringUtils.getReferencedElement(selectedElement)).getDeclaration(); functionObj = fun; returnType = functionObj.getReturnType().getCanonicalText().toString(); if (CsmKindUtilities.isMethod(functionObj)) { CsmMethod method = (CsmMethod)CsmBaseUtilities.getFunctionDeclaration(functionObj); setModifier(method.getVisibility()); } else { setModifier(CsmVisibility.NONE); } modifiersCombo.setEnabled(false); initTableData(); previewChange.setText(genDeclarationString()); initialized = true; }
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; }
CsmType retType = fun.getReturnType(); boolean isRetTypeDecltype = CsmContextUtilities.checkDecltype(retType); // NOI18N return isRetTypeDecltype || !CsmOffsetUtilities.isInObject(retType, offset);
htmlHeader = method.getSignature().toString(); } else { htmlHeader = method.getSignature() + " : " + method.getReturnType().getText(); //NOI18N
/** returns type for dereferenced object * @param obj * @return */ public static CsmType getObjectType(CsmObject obj, boolean _constIfClassifier) { CsmType type = null; if (CsmKindUtilities.isTypedefOrTypeAlias(obj)) { type = CsmCompletion.createType((CsmClassifier) obj, 0, 0, 0, _constIfClassifier); } else if (CsmKindUtilities.isClassifier(obj)) { type = CsmCompletion.createType((CsmClassifier) obj, 0, 0, 0, _constIfClassifier); } else if (CsmKindUtilities.isFunction(obj)) { CsmFunction fun = (CsmFunction) obj; if (CsmKindUtilities.isConstructor(fun)) { CsmClassifier cls = ((CsmConstructor) obj).getContainingClass(); type = CsmCompletion.createType(cls, 0, 0, 0, false); } else { type = fun.getReturnType(); } } else if (CsmKindUtilities.isVariable(obj)) { type = ((CsmVariable) obj).getType(); } else if (CsmKindUtilities.isEnumerator(obj)) { type = INT_TYPE; } else { type = null; } return type; }
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; }
for (CsmObject csmObject : decls) { if(CsmKindUtilities.isFunction(csmObject)) { varType = ((CsmFunction)csmObject).getReturnType(); break; CsmFunction dereferenceOperator = getOperator(cls, contextFile, endOffset, CsmFunction.OperatorKind.POINTER); if (dereferenceOperator != null) { varType = dereferenceOperator.getReturnType();
CsmFunction opArray = CsmCompletionQuery.getOperator(cls, contextFile, endOffset, CsmFunction.OperatorKind.ARRAY); if (opArray != null) { lastType = opArray.getReturnType(); CsmFunction member = getOperator(cls, contextFile, endOffset, opKind); if (member != null) { lastType = ((CsmFunction)member).getReturnType(); CsmType returnType = contextFunc.getReturnType(); if (findType) { lastType = returnType; lastType = ((CsmFunction) cls).getReturnType(); } else { CsmFunction funCall = cls == null ? null : CsmCompletionQuery.getOperator(cls, contextFile, endOffset, CsmFunction.OperatorKind.CAST); if (funCall != null) { lastType = funCall.getReturnType();
CsmFunction fun = (CsmFunction)lastObj; CsmType retType = fun.getReturnType(); if (!CsmOffsetUtilities.sameOffsets(fun, retType) && CsmOffsetUtilities.isInObject(retType, offset)) { context.setLastObject(retType);