use of dyvilx.tools.compiler.ast.method.IMethod in project Dyvil by Dyvil.
the class Property method formatBody.
public static void formatBody(IProperty property, String prefix, StringBuilder buffer) {
// Block Start
if (Formatting.getBoolean("property.block.newline")) {
buffer.append('\n').append(prefix);
} else {
buffer.append(' ');
}
buffer.append('{');
// Initializer
final IValue initializer = property.getInitializer();
final IMethod getter = property.getGetter();
final IMethod setter = property.getSetter();
if (initializer != null) {
formatInitializer(initializer, prefix, buffer);
if (getter != null || setter != null) {
buffer.append('\n').append(prefix);
}
}
// Getter
if (getter != null) {
formatGetter(getter, prefix, buffer);
if (setter != null) {
buffer.append('\n').append(prefix);
}
}
// Setter
if (setter != null) {
formatSetter(setter, prefix, buffer);
}
// Block End
buffer.append('\n').append(prefix).append('}');
}
use of dyvilx.tools.compiler.ast.method.IMethod in project Dyvil by Dyvil.
the class AbstractCall method addCandidateInfo.
private void addCandidateInfo(Marker marker, Candidate<IMethod> candidate) {
final StringBuilder builder = new StringBuilder().append('\t');
final IMethod member = candidate.getMember();
builder.append(member.getReceiverType()).append(member.isStatic() ? '.' : '#');
Util.methodSignatureToString(member, this.genericData, builder);
marker.addInfo(builder.toString());
}
use of dyvilx.tools.compiler.ast.method.IMethod in project Dyvil by Dyvil.
the class PrefixCall method resolveCall.
@Override
public IValue resolveCall(MarkerList markers, IContext context, boolean report) {
// Normal Method Resolution
final MatchList<IMethod> candidates = this.resolveCandidates(context);
if (candidates.hasCandidate()) {
return this.checkArguments(markers, context, candidates.getBestMember());
}
// Implicit Resolution
final IValue implicitCall = this.resolveImplicitCall(markers, context);
if (implicitCall != null) {
return implicitCall;
}
// No apply Resolution
if (report) {
this.reportResolve(markers, candidates);
return this;
}
return null;
}
use of dyvilx.tools.compiler.ast.method.IMethod in project Dyvil by Dyvil.
the class TypeChecker method convertValueDirect.
private static IValue convertValueDirect(IValue value, IType type, ITypeContext typeContext, MarkerList markers, IContext context) {
final IValue typedValue = value.withType(type, typeContext, markers, context);
if (typedValue != null) {
return typedValue;
}
final IValue converted1 = type.convertFrom(value, value.getType(), typeContext, markers, context);
if (converted1 != null) {
return converted1;
}
final IValue converted2 = value.getType().convertTo(value, type, typeContext, markers, context);
if (converted2 != null) {
return converted2;
}
final IMethod converter = IContext.resolveImplicits(context, value, type).getBestMember();
if (converter == null) {
return null;
}
return new LiteralConversion(value, converter);
}
use of dyvilx.tools.compiler.ast.method.IMethod in project Dyvil by Dyvil.
the class InterfaceMetadata method processProperty.
protected void processProperty(IProperty property, MarkerList markers) {
this.processMember(property, markers);
final IMethod getter = property.getGetter();
if (getter != null) {
this.processMethod(getter, markers);
}
final IMethod setter = property.getSetter();
if (setter != null) {
this.processMethod(setter, markers);
}
final SourcePosition initializerPosition = property.getInitializerPosition();
if (initializerPosition != null) {
this.processPropertyInitializer(initializerPosition, markers);
}
}
Aggregations