Stefan Behnel wrote: > Dag Sverre Seljebotn wrote: >> PostParse (in ParseTreeTransforms.py) is a very safe spot to do >> things like this. One can trivially implement visit_ReturnStatNode and >> raise syntax errors if one is not within a function, and it means that >> if there's an error, one simply stops before getting to somewhere it can >> cause trouble. >> >> IMO more error checking (e.g. for most syntax errors) should go into there. > > Yes, good idea. Then we could prevent jumping into the code generation > phase completely whenever an error occurred in an earlier phase, which will > keep the code generation code simple.
I've lobbied earlier for moving all error checking out of code generation, because it makes writing transforms much simpler (it's difficult to think about the various ways the tree can be broken when writing a transform, and so one ends up with compiler crash bugs due to transform code). I think that ideally there should be a point in the pipeline where you can say "all errors have now been reported"; and all the optimization and/or feature-implementing transforms could happen after. It's not at all a priority, but at least it is something to keep in mind when new error checking is added. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
