Search in sources :

Example 1 with DummyValue

use of dyvilx.tools.compiler.ast.expression.DummyValue in project Dyvil by Dyvil.

the class UnapplyPattern method withType.

@Override
public Pattern withType(IType type, MarkerList markers) {
    // PatternType.unapply(_ : MatchedType)
    final IClass matchClass = this.type.getTheClass();
    if (matchClass == null) {
        return null;
    }
    final MethodCall methodCall = new MethodCall(this.position, new ClassAccess(this.type), Names.unapply, new ArgumentList(new DummyValue(type)));
    final IValue resolvedCall = methodCall.resolveCall(MarkerList.BLACKHOLE, matchClass, false);
    return resolvedCall != null && this.withMethod(type, resolvedCall, markers) ? this : null;
}
Also used : IValue(dyvilx.tools.compiler.ast.expression.IValue) ClassAccess(dyvilx.tools.compiler.ast.expression.access.ClassAccess) IClass(dyvilx.tools.compiler.ast.classes.IClass) ArgumentList(dyvilx.tools.compiler.ast.parameter.ArgumentList) MethodCall(dyvilx.tools.compiler.ast.expression.access.MethodCall) DummyValue(dyvilx.tools.compiler.ast.expression.DummyValue)

Aggregations

IClass (dyvilx.tools.compiler.ast.classes.IClass)1 DummyValue (dyvilx.tools.compiler.ast.expression.DummyValue)1 IValue (dyvilx.tools.compiler.ast.expression.IValue)1 ClassAccess (dyvilx.tools.compiler.ast.expression.access.ClassAccess)1 MethodCall (dyvilx.tools.compiler.ast.expression.access.MethodCall)1 ArgumentList (dyvilx.tools.compiler.ast.parameter.ArgumentList)1