[Issue 3301] Undefined identifier error dependent on order of imports when a circular import is involved

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 18 00:38:59 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3301



--- Comment #12 from Rainer Schuetze <r.sagitario at gmx.de> 2009-09-18 00:38:57 PDT ---
Created an attachment (id=454)
do all imports before semantic analysis

Having done some investigation of the deferred semantic analysis mechanism, it
might be best to try to keep its usage to a minimum, because it might have a
negative impact on compilation speed and memory consumption. So my patch is
probably not so bad after all.

Some details: 
The problem is that, though the files are parsed, their symbol table might not
yet hold any identifiers, because the semantic analysis has not been run on the
module.

So I introduced another compile step after parsing, but before the semantic
analysis. The files on the command line are scanned for import statements,
loading and parsing the referenced modules and applying the same process on
these files. In the same step, the global members of the module are added to
the modules' symbol table (this has been moved from the semantic analysis).

The import statements must not be conditional, because the semantic analysis is
needed to evaluate a "static if" statement. If the semantic analysis gets to
the import statement, the additional compile step kicks in again for any module
not already loaded.

This patch also fixes bugs #3286, #1592 and #258

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list