-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
The editor is currently having to parse and resolve every modified file twice, once as part of doing a full compile (in the builder) and once when building the index. We would like to have an API defined that would allow us to avoid duplicating this effort.
Two proposals have been suggested. The first is to add a method like unitCompiled(Source, DartUnit) to DartCompilerListener that would provide the Source and DartUnit of each AST that has been fully compiled as part of compiling a given library. The method needs to be invoked after the AST has been fully resolved. It also needs to be guaranteed that the AST represents (to the greatest extent possible in the face of syntactic errors) the actual structure of the original source code (that is, it cannot be normalized in place or otherwise altered) and that it will not be changed (other than in well defined ways, such as setting the normalizedNode) after the method is invoked.
The second proposal is to have the method DartCompiler.compileLib(LibrarySource, CompilerConfiguration, DartArtifactProvider, DartCompilerListener) return a CompilationResult rather than a simple String and for this object to have accessor methods that return the equivalent information.
My preference is for the first option because then the editor can potentially use the AST structure (in a read-only fashion) at the same time that the compiler is proceeding on multi-processor machines, reducing the overall compile time.