Esempio n. 1
0
        private TypeSymbolNode?BindInUnaryOperation(UnaryOperationExpressionNode unaryOperation,
                                                    VariableIdentifierMap variableIdentifierMap)
        {
            TypeSymbolNode?operandType = BindInExpression(unaryOperation.OperandNode, variableIdentifierMap);

            if (operandType == null)
            {
                return(null);
            }

            Operator @operator = unaryOperation.Operator;

            UnaryOperationSymbolNode?operationSymbol = FindBestUnaryOperation(@operator,
                                                                              operandType,
                                                                              out ImplicitConversionSymbolNode? conversion);

            if (operationSymbol == null)
            {
                ErrorProvider.ReportError(ErrorCode.OperatorNotAvailableForTypes,
                                          Compilation,
                                          unaryOperation,
                                          $"Operand type: {operandType.Identifier}");
                return(null);
            }

            if (conversion != null)
            {
                unaryOperation.OperandNode.SpecifyImplicitConversion(conversion);
            }

            unaryOperation.Bind(operationSymbol);

            return(operationSymbol.ReturnTypeNode);
        }
Esempio n. 2
0
 public override PapyrusType VisitUnaryOperationExpression(UnaryOperationExpressionNode node)
 {
     // TODO: boolean
     return(base.VisitUnaryOperationExpression(node));
 }