Search in sources :

Example 1 with MethodSelectorX

use of ast.Ast.MethodSelectorX in project L42 by ElvisResearchGroup.

the class GuessTypeCore method visit.

@Override
public Type visit(MCall s) {
    Type former = s.getInner().accept(this);
    if (former == null) {
        return null;
    }
    Path path = former.getPath();
    assert path != null;
    List<MethodSelectorX> msl = new ArrayList<>();
    MethodSelectorX msx = new MethodSelectorX(s.getS(), "");
    msl.add(msx);
    MethodWithType meth = (MethodWithType) p.extractClassB(path)._getMember(s.getS());
    if (meth == null) {
        return null;
    }
    return (Type) From.fromT(meth.getMt().getReturnType(), path);
}
Also used : Path(ast.Ast.Path) Type(ast.Ast.Type) MethodWithType(ast.ExpCore.ClassB.MethodWithType) MethodSelectorX(ast.Ast.MethodSelectorX) ArrayList(java.util.ArrayList) MethodWithType(ast.ExpCore.ClassB.MethodWithType)

Example 2 with MethodSelectorX

use of ast.Ast.MethodSelectorX in project L42 by ElvisResearchGroup.

the class ToAst method parseType.

private Type parseType(TContext t) {
    if (t.concreteT() != null) {
        ConcreteTContext tt = t.concreteT();
        Doc d = parseDoc(tt.docsOpt());
        Ast.Type nt = new Ast.Type(Mdf.fromString((tt.Mdf() == null) ? "" : nameK(tt.Mdf())), Ast.Path.sugarParse(nameU(tt.Path())), d);
        if (tt.Ph() == null) {
            return nt;
        }
        return Functions.toPh(nt);
    }
    if (t.historicalT() != null) {
        HistoricalTContext tt = t.historicalT();
        Doc d = parseDoc(tt.docsOpt());
        Path p = ast.Ast.Path.sugarParse(nameU(tt.Path()));
        List<MethodSelectorX> mss = new ArrayList<MethodSelectorX>();
        for (HistoricalSeqContext ms : tt.historicalSeq()) {
            mss.add(parseMethSelectorX(ms));
        }
        //return new ast.Ast.HistoricType(p,mss,d);
        throw Assertions.codeNotReachable();
    }
    throw Assertions.codeNotReachable();
}
Also used : Path(ast.Ast.Path) Type(ast.Ast.Type) Ast(ast.Ast) MethodSelectorX(ast.Ast.MethodSelectorX) Doc(ast.Ast.Doc) Type(ast.Ast.Type)

Aggregations

MethodSelectorX (ast.Ast.MethodSelectorX)2 Path (ast.Ast.Path)2 Type (ast.Ast.Type)2 Ast (ast.Ast)1 Doc (ast.Ast.Doc)1 MethodWithType (ast.ExpCore.ClassB.MethodWithType)1 ArrayList (java.util.ArrayList)1