private CsmFunctional lookForVariableOperator(CsmVariable object) { CsmType varType = ((CsmVariable) object).getType(); return lookForOperator(varType); }
if (CsmKindUtilities.isVariableDeclaration(param)) { CsmVariable var = (CsmVariable) param; CsmType type = var.getType(); if (type != null) { sb.append(type.getCanonicalText());
private CharSequence getVariableText(CsmVariable var) { CharSequence itemText = var.getText(); if (CsmUtilities.isAutoType(var.getType())) { DisplayResolvedTypeHandler handler = new DisplayResolvedTypeHandler(); CsmExpressionResolver.resolveType( var.getName(), var.getContainingFile(), var.getType().getEndOffset(), null, handler ); if (handler.typeText != null) { return handler.typeText; } } return itemText; }
CsmType type = var.getType(); if (type != null) { CsmClassifier clsfr = type.getClassifier();
if (CsmKindUtilities.isVariable(element)) { CsmVariable field = (CsmVariable) element; htmlHeader = field.getName().toString() + " : " + field.getType().getText(); //NOI18N } else if (CsmKindUtilities.isFunction(element)) { CsmFunction method = (CsmFunction) element;
public static CsmClass getContextClass(Node[] activatedNodes){ CsmObject decl; if (ContextUtils.USE_REFERENCE_RESOLVER) { CsmReference ref = ContextUtils.findReference(activatedNodes[0]); if (isSupportedReference(ref)) { decl = ref.getReferencedObject(); if (CsmKindUtilities.isClass(decl)){ return (CsmClass)decl; } else if (CsmKindUtilities.isVariable(decl)){ CsmVariable v = (CsmVariable)decl; CsmType type = v.getType(); // could be null type for parameter with vararg "..." type CsmClassifier cls = type == null ? null : type.getClassifier(); if (CsmKindUtilities.isClass(cls)){ return (CsmClass)cls; } } } } decl = ContextUtils.findDeclaration(activatedNodes[0]); if (CsmKindUtilities.isClass(decl)){ return (CsmClass)decl; } return null; }
public static CsmDeclaration findDeclaration(CsmObject obj) { if (obj == null) { return null; } CsmClassifier clazz = null; if (CsmKindUtilities.isVariable(obj)) { CsmVariable var = (CsmVariable)obj; // pass for further handling as type object obj = var.getType(); } if (CsmKindUtilities.isType(obj)) { // clazz = ((CsmType)obj).getClassifier(); } else if (CsmKindUtilities.isClassForwardDeclaration(obj)) { clazz = ((CsmClassForwardDeclaration)obj).getCsmClass(); } else if (CsmKindUtilities.isEnumForwardDeclaration(obj)) { clazz = ((CsmEnumForwardDeclaration) obj).getCsmEnum(); } else if (CsmKindUtilities.isClass(obj)) { clazz = (CsmClassifier)obj; } else if (CsmKindUtilities.isInheritance(obj)) { clazz = ((CsmInheritance)obj).getClassifier(); } return clazz; }
private static CsmObject exploreTypeObject(CsmContext context, CsmObject last, int offset) { if (CsmKindUtilities.isTypedefOrTypeAlias(last)) { CsmType type = ((CsmTypedef) last).getType(); if (CsmKindUtilities.isFunctionPointerType(type)) { CsmObject inner = updateAndFindInFunctionType(context, (CsmFunctionPointerType) type, offset); if (inner != null) { last = inner; } } } else if (CsmKindUtilities.isVariable(last)) { CsmType type = ((CsmVariable) last).getType(); if (CsmKindUtilities.isFunctionPointerType(type)) { CsmObject inner = updateAndFindInFunctionType(context, (CsmFunctionPointerType) type, offset); if (inner != null) { last = inner; } } } else if (CsmKindUtilities.isFunctionPointerType(last)) { CsmObject inner = updateAndFindInFunctionType(context, (CsmFunctionPointerType) last, offset); if (inner != null) { last = inner; } } return last; }
/** 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; }
if(item.getAssociatedObject() instanceof CsmObject && CsmKindUtilities.isVariable((CsmObject)item.getAssociatedObject())) { CsmVariable var = (CsmVariable)item.getAssociatedObject(); if(var.getType() != null) { CsmClassifier cls = (CsmClassifier) var.getType().getClassifier(); cls = CsmBaseUtilities.getOriginalClassifier(cls, getFinder().getCsmFile()); if(CsmKindUtilities.isClass(cls)) {
CsmType type = CsmKindUtilities.isVariable(objUnderOffset) ? ((CsmVariable) objUnderOffset).getType() : ((CsmTypedef) objUnderOffset).getType(); CsmParameter parameter = null; boolean repeat; if ((var.getInitialValue() == null) && (var.getType() != null) && (var.getType().getArrayDepth() == 0)) { csmItem = var;
CsmVariable var = (CsmVariable) context.getLastObject(); CsmClassifier classifier = CsmBaseUtilities.getOriginalClassifier(var.getType().getClassifier(), var.getContainingFile());
CsmType type = ((CsmVariable)lastObj).getType(); if (!CsmOffsetUtilities.sameOffsets(lastObj, type) && CsmOffsetUtilities.isInObject(type, offset)) {