Ejemplo n.º 1
0
 public void Visit(InfixFunctionInvocationExpressionSyntax infixFunctionInvocationExpressionSyntax)
 {
     Visit(infixFunctionInvocationExpressionSyntax.Left);
     Visit(infixFunctionInvocationExpressionSyntax.Identifier);
     Visit(infixFunctionInvocationExpressionSyntax.Right);
 }
Ejemplo n.º 2
0
        private BoundInvocationExpression BindInfixFunctionInvocationExpression(InfixFunctionInvocationExpressionSyntax syntax)
        {
            var boundLeft = BindExpression(syntax.Left);
            var boundRight = BindExpression(syntax.Right);
            var boundInfixFunction = BindMemberExpression(syntax.Identifier, new List<IType>() {boundLeft.Type, boundRight.Type});
            var returnType = ((FunctionCompilerGeneratedType)boundInfixFunction.Type).ReturnType;

            Ensure(
                () => (boundInfixFunction.BoundMember as BoundFunction)?.IsInfixFunction == true,
                $"No infix function 'infix function {syntax.Identifier.Name.Value}({boundLeft.Type}, {boundRight.Type})' found");
            Ensure(() => returnType != null, $"Missing return Type: 'infix function {syntax.Identifier.Name.Value}({boundLeft.Type}, {boundRight.Type})'");

            return new BoundInvocationExpression(boundInfixFunction, new List<BoundExpression>() {boundLeft, boundRight}, syntax, returnType);
        }