How does CCI support incremental compilation?

May 15, 2009 at 5:06 PM

Hi,

What does it mean that CCI supports incremental compilation? (Couldn't find any hints in the chm file.)

Do you mean by incremental compilation that a source file can be reparsed and the AST can be modified according to the changes in the source (instead of throwing away the AST and building a new one)? Or do I misunderstand the phrase?

Thanks,

Ferenc

Coordinator
May 15, 2009 at 6:12 PM

An incremental compiler will respond to an edit by reparsing a source file, or a portion of a source file and then splicing in the resulting AST into a lazy copy of the previous AST. Look for the methods UpdateMembers, MakeShallowCopyFor and MakeCopyFor.

Each AST node projects itself onto a corresponding Code Model node by evaluating (and caching) properties in a local manner (not requiring a set of passes over the entire AST), thus facilitating incremental compilation.

Since the AST is a graph, you need to contstruct a complete copy for each incremental change in order to have a consistent view of the world. However, since the copy is done lazily, scenarios that do not traverse the entire AST, such as the work needed to proffer a completion list in the editor, pay only for the parts of the AST that they do traverse.