if(node.getClassdef() != null && !_visitedNodes.contains(node.getClassdef())) node.getClassdef().apply(this);
if(node.getClassdef() != null && !_visitedNodes.contains(node.getClassdef())) node.getClassdef().apply(this, question);
if(node.getClassdef() != null && !_visitedNodes.contains(node.getClassdef())) node.getClassdef().apply(this);
if(node.getClassdef() != null && !_visitedNodes.contains(node.getClassdef())) mergeReturns(retVal,node.getClassdef().apply(this, question));
if(node.getClassdef() != null && !_visitedNodes.contains(node.getClassdef())) mergeReturns(retVal,node.getClassdef().apply(this));
@Override public SExpIR caseANewExp(ANewExp node, IRInfo question) throws AnalysisException { String className = node.getClassdef().getName().getName(); ATypeNameIR typeName = new ATypeNameIR(); typeName.setDefiningClass(null); typeName.setName(className); PType type = node.getType(); LinkedList<PExp> nodeArgs = node.getArgs(); ANewExpIR newExp = new ANewExpIR(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); newExp.setType(typeCg); newExp.setName(typeName); LinkedList<SExpIR> newExpArgs = newExp.getArgs(); for (PExp arg : nodeArgs) { SExpIR argCg = arg.apply(question.getExpVisitor(), question); if (argCg != null) { newExpArgs.add(argCg); } else { return null; } } return newExp; }
@Override public Value caseANewExp(ANewExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); node.getClassName().getLocation().hit(); try { ValueList argvals = new ValueList(); for (PExp arg : node.getArgs()) { argvals.add(arg.apply(VdmRuntime.getExpressionEvaluator(), ctxt)); } ObjectValue objval = ctxt.assistantFactory.createSClassDefinitionAssistant().newInstance(node.getClassdef(), node.getCtorDefinition(), argvals, ctxt); if (objval.invlistener != null) { // Check the initial values of the object's fields objval.invlistener.doInvariantChecks = true; objval.invlistener.changedValue(node.getLocation(), objval, ctxt); } return objval; } catch (ValueException e) { return VdmRuntimeError.abort(node.getLocation(), e); } }
SClassDefinition classdef = node.getClassdef();