@Override public ValueList caseAIsOfClassExp(AIsOfClassExp exp, ObjectContext ctxt) throws AnalysisException { return exp.getExp().apply(THIS, ctxt); }
public LexNameList caseAIsOfClassExp(AIsOfClassExp expression) throws org.overture.ast.analysis.AnalysisException { return af.createPExpAssistant().getOldNames(expression.getExp()); }
@Override public PExp caseAIsOfClassExp(AIsOfClassExp exp, Integer lineno) throws AnalysisException { PExp found = findExpressionBaseCase(exp, lineno); if (found != null) { return found; } return exp.getExp().apply(THIS, lineno); }
/** * Called by the {@link AIsOfClassExp} node from {@link AIsOfClassExp#apply(IAnalysis)}. * @param node the calling {@link AIsOfClassExp} node */ public void caseAIsOfClassExp(AIsOfClassExp node) throws AnalysisException { _visitedNodes.add(node); inAIsOfClassExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getClassName() != null ) { node.getClassName().apply(this); } if(node.getClassType() != null && !_visitedNodes.contains(node.getClassType())) { node.getClassType().apply(this); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this); } outAIsOfClassExp(node); }
/** * Called by the {@link AIsOfClassExp} node from {@link AIsOfClassExp#apply(IAnalysis)}. * @param node the calling {@link AIsOfClassExp} node */ public void caseAIsOfClassExp(AIsOfClassExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inAIsOfClassExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getClassName() != null ) { node.getClassName().apply(this, question); } if(node.getClassType() != null && !_visitedNodes.contains(node.getClassType())) { node.getClassType().apply(this, question); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this, question); } outAIsOfClassExp(node, question); }
/** * Called by the {@link AIsOfClassExp} node from {@link AIsOfClassExp#apply(IPOFAnalysis)}. * @param node the calling {@link AIsOfClassExp} node */ public void caseAIsOfClassExp(AIsOfClassExp node) throws AnalysisException { _visitedNodes.add(node); inAIsOfClassExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getClassName() != null ) { node.getClassName().apply(this); } if(node.getClassType() != null && !_visitedNodes.contains(node.getClassType())) { node.getClassType().apply(this); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this); } outAIsOfClassExp(node); }
@Override public SExpIR caseAIsOfClassExp(AIsOfClassExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); AClassType classType = node.getClassType(); PExp objRef = node.getExp(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); STypeIR classTypeCg = classType.apply(question.getTypeVisitor(), question); if (!(classTypeCg instanceof AClassTypeIR)) { log.error("Unexpected class type encountered for " + AIsOfClassExp.class.getName() + ". Expected class type: " + AClassTypeIR.class.getName() + ". Got: " + typeCg.getClass().getName() + " at " + node.getLocation()); } SExpIR objRefCg = objRef.apply(question.getExpVisitor(), question); AIsOfClassExpIR instanceOfExp = new AIsOfClassExpIR(); instanceOfExp.setType(typeCg); instanceOfExp.setCheckedType(classTypeCg); instanceOfExp.setExp(objRefCg); return instanceOfExp; }
/** * Called by the {@link AIsOfClassExp} node from {@link AIsOfClassExp#apply(IAnalysis)}. * @param node the calling {@link AIsOfClassExp} node */ public A caseAIsOfClassExp(AIsOfClassExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAIsOfClassExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getClassName() != null ) { mergeReturns(retVal,node.getClassName().apply(this)); } if(node.getClassType() != null && !_visitedNodes.contains(node.getClassType())) { mergeReturns(retVal,node.getClassType().apply(this)); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { mergeReturns(retVal,node.getExp().apply(this)); } mergeReturns(retVal,outAIsOfClassExp(node)); return retVal; }
/** * Called by the {@link AIsOfClassExp} node from {@link AIsOfClassExp#apply(IAnalysis)}. * @param node the calling {@link AIsOfClassExp} node */ public A caseAIsOfClassExp(AIsOfClassExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAIsOfClassExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getClassName() != null ) { mergeReturns(retVal,node.getClassName().apply(this, question)); } if(node.getClassType() != null && !_visitedNodes.contains(node.getClassType())) { mergeReturns(retVal,node.getClassType().apply(this, question)); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { mergeReturns(retVal,node.getExp().apply(this, question)); } mergeReturns(retVal,outAIsOfClassExp(node, question)); return retVal; }
@Override public PType caseAIsOfClassExp(AIsOfClassExp node, TypeCheckInfo question) throws AnalysisException { ILexNameToken classname = node.getClassName(); PDefinition cls = question.env.findType(classname, null); if (cls == null || !(cls instanceof SClassDefinition)) { TypeCheckerErrors.report(3115, "Undefined class type: " + classname.getName(), node.getLocation(), node); } else { node.setClassType((AClassType) cls.getType()); } question.qualifiers = null; PType rt = node.getExp().apply(THIS, question.newConstraint(null)); if (!question.assistantFactory.createPTypeAssistant().isClass(rt, question.env)) { TypeCheckerErrors.report(3266, "Argument is not an object", node.getExp().getLocation(), node.getExp()); } node.setType(AstFactory.newABooleanBasicType(node.getLocation())); return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }
@Override public Value caseAIsOfClassExp(AIsOfClassExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); node.getClassName().getLocation().hit(); try { Value v = node.getExp().apply(VdmRuntime.getExpressionEvaluator(), ctxt).deref(); if (!(v instanceof ObjectValue)) { return new BooleanValue(false); } ObjectValue ov = v.objectValue(ctxt); return new BooleanValue(isOfClass(ov, node.getClassName().getName())); } catch (ValueException e) { return VdmRuntimeError.abort(node.getLocation(), e); } }