Ejemplo n.º 1
0
        private IExpression HandleTypecastExpressionNode(TypecastExpressionNode node)
        {
            var result = new TypecastExpression();

            result.Type = node.Type;

            result.Expression = FindExpressionByExpressionNode(node.Expression, false).ReturnOutputSlot;
            result.Expression.InputSideExpression = result;
            result.InputSlots.Add(result.Expression);

            // Определяем выходное значение
            result.ReturnOutputSlot = new ExpressionSlot(result.Type, result);

            return(result);
        }
        public override object VisitTypecastExpression([NotNull] DoshikParser.TypecastExpressionContext context)
        {
            SetWholeExpression(context);
            VisitChildren(context);
            _compilationContext.SetParsingAntlrContext(context);

            var node = new TypecastExpressionNode(context);

            var foundType = GetTypeNameVisitor.Apply(_compilationContext, context.typeType());

            foundType.ThrowIfNotFound(_compilationContext);
            node.Type = foundType.DataType;

            node.Expression = Sequence.FindExpressionByAntlrContext(context.expression());

            Sequence.Sequence.Add(node);

            return(null);
        }