use of org.abs_models.frontend.ast.ParamDecl in project abstools by abstools.
the class ErlUtil method functionHeaderParamsAsList.
public static final void functionHeaderParamsAsList(CodeStream ecs, String funName, String firstParameter, org.abs_models.frontend.ast.List<ParamDecl> args, Mask mask) {
StringBuilder b = new StringBuilder("[");
boolean first = true;
for (ParamDecl p : args) {
if (!first)
b.append(',');
else
first = false;
b.append("P_" + p.getName());
}
if (args.getNumChild() > 0) {
b.append(',');
}
b.append("Stack]");
functionHeader(ecs, funName, mask, firstParameter, b.toString());
}
use of org.abs_models.frontend.ast.ParamDecl in project abstools by abstools.
the class ErlUtil method functionHeader.
// Not used when garbage collector pause points are added to functions
// Consider removing
public static final void functionHeader(CodeStream ecs, String funName, org.abs_models.frontend.ast.List<ParamDecl> args) {
List<String> a = new ArrayList<>(args.getNumChild());
for (ParamDecl p : args) a.add(p.getName());
functionHeader(ecs, funName, a, Mask.all);
}
use of org.abs_models.frontend.ast.ParamDecl in project abstools by abstools.
the class ClassDeclGenerator method generateGetFieldValueMethod.
private void generateGetFieldValueMethod() {
stream.println("protected final " + ABSValue.class.getName() + " getFieldValue(java.lang.String __ABS_fieldName) throws java.lang.NoSuchFieldException {");
for (ParamDecl p : decl.getParams()) {
stream.println("if (\"" + p.getName() + "\".equals(__ABS_fieldName)) return " + JavaBackend.getVariableName(p.getName()) + ";");
}
for (FieldDecl f : decl.getFields()) {
stream.println("if (\"" + f.getName() + "\".equals(__ABS_fieldName)) return " + JavaBackend.getVariableName(f.getName()) + ";");
}
stream.println("return super.getFieldValue(__ABS_fieldName);");
stream.println("}");
}
use of org.abs_models.frontend.ast.ParamDecl in project abstools by abstools.
the class TypeCheckerTest method classParamsMethodShadowsField.
@Test
public void classParamsMethodShadowsField() {
Model m = assertParse("class C(Bool b) { Bool m(Bool b) { return b; } }");
ModuleDecl u = m.lookupModule("UnitTest");
ClassDecl c = (ClassDecl) u.lookup(new KindedName(KindedName.Kind.CLASS, "C"));
MethodImpl me = c.lookupMethod("m");
ReturnStmt r = (ReturnStmt) me.getBlock().getStmt(0);
VarOrFieldUse vu = (VarOrFieldUse) r.getRetExp();
ParamDecl d = (ParamDecl) vu.getDecl();
assertThat(d.getParent().getParent(), instanceOf(MethodSig.class));
assertThat(vu.getClass().getName(), vu, instanceOf(VarUse.class));
}
Aggregations