This was not likely an error-free change. Where you see problems
please correct them. This went through a fairly tedious audit
before committing, but comments might have been changed incorrectly,
not changed at all, etc.
Swift SVN r7631
Now we make the desicion to delay parsing if the parsed production contained a
code completion token, not if we just stopped at the code completion token.
Swift SVN r7442
But the implementation of expression parsing still does not propagate the code
completion bits because it uses NullablePtr for results.
Swift SVN r7425
pass in a vector
This a bit of noise to the diagnostics (see test change); this issue will be
fixed uniformly for all nominal decls in future commits.
Swift SVN r7399
This finally fixes a few code completion test cases.
This also regresses the error message in one parsing testcase because
previously we would just happily skip those tokens, but now error handling path
is a little bit different and these tokens hit different error handling code.
This can be fixed by parsing a tuple for the selector argument and complaining
if the tuple had more than one element.
Swift SVN r7389
This is particularly convenient for dealing with generated
code (e.g. as produced by the SIL printer), but it's also
quite defensible as a way for users to logically group
related attributes and split unrelated ones out, should
users find themselves using a lot of verbose attributes
(and prior experience with e.g. user-defined attributes
is that they definitely do sometimes turn into walls of
text...).
Swift SVN r7376
Previously, TypeAliasDecl was used for typealiases, generic
parameters, and assocaited types, which is hideous and the source of
much confusion. Factor the latter two out into their own decl nodes,
with a common abstract base for "type parameters", and push these
nodes throughout the frontend.
No real functionality change, but this is a step toward uniquing
polymorphic types, among other things.
Swift SVN r7345
This allows the parser to recover, create an AST node, return it to the caller
*and* signal the caller that there was an error to trigger recovery in the
caller. Until now the error was signalled with a nullptr result (any non-null
result was considered a success and no recovery was done in that case).
This also allows us to signal the caller if there was a code completion token
inside the production we tried to parse to trigger delayed parsing in the
caller while doing recovery in the callee. Until now we could not do recovery
in the callee so that the caller could find the code completion token.
Right now we don't take any advantage of these features. This commit just
replaces some uses of NullablePtr with ParserResult.
Swift SVN r7332
This introduces the required code completion callbacks which pass partially
parsed TypeReprs to code completion. These types can refer to generic function
parameters. Because we need to typecheck these types, we need to typecheck
generic parameters first. Because exposing fine-grained typechecker interface
just for code completion is bad, we create a function declaration based on the
limited information we have (i.e., just the function name and generic
parameters) and pass that to the typechecker. This approach (in theory) should
work uniformly for function decls and nominal type decls, but the nominal type
decl case is not tested yet. Eventually we will also want to use a similar
approach for normal parser recovery as well.
Swift SVN r7313
is not a type-identifier
Just parse type-simple instead and let the type checker diagnose the invalid
cases. The only exception is when a tuple becomes a ParenType: it is
canonically equivalent to the wrapped type, and thus the parser uses the
TypeRepr to diagnose that case.
Swift SVN r7275
parameters while parsing the function signature. Generic parameters are not
accessible at that time through the AST node, because the FuncDecl AST node was
not constructed yet.
Swift SVN r7222
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
integration
Motivation: libIDE clients should be simple, and they should not have to
translate token-based SourceRanges to character locations.
This also allows us to remove the dependency of DiagnosticConsumer on the
Lexer. Now the DiagnosticEngine translates the diagnostics to CharSourceRanges
and passes character-based ranges to the DiagnosticConsumer.
Swift SVN r7173
Now parseList() always sets RBLoc, which fixes the crash.
parseDeclUnionElement() now skips to the next decl, instead of ":", which may
not appear in the file at all.
Swift SVN r7117
Constructor delegation in parser was useless, because the code was split
between the constructors arbitrarily.
There was no need to pass down IsMainModule because the parser could figure
that out on its own. Also rename it to allowTopLevelCode() to better describe
what it actually affects.
Swift SVN r7098
a closing brace.
Fixes two bugs:
* delayed parsing was not correctly skipping over the function body because it
stopped at the 'var' decl;
* parser was not creating a BraceStmt for the function body if it could not
find the closing brace.
Swift SVN r7062
As discussed, this is an interim syntax for re-exports:
import [exported] Foundation
In the long run, we're probably going to use the same syntax as access
control for this, but that hasn't been designed yet.
Swift SVN r7050