use of ast.ExpCore.ClassB in project L42 by ElvisResearchGroup.
the class Functions method encapsulateIn.
public static ClassB.NestedClass encapsulateIn(List<Ast.C> cBar, ClassB elem, Doc doc) {
//on the call side as in "redirectDefinition"
assert !cBar.isEmpty();
List<Ast.C> cBar2 = cBar.subList(1, cBar.size());
if (cBar2.isEmpty()) {
return new ClassB.NestedClass(doc, cBar.get(0), elem, null);
}
List<Member> ms = new ArrayList<>();
ms.add(encapsulateIn(cBar2, elem, doc));
ClassB cb = ClassB.membersClass(ms, Position.noInfo, elem.getPhase());
return new ClassB.NestedClass(Doc.empty(), cBar.get(0), cb, null);
}
use of ast.ExpCore.ClassB in project L42 by ElvisResearchGroup.
the class Functions method originDecOf.
public static Path originDecOf(Program p, MethodSelector ms, ClassB cb) /*normalized*/
{
assert cb.getPhase().subtypeEq(Phase.Norm);
for (Path pi : cb.getSuperPaths()) {
ClassB cbi = p.extractClassB(pi);
MethodWithType m = (MethodWithType) cbi._getMember(ms);
if (m != null && !m.getMt().isRefine()) {
return pi;
}
}
throw Assertions.codeNotReachable();
}
use of ast.ExpCore.ClassB in project L42 by ElvisResearchGroup.
the class TestTypeSystemOk method runTypeSystem.
static ClassB runTypeSystem(String scb1) {
TestHelper.configureForTest();
ClassB cb1 = (ClassB) Desugar.of(Parser.parse(null, scb1)).accept(new InjectionOnCore());
Program p = Program.emptyLibraryProgram();
return TypeSystem.instance().topTypeLib(Phase.Coherent, p.evilPush(cb1));
}
use of ast.ExpCore.ClassB in project L42 by ElvisResearchGroup.
the class TestCloneWithPath method test.
@Test
public void test() {
TestHelper.configureForTest();
ClassB cb1 = getClassB("cb1", _cb1);
ClassB expected = getClassB("expected", _expected);
ClassB result = (ClassB) cb1.accept(new PathAnnotateClass());
TestHelper.assertEqualExp(expected, result);
}
use of ast.ExpCore.ClassB in project L42 by ElvisResearchGroup.
the class TestCoherentClass method testCoherence.
@Test
public void testCoherence() {
ClassB cb1 = (ClassB) (Parser.parse(null, e).accept(new InjectionOnCore()));
Program p = Program.emptyLibraryProgram();
MethodWithType mwt = (MethodWithType) cb1.getMs().get(0);
//boolean res=Functions.coherent(p, mdf, path, mwt);
//Assert.assertEquals(res,ok);
//TODO: disabled for now
}
Aggregations