use of abs.frontend.ast.ParametricDataTypeUse in project abstools by abstools.
the class AbsASTBuilderUtil method generateImportAST.
public static final Set<Import> generateImportAST(TypeUse t) {
Set<Import> imports = new HashSet<>();
imports.add(generateImportAST(t.getName(), t.getModuleDecl().getName()));
if (t instanceof ParametricDataTypeUse) {
for (TypeUse st : ((ParametricDataTypeUse) t).getParams()) {
imports.addAll(generateImportAST(st));
}
}
return imports;
}
use of abs.frontend.ast.ParametricDataTypeUse in project abstools by abstools.
the class AbsASTBuilderUtil method getType.
public static final DataTypeUse getType(String n, TypeUse... types) {
if (types.length > 0) {
ParametricDataTypeUse set = new ParametricDataTypeUse();
set.setName(n);
for (TypeUse d : types) {
set.addParam(d);
}
return set;
} else {
DataTypeUse set = new DataTypeUse();
set.setName(n);
return set;
}
}
use of abs.frontend.ast.ParametricDataTypeUse in project abstools by abstools.
the class ASTBasedABSTestRunnerGenerator method generateDataPointsAST.
private TypeUse generateDataPointsAST(InterfaceDecl key, ClassDecl clazz, Set<TypeUse> use, MainBlock block) {
MethodSig dataPoint = findDataPoints(key);
if (dataPoint == null) {
return null;
}
Access rt = dataPoint.getReturnType();
if (!(rt instanceof ParametricDataTypeUse)) {
return null;
}
ParametricDataTypeUse prt = (ParametricDataTypeUse) rt;
if (!prt.getName().equals("Set")) {
return null;
}
// Set has only one type parameter
TypeUse u = (TypeUse) prt.getParam(0).copy();
use.add(u);
String objName = uncap(clazz.getName()) + "dataPoint";
String dataSet = dataPointSetName(clazz);
block.addStmtNoTransform(newObj(key, clazz, objName, true));
block.addStmtNoTransform(getVarDecl(dataSet, prt.copy(), new SyncCall(new VarUse(objName), dataPoint.getName(), new List<>())));
return u;
}
Aggregations