/** * Returns a deep clone of this {@link ARaiseErrorStmIR} node. * @return a deep clone of this {@link ARaiseErrorStmIR} node */ public ARaiseErrorStmIR clone() { return new ARaiseErrorStmIR( _sourceNode, _tag, _metaData, cloneNode(_error) ); }
/** * Creates a deep clone of this {@link ARaiseErrorStmIR} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link ARaiseErrorStmIR} node */ public ARaiseErrorStmIR clone(Map<INode,INode> oldToNewMap) { ARaiseErrorStmIR node = new ARaiseErrorStmIR( _sourceNode, _tag, _metaData, cloneNode(_error, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
private ARaiseErrorStmIR consRaiseStm(String prefix, String fieldName) { AMissingMemberRuntimeErrorExpIR missingMember = new AMissingMemberRuntimeErrorExpIR(); missingMember.setType(new AErrorTypeIR()); missingMember.setMessage(prefix + fieldName); ARaiseErrorStmIR raise = new ARaiseErrorStmIR(); raise.setError(missingMember); return raise; }
public SStmIR consIotaError(String msg) { AIotaRuntimeErrorExpIR error = new AIotaRuntimeErrorExpIR(); error.setType(new AErrorTypeIR()); error.setMessage(msg); ARaiseErrorStmIR raise = new ARaiseErrorStmIR(); raise.setError(error); return raise; } }
@Override public List<SStmIR> getPostOuterBlockStms(AIdentifierVarExpIR setVar, List<SPatternIR> patterns) { ALetBeStNoBindingRuntimeErrorExpIR noBinding = new ALetBeStNoBindingRuntimeErrorExpIR(); noBinding.setType(new AErrorTypeIR()); ARaiseErrorStmIR raise = new ARaiseErrorStmIR(); raise.setError(noBinding); AIfStmIR ifStm = new AIfStmIR(); ifStm.setIfExp(transAssist.consBoolCheck(successVarName, true)); ifStm.setThenStm(raise); return packStm(ifStm); } }
private void mismatchHandling(SPatternIR pattern, PatternBlockData patternData) { if (!patternData.IsRootPattern(pattern)) { return; } if (patternData.getMismatchHandling() == MismatchHandling.RAISE_ERROR) { APatternMatchRuntimeErrorExpIR matchFail = new APatternMatchRuntimeErrorExpIR(); matchFail.setType(new AErrorTypeIR()); matchFail.setMessage(config.getMatchFailedMessage(pattern)); ARaiseErrorStmIR noMatchStm = new ARaiseErrorStmIR(); noMatchStm.setError(matchFail); AIfStmIR consMismatchCheck = consMismatchCheck(patternData.getSuccessVar(), noMatchStm); patternData.getDeclBlock().getStatements().add(consMismatchCheck); } else if (patternData.getMismatchHandling() == MismatchHandling.LOOP_CONTINUE) { AIfStmIR consMismatchCheck = consMismatchCheck(patternData.getSuccessVar(), new AContinueStmIR()); patternData.getDeclBlock().getStatements().add(consMismatchCheck); } }
runtimeError.setMessage(String.format("Precondition failure: pre_%s", node.getName())); ARaiseErrorStmIR raiseError = new ARaiseErrorStmIR(); raiseError.setError(runtimeError);
matchFail.setType(new AErrorTypeIR()); matchFail.setMessage(config.getMatchFailedMessage(firstOriginal)); ARaiseErrorStmIR noMatchStm = new ARaiseErrorStmIR(); noMatchStm.setError(matchFail);