Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
I'm sorry to say that you are.. ;)
Well, it is good to find that out early enough :)
The code that goes out hunting for symbol definitions is around the SAFE_APPLY_MASTER or safe_apply_handler in program.c. Mainly when it calls "resolv", but e.g. the "handle_inherit" and "get_default_module" calls are also interesting.
That can happen anytime during compilation, and it's not a problem for the compiler to be invoked recursively to compile other files.
The two passes are for lexing and parsing the file, construct the abstract syntax tree (or node tree as it's called in pike - see las.c), resolving types and inherits. You can say it's centered around the two calls to do_yyparse in program.c. Most of the code in program.c, language.yacc and las.c are about this.
Thanks, will get me started about the right place then.
The thing is that it's easy to construct cases using inherit where one class in a file has to be finished (i.e. gone through both passes) while another is only in the first pass.
Ok. I'm not sure what is done in each pass, so an example would probably do well.
There are also plenty of cases where incomplete types occur in the first pass which are corrected in the second pass, but in the meantime those incomplete types are propagated to other classes in pass two and won't get corrected there. This is hardly noticeable except that type checking isn't always as good as it should be.
I understand this as: during a programs second pass the compiler generates messages when types are in conflict (e.g. wrong type for function argument) but might not notice if the type used or checked against has only gone through the first pass. Correct me when necessary.
Here I should be able to give you a bunch of clear cut examples of all this, but unfortunately I don't have any readily available. Some are disabled in the test suite, others have only been discussed on whiteboards, but many have never been properly extracted from the code they were discovered in since these problems tend to be hard to minimalize.
I agree with the trouble to minimalize it (as I've already tried, to some limited extent). Any hints on which disabled tests in the testsuite? (will have a look to see if I find them).
Ok, off to the sources for a first dive in. Rest assured, I will be back with a lot of questions, no doubt :)
Thanks //K