ConvertFirstStringToComments() public static method

public static ConvertFirstStringToComments ( List statements ) : IEnumerable
statements List
return IEnumerable
示例#1
0
        public void Xlat(SuiteStatement suite)
        {
            var comments = StatementTranslator.ConvertFirstStringToComments(suite.stmts);

            stmtXlat.Xlat(suite);
            gen.CurrentMemberComments.AddRange(comments);
        }
示例#2
0
        private void XlatConstructor(SuiteStatement stmt)
        {
            if (stmt == null)
            {
                return;
            }

            var comments = StatementTranslator.ConvertFirstStringToComments(stmt.stmts);

            stmt.Accept(this.stmtXlat);
            if (gen.Scope.Count == 0)
            {
                return;
            }
            gen.Scope[0].ToString();
            var expStm = gen.Scope[0] as CodeExpressionStatement;

            if (expStm == null)
            {
                return;
            }
            var appl = expStm.Expression as CodeApplicationExpression;

            if (appl == null)
            {
                return;
            }
            var method = appl.Method as CodeFieldReferenceExpression;

            if (method == null || method.FieldName != "__init__")
            {
                return;
            }
            var ctor = (CodeConstructor)gen.CurrentMember;

            ctor.Comments.AddRange(comments);
            ctor.BaseConstructorArgs.AddRange(appl.Arguments.Skip(1));
            gen.Scope.RemoveAt(0);
        }