public boolean isNumericType(STypeIR type) { return isInt(type) || isRealOrRat(type); }
public boolean isMapApplication(AApplyExpIR applyExp) { return isMapType(applyExp.getRoot()) && applyExp.getArgs().size() == 1; }
public boolean isSeqApplication(AApplyExpIR applyExp) { return isSeqType(applyExp.getRoot()) && applyExp.getArgs().size() == 1; }
public boolean allowsNull(STypeIR type) { if (type instanceof AUnionTypeIR) { AUnionTypeIR unionType = (AUnionTypeIR) type; if (BooleanUtils.isTrue(unionType.getOptional())) { return true; } for (STypeIR t : unionType.getTypes()) { if (allowsNull(t)) { return true; } } return false; } else { return /* type instanceof AObjectTypeIR || */type != null && (type instanceof AUnknownTypeIR || BooleanUtils.isTrue(type.getOptional()) || isWrapperType(type)); } }
public boolean isCharRead(AApplyExpIR applyExp) { return isStringType(applyExp.getRoot()) && applyExp.getArgs().size() == 1; }
public String formatTemplateParam(INode potentialBasicType) throws AnalysisException { if (potentialBasicType == null) { return ""; } TypeAssistantIR typeAssistant = info.getAssistantManager().getTypeAssistant(); if (potentialBasicType instanceof STypeIR && typeAssistant.isNumericType((STypeIR) potentialBasicType)) { return "Number"; } else if (potentialBasicType instanceof ABoolBasicTypeIR) { return "Boolean"; } else if (potentialBasicType instanceof ACharBasicTypeIR) { return "Character"; } else { return format(potentialBasicType); } }
private boolean varMayBeNull(STypeIR type) { return treatMethod(type) && !getInfo().getTypeAssistant().allowsNull(type); }
private boolean correctArgTypes(List<SExpIR> args, List<STypeIR> paramTypes, boolean sameSize) throws AnalysisException { if (sameSize && args.size() != paramTypes.size()) { return false; } if (transAssistant.getInfo().getAssistantManager().getTypeAssistant().checkArgTypes(transAssistant.getInfo(), args, paramTypes)) { for (int k = 0; k < paramTypes.size(); k++) { SExpIR arg = args.get(k); if (!(arg instanceof ANullExpIR)) { correctTypes(arg, paramTypes.get(k)); } } return true; } return false; }
public AssistantManager() { this.nodeAssistant = new NodeAssistantIR(this); this.expAssistant = new ExpAssistantIR(this); this.declAssistant = new DeclAssistantIR(this); this.stmAssistant = new StmAssistantIR(this); this.typeAssistant = new TypeAssistantIR(this); this.locationAssistant = new LocationAssistantIR(this); this.bindAssistant = new BindAssistantIR(this); this.patternAssistant = new PatternAssistantIR(this); }
possibleTypes = typeAssistant.clearDuplicates(possibleTypes);
public boolean isStringType(STypeIR type) { return info.getAssistantManager().getTypeAssistant().isStringType(type); }
@Override public void defaultInSNumericBinaryExpIR(SNumericBinaryExpIR node) throws AnalysisException { STypeIR expectedType; if (transAssistant.getInfo().getTypeAssistant().isNumericType(node.getType())) { expectedType = node.getType(); } else { expectedType = getExpectedOperandType(node); } correctTypes(node.getLeft(), expectedType); correctTypes(node.getRight(), expectedType); }
if (assistantManager.getTypeAssistant().checkArgTypes(info, args, params))
private String findNumberDereferenceCall(STypeIR type) { if (type == null || type.parent() instanceof AHistoryExpIR) { return ""; } final String DOUBLE_VALUE = ".doubleValue()"; final String LONG_VALUE = ".longValue()"; if (info.getAssistantManager().getTypeAssistant().isInt(type)) { return LONG_VALUE; } else if (info.getAssistantManager().getTypeAssistant().isRealOrRat(type)) { return DOUBLE_VALUE; } else { PTypeAssistantTC typeAssistant = info.getTcFactory().createPTypeAssistant(); SourceNode sourceNode = type.getSourceNode(); if (sourceNode != null && !(sourceNode.getVdmNode() instanceof PType)) { PType vdmType = (PType) sourceNode.getVdmNode(); if (typeAssistant.isNumeric(vdmType)) { return DOUBLE_VALUE; } } return ""; } }
public boolean isStringType(SExpIR exp) { return info.getAssistantManager().getTypeAssistant().isStringType(exp); }
public boolean isMapType(SExpIR exp) { return info.getAssistantManager().getTypeAssistant().isMapType(exp); }
public boolean isSeqType(SExpIR exp) { return info.getAssistantManager().getTypeAssistant().isSeqType(exp); }