use of org.abs_models.frontend.ast.PureExp in project abstools by abstools.
the class JavaGeneratorHelper method generateAwaitAsyncCall.
public static void generateAwaitAsyncCall(PrintStream stream, AwaitAsyncCall call) {
final PureExp callee = call.getCallee();
final List<PureExp> params = call.getParams();
final MethodSig sig = call.getMethodSig();
final List<Annotation> annotations = call.getAnnotations();
// FIXME: implement await, assignment afterwards
// OutputStream exprOStream = new ByteArrayOutputStream();
// PrintStream exprStream = new PrintStream(exprOStream);
// ClaimGuard guard = new ClaimGuard();
// // Necessary temporary variables are written to "stream" and the
// // await-expression is written to exprStream
//
// // FIXME: implement await, assignment afterwards
// guard.generateJavaGuard(stream, exprStream);
// stream.print(JavaBackendConstants.ABSRUNTIME + ".await(");
// stream.print(exprOStream.toString());
// stream.println(");");
generateAsyncCall(stream, null, callee, callee.getType(), params, null, sig, annotations);
}
use of org.abs_models.frontend.ast.PureExp in project abstools by abstools.
the class JavaGeneratorHelper method generateArgs.
public static void generateArgs(PrintStream stream, String firstArg, List<PureExp> args, java.util.List<Type> types) {
stream.print("(");
boolean first = true;
if (firstArg != null) {
stream.print(firstArg);
first = false;
}
for (int i = 0; i < args.getNumChild(); i++) {
PureExp e = args.getChild(i);
if (!first)
stream.print(", ");
e.generateJava(stream);
if (types.get(i).isIntType() && e.getType().isRatType())
stream.print(".truncate()");
first = false;
}
stream.print(")");
}
use of org.abs_models.frontend.ast.PureExp in project abstools by abstools.
the class JavaGeneratorHelper method generateExprGuard.
public static void generateExprGuard(ExpGuard expGuard, PrintStream beforeAwaitStream, PrintStream stream) {
PureExp expr = expGuard.getPureExp();
replaceLocalVariables((PureExp) expr.copy(), beforeAwaitStream);
stream.print("new " + JavaBackendConstants.EXPGUARD + "() { public " + ABSBool.class.getName() + " evaluateExp() { return ");
expGuard.getPureExp().generateJava(stream);
stream.print("; }}");
}
use of org.abs_models.frontend.ast.PureExp in project abstools by abstools.
the class TreeUtilsTest method findChildrenListLazy.
@Test
public void findChildrenListLazy() {
Model model = assertParse("def Int test(Int i) = test(1);");
FunctionDecl functionDecl = getLastFunctionDecl(model);
assertEquals("test", functionDecl.getName());
List<PureExp> children = functionDecl.getFunctionDef().findChildren(PureExp.class, true);
assertEquals(1, children.size());
assertTrue(children.get(0) instanceof FnApp);
}
use of org.abs_models.frontend.ast.PureExp in project abstools by abstools.
the class TreeUtilsTest method findChildrenList.
@Test
public void findChildrenList() {
Model model = assertParse("def Int test(Int i) = test(1);");
FunctionDecl functionDecl = getLastFunctionDecl(model);
assertEquals("test", functionDecl.getName());
List<PureExp> children = functionDecl.getFunctionDef().findChildren(PureExp.class);
assertEquals(2, children.size());
}
Aggregations