Search in sources :

Example 1 with MethodImplemented

use of ast.Expression.ClassB.MethodImplemented in project L42 by ElvisResearchGroup.

the class Desugar method visit.

public MethodImplemented visit(MethodImplemented mi) {
    this.usedVars = new HashSet<String>();
    this.varEnv = new HashMap<String, Type>();
    String mName = desugarName(mi.getS().nameToS());
    mi = mi.withS(mi.getS().withName(mName));
    for (String name : mi.getS().getNames()) {
        usedVars.add(name);
        List<Ast.MethodSelectorX> msxsi = new ArrayList<>();
        msxsi.add(new Ast.MethodSelectorX(mi.getS(), name));
        varEnv.put(name, null);
    }
    usedVars.add("this");
    List<Ast.MethodSelectorX> msxsi = new ArrayList<>();
    msxsi.add(new Ast.MethodSelectorX(mi.getS(), "this"));
    //varEnv.put("this",new Ast.HistoricType(Path.outer(0),msxsi,Doc.empty()));
    List<Ast.MethodSelectorX> msxs = new ArrayList<>();
    msxs.add(new Ast.MethodSelectorX(mi.getS(), ""));
    usedVars.addAll(CollectDeclaredVars.of(mi.getInner()));
    //final restrictions
    final MethodImplemented mi2 = mi;
    return withExpectedType(null, () -> super.visit(mi2));
//well... this is an issue> method desugaring for method implemented does not know its return type?
}
Also used : Type(ast.Ast.Type) MethodWithType(ast.Expression.ClassB.MethodWithType) MethodType(ast.Ast.MethodType) MethodImplemented(ast.Expression.ClassB.MethodImplemented) Ast(ast.Ast) MethodSelectorX(ast.Ast.MethodSelectorX) ArrayList(java.util.ArrayList) MethodSelectorX(ast.Ast.MethodSelectorX)

Aggregations

Ast (ast.Ast)1 MethodSelectorX (ast.Ast.MethodSelectorX)1 MethodType (ast.Ast.MethodType)1 Type (ast.Ast.Type)1 MethodImplemented (ast.Expression.ClassB.MethodImplemented)1 MethodWithType (ast.Expression.ClassB.MethodWithType)1 ArrayList (java.util.ArrayList)1