use of ast.ExpCore.ClassB in project L42 by ElvisResearchGroup.
the class MethodPathCloneVisitor method visit.
public ExpCore visit(MCall s) {
Program ep = p;
for (ClassB cbi : this.getLocator().getCbs()) {
if (cbi != null) {
ep = ep.evilPush(cbi);
}
}
MethodSelector ms = s.getS();
Path guessed = null;
try {
TIn in = TIn.top(Phase.Typed, ep, s.getInner());
in = in.withG(varEnv.entrySet().stream().collect(Collectors.toMap(me -> me.getKey(), me -> new java.util.AbstractMap.SimpleEntry<>(false, me.getValue()))));
Type tGuessed = newTypeSystem.GuessTypeCore._of(in.p, in, s.getInner());
if (tGuessed == null) {
return super.visit(s);
}
guessed = tGuessed.getPath();
assert guessed != null;
} catch (NormImpossible ignored) {
return super.visit(s);
}
MethodSelector ms2 = visitMS(ms, guessed);
if (ms2.equals(ms)) {
return super.visit(s);
}
s = new MCall(s.getInner(), ms2, s.getDoc(), s.getEs(), s.getP());
return super.visit(s);
}
use of ast.ExpCore.ClassB in project L42 by ElvisResearchGroup.
the class Plugin method MmoveImplementation£xthat£xpath£xsrc£xdest.
@ActionType({ ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library })
public Object MmoveImplementation£xthat£xpath£xsrc£xdest(Object _that, Object _path, Object _sel1, Object _sel2) {
try {
ClassB that = ensureExtractClassB(_that);
//assert that.getStage().isInheritedComputed();
List<Ast.C> path = PathAux.parseValidCs(ensureExtractStringU(_path));
MethodSelector sel1 = MethodSelector.parse(ensureExtractStringU(_sel1));
MethodSelector sel2 = MethodSelector.parse(ensureExtractStringU(_sel2));
return Abstract.toAbstract(Resources.getP(), that, path, sel1, sel2);
} catch (RuntimeException rte) {
//to put breakpoint
throw rte;
}
}
use of ast.ExpCore.ClassB in project L42 by ElvisResearchGroup.
the class Plugin method Mredirect£xthat£xsrc£xdest.
@ActionType({ ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.TypeAny })
public Object Mredirect£xthat£xsrc£xdest(Object _that, Object _src, Object _dest) {
ClassB that = ensureExtractClassB(_that);
List<Ast.C> src = PathAux.parseValidCs(ensureExtractStringU(_src));
Path dest = ensureExtractPathFromJava(_dest);
assert dest.isCore() || dest.isPrimitive() : dest;
//TODO: see if extractPath should be changed
if (dest.isCore()) {
dest = dest.setNewOuter(dest.outerNumber() + 1);
}
return Redirect.redirect(Resources.getP(), that, Path.outer(0, src), dest);
}
use of ast.ExpCore.ClassB in project L42 by ElvisResearchGroup.
the class Plugin method MmakeMethod£xthat£xpath£xselector£xmdfs£xexceptionN.
@ActionType({ ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library })
public Object MmakeMethod£xthat£xpath£xselector£xmdfs£xexceptionN(Object _lib, Object _path, Object _selector, Object _mdfs, Object _execptionN) {
ClassB lib = ensureExtractClassB(_lib);
List<Ast.C> path = PathAux.parseValidCs(ensureExtractStringU(_path));
MethodSelector selector = MethodSelector.parse(ensureExtractStringU(_selector));
String mdfs = ensureExtractStringU(_mdfs);
int exceptionN = ensureExtractInt32(_execptionN);
return MakeMethod.addMethod(lib, path, selector, mdfs, exceptionN);
}
use of ast.ExpCore.ClassB in project L42 by ElvisResearchGroup.
the class Plugin method MaddKs£xthat£xpath£xfields£xmutK£xlentK£xreadK£ximmK£xisFwd.
@ActionType({ ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library })
public Object MaddKs£xthat£xpath£xfields£xmutK£xlentK£xreadK£ximmK£xisFwd(Object _that, Object _path, Object _fields, Object _mutK, Object _lentK, Object _readK, Object _immK, Object _fwd) {
ClassB that = ensureExtractClassB(_that);
List<Ast.C> path = PathAux.parseValidCs(ensureExtractStringU(_path));
String[] fieldNames = ensureExtractStringU(_fields).split(",");
String mutK = ensureExtractStringU(_mutK);
String lentK = ensureExtractStringU(_lentK);
String readK = ensureExtractStringU(_readK);
String immK = ensureExtractStringU(_immK);
boolean fwd = ensureExtractInt32(_fwd) == 0 ? false : true;
return MakeKs.makeKs(that, path, Arrays.asList(fieldNames), mutK, lentK, readK, immK, fwd);
}
Aggregations