Search in sources :

Example 1 with AwaitAsyncCall

use of abs.frontend.ast.AwaitAsyncCall in project abstools by abstools.

the class OtherAnalysisTests method awaitRewriteDecl2.

@Test
public void awaitRewriteDecl2() throws Exception {
    String deltaDecl = "delta D; modifies class C { adds Unit m() { return await this!m();}}";
    Model m = assertParseOk(deltaDecl);
    DeltaDecl d = m.findDelta("D");
    AwaitAsyncCall a = (AwaitAsyncCall) down(d);
    // pity, would like this to work.
    assertNotNull(a);
}
Also used : Model(abs.frontend.ast.Model) AwaitAsyncCall(abs.frontend.ast.AwaitAsyncCall) DeltaDecl(abs.frontend.ast.DeltaDecl) Test(org.junit.Test) FrontendTest(abs.frontend.FrontendTest)

Example 2 with AwaitAsyncCall

use of abs.frontend.ast.AwaitAsyncCall in project abstools by abstools.

the class OtherAnalysisTests method testContext1.

@Test
public void testContext1() {
    // FIXME: the code in this example is incorrect (no await statement in init block allowed)
    Model m = assertParseOk("data Unit; interface I { Unit m(); } class C implements I {{Unit x = await this!m();}}");
    ClassDecl cd = (ClassDecl) m.lookupModule("UnitTest").getDecl(2);
    AwaitAsyncCall n = (AwaitAsyncCall) down(cd);
    assertNull("Rewrite failed!", n);
}
Also used : ClassDecl(abs.frontend.ast.ClassDecl) Model(abs.frontend.ast.Model) AwaitAsyncCall(abs.frontend.ast.AwaitAsyncCall) Test(org.junit.Test) FrontendTest(abs.frontend.FrontendTest)

Example 3 with AwaitAsyncCall

use of abs.frontend.ast.AwaitAsyncCall in project abstools by abstools.

the class OtherAnalysisTests method testContext2.

@Test
public void testContext2() {
    // FIXME: the code in this example is incorrect (no await statement in init block allowed)
    Model m = assertParseOk("data Unit; interface I { Unit m(); } class C implements I {{Unit x = await this!m();}}");
    ClassDecl cd = (ClassDecl) m.lookupModule("UnitTest").getDecl(2);
    AwaitAsyncCall n = (AwaitAsyncCall) down(cd);
    assertNull("Rewriting failed!", n);
}
Also used : ClassDecl(abs.frontend.ast.ClassDecl) Model(abs.frontend.ast.Model) AwaitAsyncCall(abs.frontend.ast.AwaitAsyncCall) Test(org.junit.Test) FrontendTest(abs.frontend.FrontendTest)

Example 4 with AwaitAsyncCall

use of abs.frontend.ast.AwaitAsyncCall in project abstools by abstools.

the class OtherAnalysisTests method awaitRewriteDecl1.

@Test
public void awaitRewriteDecl1() {
    Model m = assertParseOk("module A; class C { } delta D; modifies class C { adds Unit m() { return await this!m();}}", Config.WITH_STD_LIB);
    DeltaDecl c = m.getDeltaDecls().iterator().next();
    AwaitAsyncCall a = (AwaitAsyncCall) down(c);
    // pity, would like this to work.
    assertNotNull(a);
}
Also used : Model(abs.frontend.ast.Model) AwaitAsyncCall(abs.frontend.ast.AwaitAsyncCall) DeltaDecl(abs.frontend.ast.DeltaDecl) Test(org.junit.Test) FrontendTest(abs.frontend.FrontendTest)

Aggregations

FrontendTest (abs.frontend.FrontendTest)4 AwaitAsyncCall (abs.frontend.ast.AwaitAsyncCall)4 Model (abs.frontend.ast.Model)4 Test (org.junit.Test)4 ClassDecl (abs.frontend.ast.ClassDecl)2 DeltaDecl (abs.frontend.ast.DeltaDecl)2