[IronPython] ThrowingErrorSink and CompilerContext

Dino Viehland dinov at microsoft.com
Wed Jan 7 21:59:53 CET 2009


You should be able to just copy and paste throwing error sink into your own version, it's pretty simple:

internal class ThrowingErrorSink : ErrorSink {
        public static new readonly ThrowingErrorSink/*!*/ Default = new ThrowingErrorSink();

        private ThrowingErrorSink() {
        }

        public override void Add(SourceUnit sourceUnit, string message, SourceSpan span, int errorCode, Severity severity) {
            if (severity == Severity.Warning) {
                throw PythonOps.SyntaxWarning(message, sourceUnit, span, errorCode);
            } else {
                throw PythonOps.SyntaxError(message, sourceUnit, span, errorCode);
            }
        }
    }

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff
Sent: Wednesday, January 07, 2009 12:51 PM
To: Discussion of IronPython
Subject: [IronPython] ThrowingErrorSink and CompilerContext

Internally, in compile builtin, IronPython creates a CompilerContext like:

new CompilerContext(sourceUnit, opts, ThrowingErrorSink.Default)

But ThrowingErrorSink is internal, what can I do to get a equivalent
CompilerContext?

This is blocking the _ast module from running on unpatched IronPython.

Thanks,
-Dan
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




More information about the Ironpython-users mailing list