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

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