Commit Graph

16 Commits

Author SHA1 Message Date
Shahzad Lone
065a25fce1 Reserve AllDelayed vector to upper bound.
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]
2019-01-14 20:44:26 -05:00
Xi Ge
a7a06d7ce3 FrontendTool: parse all delayed member decls when we're dumping parse tree or verifying parse diagnostics. 2018-09-12 19:40:28 -07:00
Xi Ge
24b0eac9a4 Parser: parse members in extension decls incrementally. 2018-09-05 17:00:39 -07:00
Rintaro Ishizaki
4df9fc111b [Parse] Remove delayed parsing for accessor decls
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.
2018-08-29 18:01:21 +09:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Xi Ge
4dcc3f1469 [CodeCompletion] No crash on a terribly wrong code completion position. rdar://21796881
Swift SVN r30706
2015-07-28 00:02:33 +00:00
Dmitri Hrybenko
5af5711ab7 Code completion: implement delayed parsing for accessor bodies, allowing code
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
2014-02-25 16:51:07 +00:00
Dmitri Hrybenko
46a4bc1402 Code completion: preserve the AST for the parsed top-level code. This enables
us to find iteration variables while doing code completion in nested top-level
code.

Fixes part of rdar://15199468


Swift SVN r9343
2013-10-15 01:24:16 +00:00
Dmitri Hrybenko
07e83ea49c Code completion: basic completion in constructor bodies
Swift SVN r8338
2013-09-17 18:20:26 +00:00
Dmitri Hrybenko
3cc01cf7d6 Introduce AbstractFunctionDecl -- a base class for ConstructorDecl,
DestructorDecl, FuncDecl -- and move some of the common concepts and logic
into it

No functionality change.


Swift SVN r8090
2013-09-11 04:04:01 +00:00
Dmitri Hrybenko
536723eca4 Code completion: implement delayed parsing of all (?) declarations
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
2013-08-13 23:53:39 +00:00
Dmitri Hrybenko
6beee6a62e Code completion: implement delayed parsing and code completion for
TopLevelCodeDecls


Swift SVN r6638
2013-07-26 01:44:23 +00:00
Dmitri Hrybenko
56998205d6 Delayed function body parsing: replace two error handling code paths with asserts
This should just never happen.


Swift SVN r6607
2013-07-25 20:03:55 +00:00
Argyrios Kyrtzidis
66d1e516c8 Refactor how multiple parsing passes and delayed parsing works.
-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
2013-07-25 01:40:16 +00:00