Exemplo n.º 1
0
        public virtual void Visit(ReturnStatement returnStatement)
        {
            WriteLinkLine(returnStatement);
            Write("return");
            if (returnStatement.Value != null)
            {
                Write(" ");
                VisitDynamic(returnStatement.Value);
            }

            WriteLine(";");
        }
Exemplo n.º 2
0
        protected void Visit(ReturnStatement returnStatement)
        {
            // First, dispatch to resolve type of node at deeper level
            Visit((Node)returnStatement);

            if (returnStatement.Value != null)
            {
                var expressionType = returnStatement.Value.TypeInference.TargetType;
                if (expressionType != null)
                    returnStatement.Value = Cast(expressionType, returnStatement.Value.TypeInference.ExpectedType ?? expressionType, returnStatement.Value);
            }
        }
Exemplo n.º 3
0
        protected virtual void Visit(ReturnStatement returnStatement)
        {
            // First, dispatch to resolve type of node at deeper level
            Visit((Node)returnStatement);

            if (returnStatement.Value != null)
            {
                var function = NodeStack.OfType<MethodDefinition>().Last();
                returnStatement.Value.TypeInference.ExpectedType = function.ReturnType.ResolveType();
            }
        }
Exemplo n.º 4
0
        public override Node Visit(ReturnStatement returnStatement)
        {
            // First, dispatch to resolve type of node at deeper level
            base.Visit(returnStatement);

            if (returnStatement.Value != null)
            {
                var expressionType = returnStatement.Value.TypeInference.TargetType;
                if (expressionType != null)
                    returnStatement.Value = Cast(expressionType, returnStatement.Value.TypeInference.ExpectedType ?? expressionType, returnStatement.Value);
            }

            return returnStatement;
        }
Exemplo n.º 5
0
        public override Node Visit(ReturnStatement returnStatement)
        {
            // First, dispatch to resolve type of node at deeper level
            base.Visit(returnStatement);

            if (returnStatement.Value != null)
            {
                var function = NodeStack.OfType<MethodDefinition>().Last();
                returnStatement.Value.TypeInference.ExpectedType = function.ReturnType.ResolveType();
            }

            return returnStatement;
        }