Search in sources :

Example 61 with ExpCore

use of ast.ExpCore in project L42 by ElvisResearchGroup.

the class Plugin method MliftValue£xthat£xselector£xlib.

@ActionType({ ActionType.NormType.Library, ActionType.NormType.ImmAny, ActionType.NormType.Library, ActionType.NormType.Library })
public Object MliftValue£xthat£xselector£xlib(Object _that, Object _selector, Object _lib) {
    ClassB lib = ensureExtractClassB(_lib);
    MethodSelector selector = MethodSelector.parse(ensureExtractStringU(_selector));
    //TODO: would go in loop for circular graphs?
    ExpCore val = Revertable.doRevert(_that);
    val = From.from(val, Path.outer(1));
    return LiftValue.liftValue(val, selector, lib);
}
Also used : ExpCore(ast.ExpCore) MethodSelector(ast.Ast.MethodSelector) ClassB(ast.ExpCore.ClassB) EncodingHelper.ensureExtractClassB(auxiliaryGrammar.EncodingHelper.ensureExtractClassB) ActionType(platformSpecific.fakeInternet.ActionType)

Example 62 with ExpCore

use of ast.ExpCore in project L42 by ElvisResearchGroup.

the class InjectionOnCore method visit.

public ExpCore visit(Expression.RoundBlock s) {
    Doc doc = s.getDoc();
    assert s.getContents().size() <= 1 : s.getContents();
    List<Dec> decs = new ArrayList<Dec>();
    List<ExpCore.Block.On> ons = new ArrayList<ExpCore.Block.On>();
    ExpCore inner = s.getInner().accept(this);
    if (s.getContents().size() == 1) {
        Expression.BlockContent c = s.getContents().get(0);
        for (Ast.VarDec d : c.getDecs()) {
            assert d instanceof Ast.VarDecXE : d;
            Ast.VarDecXE sugarDec = (Ast.VarDecXE) d;
            //assert sugarDec.getT().isPresent() :sugarDec;
            Optional<Type> t = sugarDec.getT();
            String x = sugarDec.getX();
            ExpCore e = sugarDec.getInner().accept(this);
            decs.add(new Dec(sugarDec.isVar(), t, x, e));
        }
        //END FOR DECS
        ;
        for (Catch k : c.get_catch()) {
            assert k instanceof Expression.Catch1;
            Expression.Catch1 k1 = (Expression.Catch1) k;
            SignalKind kind = k1.getKind();
            String x = k1.getX();
            assert x.length() >= 1;
            ons.add(new ExpCore.Block.On(kind, x, k1.getT(), lift(k1.getInner()), k1.getP()));
        }
        return new Block(doc, decs, inner, ons, s.getP());
    }
    return new Block(doc, decs, inner, Collections.emptyList(), s.getP());
}
Also used : ExpCore(ast.ExpCore) Ast(ast.Ast) Catch(ast.Expression.Catch) ArrayList(java.util.ArrayList) Type(ast.Ast.Type) MethodType(ast.Ast.MethodType) Expression(ast.Expression) Doc(ast.Ast.Doc) Block(ast.ExpCore.Block) SignalKind(ast.Ast.SignalKind)

Aggregations

ExpCore (ast.ExpCore)62 ArrayList (java.util.ArrayList)25 ClassB (ast.ExpCore.ClassB)18 Member (ast.ExpCore.ClassB.Member)11 MethodWithType (ast.ExpCore.ClassB.MethodWithType)10 Expression (ast.Expression)10 Block (ast.ExpCore.Block)9 MethodType (ast.Ast.MethodType)8 Doc (ast.Ast.Doc)7 Path (ast.Ast.Path)7 Assertions (tools.Assertions)7 MethodSelector (ast.Ast.MethodSelector)6 Position (ast.Ast.Position)6 Program (programReduction.Program)6 InjectionOnCore (sugarVisitors.InjectionOnCore)6 Ast (ast.Ast)5 Type (ast.Ast.Type)5 ErrorMessage (ast.ErrorMessage)5 CloneVisitor (coreVisitors.CloneVisitor)5 List (java.util.List)5