@Override public String caseAValueDefinition(AValueDefinition node, PrettyPrinterEnv question) throws AnalysisException { StringBuilder sb = new StringBuilder(question.getIdent()); sb.append(node.getPattern() + (node.getType() == null ? "" : ":" + node.getType().apply(typePrinter, question)) + (node.getExpression() != null ? " = " + node.getExpression() : ""));// node.toString()); return sb.toString() + ";"; }
public ValueBindingObligation(AValueDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { this(def.getPattern(), def.getType(), def.getExpression(), ctxt, af); }
@Override public PExp caseAValueDefinition(AValueDefinition def, Integer lineno) throws AnalysisException { return af.createPExpAssistant().findExpression(def.getExpression(), lineno); }
@Override public ValueList caseAValueDefinition(AValueDefinition def, ObjectContext ctxt) throws AnalysisException { return af.createPExpAssistant().getValues(def.getExpression(), ctxt); }
@Override public LexNameList caseAValueDefinition(AValueDefinition def) throws AnalysisException { return af.createPExpAssistant().getOldNames(def.getExpression()); }
@Override public LexNameSet caseAValueDefinition(AValueDefinition node, FreeVarInfo info) throws AnalysisException { LexNameSet names = new LexNameSet(); if (node.getType() != null) { names.addAll(node.getType().apply(this, info)); } names.addAll(node.getExpression().apply(this, info)); return names; }
if(node.getExpression() != null && !_visitedNodes.contains(node.getExpression())) node.getExpression().apply(this);
if(node.getExpression() != null && !_visitedNodes.contains(node.getExpression())) node.getExpression().apply(this);
if(node.getExpression() != null && !_visitedNodes.contains(node.getExpression())) node.getExpression().apply(this, question);
private AVarDeclIR consLocalVarDecl(AValueDefinition valueDef, IRInfo question) throws AnalysisException { STypeIR type = valueDef.getType().apply(question.getTypeVisitor(), question); SPatternIR pattern = valueDef.getPattern().apply(question.getPatternVisitor(), question); SExpIR exp = valueDef.getExpression().apply(question.getExpVisitor(), question); return consLocalVarDecl(valueDef, type, pattern, exp); }
if(node.getExpression() != null && !_visitedNodes.contains(node.getExpression())) mergeReturns(retVal,node.getExpression().apply(this));
if(node.getExpression() != null && !_visitedNodes.contains(node.getExpression())) mergeReturns(retVal,node.getExpression().apply(this, question));
@Override public SDeclIR caseAValueDefinition(AValueDefinition node, IRInfo question) throws AnalysisException { String access = node.getAccess().getAccess().toString(); String name = node.getPattern().toString(); boolean isStatic = true; boolean isFinal = true; PType type = node.getType(); PExp exp = node.getExpression(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); SExpIR expCg = exp.apply(question.getExpVisitor(), question); return question.getDeclAssistant().constructField(access, name, isStatic, isFinal, typeCg, expCg); }
@Override public NameValuePairList caseAValueDefinition(AValueDefinition def, Context initialContext) throws AnalysisException { Value v = null; try { // UpdatableValues are constantized as they cannot be updated. v = def.getExpression().apply(VdmRuntime.getExpressionEvaluator(), initialContext).convertTo(af.createPDefinitionAssistant().getType(def), initialContext).getConstant(); return af.createPPatternAssistant().getNamedValues(def.getPattern(), v, initialContext); } catch (ValueException e) { VdmRuntimeError.abort(def.getLocation(), e); } catch (PatternMatchException e) { VdmRuntimeError.abort(e, initialContext); } catch (AnalysisException e) { } return null; }
PType expType = node.getExpression().apply(THIS, question); ExcludedDefinitions.clearExcluded(); node.setExpType(expType); TypeCheckerErrors.report(3048, "Expression does not return a value", node.getExpression().getLocation(), node.getExpression()); } else if (type != null && !(type instanceof AUnknownType))
PExp exp = node.getExpression(); obligations.addAll(exp.apply(rootVisitor, question));