Commit Graph

1147 Commits

Author SHA1 Message Date
swift-ci
a9cb82e5e5 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-31 03:44:11 -07:00
eeckstein
903eeb220b Revert "Add a request to lazily parse function bodies." 2019-08-31 12:29:01 +02:00
swift-ci
0449301870 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-30 22:04:20 -07:00
Doug Gregor
2ab05a6835 Add a request to lazily parse function bodies.
Rework the lazy function body parsing mechanism to use the
request-evaluator, so that asking for the body of a function will
initiate parsing. Clean up a number of callers to
AbstractFunctionDecl::getBody() that don't actually need the body, so
we don't perform unnecessary parsing.

This change does not delay parsing of function bodies in the general
case; rather, it sets up the infrastructure to always delay parsing of
function bodies.
2019-08-30 16:48:23 -07:00
swift-ci
8f203f3930 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-30 14:44:12 -07:00
Doug Gregor
11969847c4 Simplify lazy parsing of nominal and extension members.
Lazy parsing for the members of nominal types and extensions depends
only on information already present in
`IterableDeclContext`. Eliminate the use of PersistentParserState as
an intermediary and have the member-parsing request construct a new
`Parser` instance itself to handle parsing. Make this possible even
for ill-formed nominal types/extensions to simplify the code path.

Eliminate `LazyMemberParser` and all of its uses, because it was only
present for lazy member parsing, which no longer needs it.
2019-08-30 08:29:43 -07:00
swift-ci
86bdfeb467 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-29 14:04:23 -07:00
Doug Gregor
9dd5a3cdd6 [Parser] Make delayed member parsing not depend on "persistent parser" state.
The `DelayedDeclKind` structure that's allocated for each case where
we delay parsing the members of a nominal type definition or extension
contains information that is already available on the
`IterableDeclContext` (or can be reconstructed trivially from it). Use
that AST information rather than this side structure.
2019-08-29 11:05:25 -07:00
Doug Gregor
d8f7c9e72c [Parser] Introduce a request for parsing type and extension members.
Ensure that lazy parsing of the members of nominal type definitions
and extensions is handled through a request. Most of the effort here
is in establishing a new request zone for parser requests.
2019-08-28 21:39:56 -07:00
swift-ci
892b430a79 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-28 10:24:36 -07:00
swift-ci
7b662362dc Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-27 14:44:31 -07:00
Rintaro Ishizaki
cb308b7e53 Revert "Revert "[Parser] Decouple the parser from AST creation (part 2)""
This reverts commit 8ad3cc8a82.
2019-08-27 14:36:41 -07:00
Rintaro Ishizaki
8ad3cc8a82 Revert "[Parser] Decouple the parser from AST creation (part 2)" 2019-08-27 12:28:48 -07:00
swift-ci
8b17a1aa49 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-26 17:24:35 -07:00
Jan Svoboda
77924c4b84 [Parser] Decouple the parser from AST creation (part 2)
Instead of creating the AST directly in the parser (and libSyntax or
SwiftSyntax via SyntaxParsingContext), make Parser to explicitly create
a tree of ParsedSyntaxNodes. Their OpaqueSyntaxNodes can be either
libSyntax or SwiftSyntax. If AST is needed, it can be generated from the
libSyntax tree.
2019-08-26 19:10:51 +02:00
swift-ci
9b8c33e50b Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-23 14:03:49 -07:00
David Ungar
a40b694801 Use token start locations 2019-08-21 22:36:15 -07:00
David Ungar
d84d541e99 De-lazify 2019-08-21 12:02:25 -07:00
David Ungar
0dbf7e6ab6 Parser changes for lazy ASTScopes 2019-08-21 09:45:45 -07:00
swift-ci
b6e97a229e Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-15 19:24:21 -07:00
Slava Pestov
70bcd74ed0 Sema: Introduce IsImplicitlyUnwrappedOptionalRequest 2019-08-15 18:41:42 -04:00
swift-ci
7b07d1fba0 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-13 11:24:23 -07:00
swift-ci
c88407f2aa Merge pull request #26634 from davidungar/fix-comments 2019-08-13 11:07:27 -07:00
swift-ci
54bc728ba3 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-13 10:04:28 -07:00
David Ungar
fe5e4ee96f Correct comment for Parser::parseMatchingToken. 2019-08-13 09:54:54 -07:00
Slava Pestov
94149db4ec Parse: Record which delayed type and extension bodies possibly contain operators and classes
To properly delay parsing type and extension bodies we need to know
which ones might contain nested operator and class definitions, since
they must be known upfront when building the global operator lookup
and AnyObject dispatch lookup tables, respectively.

To guess if the type contains operator definitions, we look for the
'func' keyword followed by an operator token.

To guess if the type contains class definitions, we look for the
'class' keyword.

For now, this information is recorded but not used. Subsequent commits
will make use of this information to delay parsing in more cases.
2019-08-12 17:15:51 -04:00
swift-ci
69ec4514af Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-09 14:04:17 -07:00
Brent Royal-Gordon
fb20b503ba Merge branch 'master' into master-rebranch
# Conflicts:
#	lib/ClangImporter/ClangImporter.cpp
#	test/IRGen/builtins.swift
#	test/IRGen/enum.sil
#	tools/driver/autolink_extract_main.cpp
#	utils/build-presets.ini
2019-08-08 17:07:59 -07:00
Nathan Hawes
5d47b45991 [IDE][Parse] Change the source location of TypeAttributes to point to the @ like DeclAttributes 2019-08-05 11:36:32 -07:00
Rintaro Ishizaki
94f0c14675 [SyntaxParse] Return dedicated pointer from HiddenLibSyntaxAction
SyntaxParseActions::recordToken() et al. may return the same pointer
value for different nodes (e.g. `nullptr`). So we cannot use DenseMap to
associate the node from the explicit syntax parsing actions to libSyntax
node. Instead, use a structure that wraps them.
2019-07-31 16:14:32 -07:00
Jan Svoboda
f0395a469a Revert "Revert "[Parser] Decouple the parser from AST creation (part 1)"" 2019-07-30 04:34:09 +00:00
Slava Pestov
a532a325e1 AST: Move a few methods from VarDecl down to ParamDecl 2019-07-22 20:19:09 -04:00
Suyash Srijan
8092dd9ad7 [Parser] Validate a collection element if its a subscript 2019-07-15 20:59:22 +01:00
Brent Royal-Gordon
c66a8be4eb Revert "[Parser] Decouple the parser from AST creation (part 1)" 2019-07-09 14:07:43 -07:00
Argyrios Kyrtzidis
d0ddece7e2 Merge pull request #25193 from jansvoboda11/gsoc-2019-parser
[Parser] Decouple the parser from AST creation (part 1)
2019-07-08 13:49:40 -07:00
Jan Svoboda
5aee188716 Rename SyntaxTransformer to ASTGen 2019-07-08 17:16:35 +02:00
Sergej Jaskiewicz
95eea2f3e9 [Parse] Implement "missing 'func' keyword" diagnostic with a fix-it
- When parsing a type or extension declaration, attempt to parse a function or property declaration when meeting an identifier, an operator or a paren (for tuple declarations).
- Produce the diagnostic with a fix-it suggesting to insert the needed keyword
- Recover parsing as if the declaration with the missing keyword is a function/property declaration

Resolves https://bugs.swift.org/browse/SR-10477
2019-07-04 20:06:35 +03:00
Jan Svoboda
44d7769238 [Parser] Decouple the parser from AST creation (part 1)
Instead of creating the AST directly in the parser (and libSyntax or
SwiftSyntax via SyntaxParsingContext), make Parser to explicitly create
a tree of ParsedSyntaxNodes. Their OpaqueSyntaxNodes can be either
libSyntax or SwiftSyntax. If AST is needed, it can be generated from the
libSyntax tree.
2019-06-28 14:28:19 +02:00
Rintaro Ishizaki
22be7a5063 [Parse] Erase several method declarations from the header
These methods were removed long time ago.
2019-06-26 16:23:00 -07:00
Rintaro Ishizaki
257b61744e [CodeCompletion] Eliminate super related completion
In parser, 'parseExprPostfixSuffix()' can parse postfix expression for
'super'. 'parseExprSuper()' doesn't need to parse them.

In code-completion, 'completeExprSuper()' and 'completeExprSuperDot()'
can be consolidated to 'completePostfixExpr()' and 'completeDotExpr()'.
2019-06-26 09:59:47 -07:00
swift-ci
dad1697264 Merge remote-tracking branch 'origin/master' into master-next 2019-06-19 09:48:56 -07:00
Rintaro Ishizaki
e52feac6d0 Merge pull request #25565 from owenv/unnamed_static_var_diag
[Diagnostics]: Fix broken diagnostic for unnamed static class property
2019-06-19 09:44:32 -07:00
Owen Voorhees
89d4e6378d [Diagnostics]: Fix broken diagnostic for unnamed static class property 2019-06-16 19:35:17 -07:00
swift-ci
5e5f662fb7 Merge remote-tracking branch 'origin/master' into master-next 2019-06-14 08:09:23 -07:00
David Ungar
06527db4ab Merge pull request #24594 from davidungar/A5-7-ASTOOScope-rebased
[NameLookup] ASTOOScope ontology
2019-06-14 08:03:09 -07:00
David Ungar
6cfcabd8e5 add -disable-parser-lookup 2019-06-11 09:08:10 -07:00
swift-ci
18cffb2d91 Merge remote-tracking branch 'origin/master' into master-next 2019-06-08 01:09:48 -07:00
Sergej Jaskiewicz
36b2625c60 [Parse] Add missing const qualifier to getSplitTokens() 2019-06-07 12:09:55 +03:00
swift-ci
0e8bd2bed5 Merge remote-tracking branch 'origin/master' into master-next 2019-05-31 12:49:23 -07:00
Rintaro Ishizaki
9ba232d718 [CodeCompletion] Implement completion at custom attribute argument 2019-05-31 11:09:54 -07:00