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

            WriteLine(";");
        }
Exemple #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);
            }
        }
Exemple #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();
            }
        }
        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;
        }
        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;
        }