コード例 #1
0
        /// <summary>
        /// This function overrides the behavior when the current node being walked is a ClassDefinition
        /// </summary>
        /// <param name="node"> the ClassDefinition node</param>
        /// <returns> boolean value. not important for this implementation. it is handeled by a call to the base Walk() method.</returns>
        public override bool Walk(IronPython.Compiler.Ast.ClassDefinition node)
        {
            UserDefinedType udt = PythonEntityCreationHelper.createClassUDT(node, m_currentCodeFile, m_currentParent);

            m_currentParent.AddChild(udt);
            udt.Parent = m_currentParent;
            m_savedParents.Push(m_currentParent);
            m_currentParent = udt;

            return(true);
        }
コード例 #2
0
        /// <summary>
        /// This function overrides the behavior when the node being walked is a FunctionDefinition.
        /// </summary>
        /// <param name="node"> the python ast node of type FunctionDefinition. </param>
        /// <returns> boolean value. not important for current implementation. it is taken care of by a call to the base class's walk method.</returns>
        public override bool Walk(IronPython.Compiler.Ast.FunctionDefinition node)
        {
            if (node == null)
            {
                return(false);
            }
            FunctionDefinition fn = PythonEntityCreationHelper.createFunction(node, m_currentCodeFile, m_currentParent);

            node.Parameters.ToList().ForEach(param => fn.AddFormalParameter(new FormalParameter("", param.Name)));
            m_currentParent.AddChild(fn);
            fn.Parent = m_currentParent;
            m_savedParents.Push(m_currentParent);
            m_currentParent = fn;

            return(true);
        }