Search in sources :

Example 6 with Decl

use of org.abs_models.frontend.ast.Decl in project abstools by abstools.

the class ParFnAppTest method sameAnonTwiceTwoExpansions.

@Test
public void sameAnonTwiceTwoExpansions() {
    Model m = testExpand(parse("apply((Int i) => i)(1);" + "apply((Int i) => i)(1);", applyFunction()));
    ModuleDecl module = m.lookupModule("UnitTest");
    int foundExpansions = 0;
    for (Decl decl : module.getDecls()) {
        if (decl instanceof FunctionDecl) {
            FunctionDecl fun = (FunctionDecl) decl;
            if (fun.getName().startsWith("apply_")) {
                ++foundExpansions;
            }
        }
    }
    assertEquals(2, foundExpansions);
}
Also used : Model(org.abs_models.frontend.ast.Model) ModuleDecl(org.abs_models.frontend.ast.ModuleDecl) ModuleDecl(org.abs_models.frontend.ast.ModuleDecl) FunctionDecl(org.abs_models.frontend.ast.FunctionDecl) Decl(org.abs_models.frontend.ast.Decl) FunctionDecl(org.abs_models.frontend.ast.FunctionDecl) Test(org.junit.Test)

Aggregations

Decl (org.abs_models.frontend.ast.Decl)6 FunctionDecl (org.abs_models.frontend.ast.FunctionDecl)6 DataTypeDecl (org.abs_models.frontend.ast.DataTypeDecl)4 Model (org.abs_models.frontend.ast.Model)4 Test (org.junit.Test)4 DeltaDecl (org.abs_models.frontend.ast.DeltaDecl)3 ParametricDataTypeDecl (org.abs_models.frontend.ast.ParametricDataTypeDecl)3 TypeSynDecl (org.abs_models.frontend.ast.TypeSynDecl)3 ModuleDecl (org.abs_models.frontend.ast.ModuleDecl)2 ArrayList (java.util.ArrayList)1 WrongProgramArgumentException (org.abs_models.common.WrongProgramArgumentException)1 SemanticConditionList (org.abs_models.frontend.analyser.SemanticConditionList)1 DataConstructor (org.abs_models.frontend.ast.DataConstructor)1 DataConstructorExp (org.abs_models.frontend.ast.DataConstructorExp)1 ExpFunctionDef (org.abs_models.frontend.ast.ExpFunctionDef)1 Feature (org.abs_models.frontend.ast.Feature)1 List (org.abs_models.frontend.ast.List)1 PartialFunctionDecl (org.abs_models.frontend.ast.PartialFunctionDecl)1 ProductDecl (org.abs_models.frontend.ast.ProductDecl)1 ProductLine (org.abs_models.frontend.ast.ProductLine)1