Re: [Vala] Errors handling in vala compiler



Hi Yu,

On Wed, 2009-07-15 at 10:30 +0800, Yu Feng wrote:
I can see there is a 'check' method for each node which recursively
checks the children of the node. It returns a false on error, and writes
the error message to stderr. 

But how and why does the compiler exit when the method returns false?
Why isn't this part using the throw/catch handling? 

The aborting is only done by the compiler driver, that is,
compiler/valacompiler.vala. The reason we do not use throw/catch for
that is that we want to be able to report more than one error at once
and not just abort at the first error we encounter.

I am looking into this because I am evaluating the possibility of
parsing and constructing the ast in valide with libvala. The IDE won't
be happy if libvala reports to stderr and aborts for errors.

You can subclass Vala.Report, override the err and warn methods, and
then set the `report' property of the default context to an instance of
your report subclass.

Jürg




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]