use of ast.Ast.Doc in project L42 by ElvisResearchGroup.
the class PlgWrapperGenerator method checkForInside.
private static void checkForInside(ClassB lTop, Path csTop, Path originalPath) throws ClassUnfit, MethodUnfit {
if (originalPath.isPrimitive()) {
throw new RefactorErrors.MethodUnfit().msg("Method signature not supported:\n parameters can not be Void/Any/fwd.\n" + "returns can not be Any/fwd\n" + "exceptions can not be Any/Void/Library");
}
Path cs = From.fromP(originalPath, csTop);
assert cs.outerNumber() == 0;
List<Ast.C> cBar = cs.getCBar();
ClassB lPointed = lTop.getClassB(cBar);
Doc d = lPointed.getDoc1();
if (d._getParameterForPlugin() == null || d._getParameterForPluginPart() == null) {
throw new RefactorErrors.ClassUnfit().msg("Class " + cBar + " doesnot have @pluginPart annotation");
}
}
use of ast.Ast.Doc in project L42 by ElvisResearchGroup.
the class AddDocumentation method addDocumentationOnMethod.
public static ClassB addDocumentationOnMethod(Program p, ClassB cb, List<Ast.C> cs, MethodSelector sel, Doc doc) {
Errors42.checkExistsPathMethod(cb, cs, Optional.of(sel));
if (cs.isEmpty()) {
cb = auxAddDocOnMethod(p, cb, sel, doc);
} else {
Program p1 = p.evilPush(cb);
if (cs.size() > 1) {
p1 = p1.navigate(cs.subList(0, cs.size() - 1));
}
Program p2 = p1;
cb = cb.onClassNavigateToPathAndDo(cs, cbi -> auxAddDocOnMethod(p2, cbi, sel, doc));
}
return cb;
}
use of ast.Ast.Doc in project L42 by ElvisResearchGroup.
the class Plugin method MaddDocumentation£xthat£xpath£xselector£xdoc.
@ActionType({ ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library, ActionType.NormType.Library })
public Object MaddDocumentation£xthat£xpath£xselector£xdoc(Object _that, Object _path, Object _sel, Object _doc) {
ClassB that = ensureExtractClassB(_that);
List<Ast.C> path = PathAux.parseValidCs(ensureExtractStringU(_path));
MethodSelector sel = MethodSelector.parse(ensureExtractStringU(_sel));
Doc doc = ensureExtractDoc(_doc);
return AddDocumentation.addDocumentationOnMethod(Resources.getP(), that, path, sel, doc);
}
use of ast.Ast.Doc in project L42 by ElvisResearchGroup.
the class ToAst method visitMxRound.
@Override
public Expression visitMxRound(MxRoundContext ctx) {
String mx = ctx.MX().getText();
assert mx.endsWith("(");
mx = mx.substring(0, mx.length() - 1);
RoundContext r = ctx.round();
Doc doc = parseDoc(r.docsOpt());
assert !mx.startsWith("#");
assert !mx.startsWith("\\");
Expression rcv = new Expression.X(position(ctx), mx);
//Expression rcv= (mx.startsWith("#"))?new Expression.ContextId(mx):new Expression.X(mx);
return new Expression.FCall(position(r), rcv, doc, parseMParameters(r.ps()));
}
use of ast.Ast.Doc in project L42 by ElvisResearchGroup.
the class ToAst method visitCurlyBlock.
@Override
public Expression visitCurlyBlock(CurlyBlockContext ctx) {
Doc doc = parseDoc(ctx.docsOpt());
List<BlockContent> contents = new ArrayList<BlockContent>();
for (BbContext b : ctx.bb()) {
List<VarDec> decs = new ArrayList<VarDec>();
for (DContext d : b.d()) {
decs.add(parseVDec(d));
}
assert b.ks() != null;
List<Catch> _catch = parseKs(b.ks());
contents.add(new BlockContent(decs, _catch));
}
return new Expression.CurlyBlock(position(ctx), doc, contents);
}
Aggregations