use of dyvilx.tools.compiler.ast.expression.LiteralConversion 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);
}
Aggregations