use of dyvilx.tools.compiler.ast.parameter.ArgumentList in project Dyvil by Dyvil.
the class SubscriptAccess method toCompoundAssignment.
@Override
public IValue toCompoundAssignment(IValue rhs, SourcePosition position, MarkerList markers, IContext context, SideEffectHelper helper) {
// x[y...] (op)= z
// -> x[y...] = x[y...] (op) z
// note that x and y... are each only evaluated once
final IValue subscriptReceiver = helper.processValue(this.receiver);
final ArgumentList subscriptArguments = helper.processArguments(this.arguments);
this.receiver = subscriptReceiver;
this.arguments = subscriptArguments;
return new SubscriptAssignment(position, subscriptReceiver, subscriptArguments, rhs).resolveCall(markers, context, true);
}
use of dyvilx.tools.compiler.ast.parameter.ArgumentList in project Dyvil by Dyvil.
the class Template method makeMainMethod.
private void makeMainMethod() {
// func main(args: [String]) -> void = new TemplateName().mainImpl(args)
final ParameterList params = this.mainMethod.getParameters();
final CodeParameter argsParam = new CodeParameter(this.mainMethod, null, Name.fromRaw("args"), new ArrayType(Types.STRING));
params.add(argsParam);
final IValue newTemplate = new ConstructorCall(null, this.templateClass.getClassType(), ArgumentList.EMPTY);
this.mainMethod.setValue(new MethodCall(null, newTemplate, Name.fromRaw("mainImpl"), new ArgumentList(new FieldAccess(argsParam))));
}
use of dyvilx.tools.compiler.ast.parameter.ArgumentList in project Dyvil by Dyvil.
the class Deprecation method checkUsageInfo.
private static void checkUsageInfo(IMember member, SourcePosition position, MarkerList markers, Annotation annotation) {
final ArgumentList arguments = annotation.getArguments();
final MarkerLevel markerLevel = AnnotationUtil.getEnumValue(arguments, INF_LEVEL_PARAM, MarkerLevel.class);
if (markerLevel == null || markerLevel == MarkerLevel.IGNORE) {
return;
}
String value = AnnotationUtil.getStringValue(arguments, INF_VALUE_PARAM);
final String description = AnnotationUtil.getStringValue(arguments, INF_DESC_PARAM);
value = replaceMember(member, value);
final Marker marker = Markers.withText(position, markerLevel, value);
assert marker != null;
// Description
if (description != null && !description.isEmpty()) {
marker.addInfo(Markers.getSemantic("experimental.description", description));
}
markers.add(marker);
}
use of dyvilx.tools.compiler.ast.parameter.ArgumentList in project Dyvil by Dyvil.
the class SideEffectHelper method processArguments.
public ArgumentList processArguments(ArgumentList arguments) {
final ArgumentList copy = arguments.copy();
for (int i = 0, count = arguments.size(); i < count; i++) {
final IValue value = arguments.get(i, null);
copy.set(i, null, this.processValue(value));
}
return copy;
}
use of dyvilx.tools.compiler.ast.parameter.ArgumentList in project Dyvil by Dyvil.
the class AnnotationMetadata method readTargets.
private void readTargets() {
final Annotation target = this.theClass.getAnnotation(Annotation.LazyFields.TARGET_CLASS);
if (target == null) {
return;
}
this.targets = EnumSet.noneOf(ElementType.class);
final IValue argument = target.getArguments().get(0, Names.value);
if (!(argument instanceof ArrayExpr)) {
return;
}
final ArgumentList values = ((ArrayExpr) argument).getValues();
final int size = values.size();
for (int i = 0; i < size; i++) {
final INamed value = (INamed) values.get(i);
try {
this.targets.add(ElementType.valueOf(value.getName().qualified));
} catch (IllegalArgumentException ignored) {
// Problematic Target annotation - do not handle this
}
}
}
Aggregations