Search in sources :

Example 11 with SkipStmt

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

the class TraitTest method addRemoveModifyMethod.

@Test
public void addRemoveModifyMethod() {
    Model model = assertParseOk("module M;" + "trait T = {Unit myMethod(){ println(\"\"); }} " + "trait T3 = T modifies { Unit myMethod(){ skip; }} " + "class C { uses T3;  }");
    ClassDecl cls = (ClassDecl) findDecl(model, "M", "C");
    assertNotNull(cls);
    assertTrue(cls.getMethods().getNumChild() == 0);
    model.applyTraits();
    assertTrue(cls.getMethods().getNumChild() == 1);
    assertTrue(cls.getMethod(0).getBlock().getStmt(0) instanceof SkipStmt);
}
Also used : ClassDecl(abs.frontend.ast.ClassDecl) Model(abs.frontend.ast.Model) SkipStmt(abs.frontend.ast.SkipStmt) Test(org.junit.Test)

Aggregations

ClassDecl (abs.frontend.ast.ClassDecl)11 Model (abs.frontend.ast.Model)11 SkipStmt (abs.frontend.ast.SkipStmt)11 Test (org.junit.Test)11 Block (abs.frontend.ast.Block)2 CompilationUnit (abs.frontend.ast.CompilationUnit)2 DeltaAccess (abs.frontend.ast.DeltaAccess)2 DeltaDecl (abs.frontend.ast.DeltaDecl)2 List (abs.frontend.ast.List)2 MethodImpl (abs.frontend.ast.MethodImpl)2 MethodSig (abs.frontend.ast.MethodSig)2 ModifyClassModifier (abs.frontend.ast.ModifyClassModifier)2 AddMethodModifier (abs.frontend.ast.AddMethodModifier)1 ModifyMethodModifier (abs.frontend.ast.ModifyMethodModifier)1