[Issue 102] Forward reference nested class wheel.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 18 01:33:07 PDT 2009


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



--- Comment #6 from Rainer Schuetze <r.sagitario at gmx.de> 2009-09-18 01:33:06 PDT ---
Created an attachment (id=457)
more aggressive deferral of (possible) forward declarations

DMD has a mechanism to defer semantic analysis of declarations, but
uses it only sometimes when it detects a forward reference. Often you cannot
tell if it is a forward reference or a typo, so I have made this work more
aggressively.

Details:
A new state variable (tryfwd - better name suggestion welcome) is added to the
global struct, that switches the behaviour for VarDeclaration::semantic: if
analysis of the type produces an error, further analysis is deferred. Error
messages are suppressed by the gag-mechanism.

The same state variable is used to defer struct size analysis.

After the first semantic analysis step on all files on the command line, tryfwd
is cleared, and semantic analysis is run again on all deferred symbols,
producing appropriate error messages.

The downside of this patch is that it might have a negative impact
on compilation speed and memory consumption:
- depending on the modules layout semantic analysis on deferred symbols is run
very often or maybe not often enough.
- To avoid overwriting type information with erronuous info, a syntaxCopy is
run before the type analysis. This might need a lot of memory, but most types
are small or even do not create any copy at all (as the basic types).
- error messages are less sequential with respect to lexical order.

-- 
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