File: [swift/lib/Parse/PersistentParserState.cpp]
Observing this code snipped closely in function, [void PersistentParserState::parseAllDelayedDeclLists()]:
```
for (auto &P: DelayedDeclListStates) {
AllDelayed.push_back(P.first);
}
```
We observe that 'AllDelayed' gets maximum of DelayedDeclListStates.size() elements pushed into it.
So it is better to reserve 'vector AllDelayed' to that max size, to save reallocation cost.
I believe we can use size() on [DelayedDeclListStates], which is of type: ```llvm::DenseMap<IterableDeclContext *, std::unique_ptr<DelayedDeclListState>>``` because of the ```DenseMapIterator``` implementation of size().
[http://llvm.org/doxygen/DenseMap_8h_source.html#l00126]
Now that, parsing accessor body is done by 'parseAbstractFunctionBody()'
which automatically handles delayed parsing by `delayFunctionBodyParsing()`.
So we no longer use delayed parsing facilities specific for accessor body.
completion inside computed properties.
Adding tests for willSet/didSet uncovered some crashes while doing code
completion (see FIXMEs), and I will investigate these next.
Partially addresses rdar://15849262
Swift SVN r14338
This allows us to show generic parameters in:
struct S<T> {
func f(a: #^A^#
}
And show the type Z in:
struct S {
func f(a: #^A^#
typealias Z = Int
}
Swift SVN r7216
-Introduce PersistentParserState to represent state persistent among multiple parsing passes.
The advantage is that PersistentParserState is independent of a particular Parser or Lexer object.
-Use PersistentParserState to keep information about delayed function body parsing and eliminate parser-specific
state from the AST (ParserTokenRange).
-Introduce DelayedParsingCallbacks to abstract out of the parser the logic about which functions should be delayed
or skipped.
Many thanks to Dmitri for his valuable feedback!
Swift SVN r6580