Commit Graph

808 Commits

Author SHA1 Message Date
Dmitri Hrybenko
91ce21666d Change 'func' keyword to 'def'
I tried hard find all references to 'func' in documentation, comments and
diagnostics, but I am sure that I missed a few.  If you find something, please
let me know.

rdar://15346654


Swift SVN r9886
2013-11-02 01:00:42 +00:00
Dmitri Hrybenko
238d898a0d Code completion for enums: model completion in switch case as a separate kind
of completion.  This approach (rather than SourceLoc tricks) better reflects
the intent and allows us to fix the rest of testcases.


Swift SVN r9557
2013-10-21 20:58:23 +00:00
Dmitri Hrybenko
de6a0a0f8c Code completion: complete references to enum elements in switch statements when
we have enough type context to find the correct enum


Swift SVN r9439
2013-10-17 02:09:49 +00:00
Dmitri Hrybenko
278cbad8a4 Code completion: don't produce any results in enum case. Only integer literals
are allowed in that context.


Swift SVN r9383
2013-10-15 22:45:54 +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
Manman Ren
d503c65036 SILParser: parse sil_vtable
rdar://15165644


Swift SVN r9342
2013-10-15 00:52:40 +00:00
Argyrios Kyrtzidis
74ba1e8851 [Parser] In Parser::parseBraceItemList, when we don't find a right brace recover by using the PreviousLoc.
This ensures that the brace range will include all contained items.
The previous scheme of choosing the end location of the last item was not accurate because for pattern bindings decls
we also push the var decls as items, but they don't have the full source range of the pattern binding decl.

Fixes rdar://15190792.

Swift SVN r9293
2013-10-13 18:50:53 +00:00
Chris Lattner
b8baf03495 rename parseAttribute* to parseDeclAttribute*, since they
are for decl attributes.


Swift SVN r9288
2013-10-13 16:53:44 +00:00
Chris Lattner
24ff772bad switch get/set specifiers to the new attribute syntax, and completely remove
the old syntax, woo.


Swift SVN r9287
2013-10-13 16:50:03 +00:00
Chris Lattner
6e006bbfea remove the (unused now) AttrListKind enum which previously distinguished
between decl and type attributes.  Now that these are going down different
paths, it isn't needed.


Swift SVN r9267
2013-10-13 03:33:22 +00:00
Chris Lattner
a718c8f57a start improving the attribute implementation: start with passing down
a "kind" for the attribute, to indicate whether the caller is looking for
a type, decl, or sil attribute.  This is currently unused.


Swift SVN r9261
2013-10-12 22:13:51 +00:00
Dmitri Hrybenko
2123682ed9 Code completion / parser: propagate code completion bits from braced stmt
Swift SVN r9125
2013-10-10 02:00:28 +00:00
Dmitri Hrybenko
af4ad7e9b7 Code completion: assign a special semantic context for iteration variables
in a C-style for loop


Swift SVN r9111
2013-10-09 23:32:59 +00:00
Chris Lattner
f990775e3c enhance the parser to parse the new attribute syntax on all decls. Switch a few
testcases to use it.


Swift SVN r8910
2013-10-04 05:03:52 +00:00
Dmitri Hrybenko
04a8cdef03 Completely remove the 'constructor' keyword
Swift SVN r8882
2013-10-03 18:12:15 +00:00
Joe Groff
66dafba3f5 Reject empty switch statements.
<rdar://problem/14432432>

Swift SVN r8829
2013-10-02 01:07:19 +00:00
Jordan Rose
e05c03d5bc Standardize terminology for "computed", "stored", "variable", and "property".
These are the terms sent out in the proposal last week and described in
StoredAndComputedVariables.rst.

variable
  anything declared with 'var'
member variable
  a variable inside a nominal type (may be an instance variable or not)
property
  another term for "member variable"
computed variable
  a variable with a custom getter or setter
stored variable
  a variable with backing storage; any non-computed variable

These terms pre-exist in SIL and IRGen, so I only attempted to solidify
their definitions. Other than the use of "field" for "tuple element",
none of these should be exposed to users.

field
  a tuple element, or
  the underlying storage for a stored variable in a struct or class
physical
  describes an entity whose value can be accessed directly
logical
  describes an entity whose value must be accessed through some accessor

Swift SVN r8698
2013-09-26 18:50:44 +00:00
Joe Groff
e109124186 Replace 'union' keyword with 'enum'.
This only touches the compiler and tests. Doc updates to follow.

Swift SVN r8478
2013-09-20 01:33:14 +00:00
Doug Gregor
978959ced8 Make the "init" and "constructor" keywords synonymns.
Swift SVN r8391
2013-09-18 04:23:28 +00:00
Dmitri Hrybenko
f1f189f4e0 Rename PipeClosureExpr -> ClosureExpr
Swift SVN r8321
2013-09-17 01:37:36 +00:00
Dmitri Hrybenko
10291e0334 Make AbstractClosureExpr a DeclContext
(remove DeclContext base class from PipeClosureExpr and ImplicitClosureExpr)


Swift SVN r8303
2013-09-16 22:39:12 +00:00
Dmitri Hrybenko
a1f5f2ba25 Switch 'case' parsing: when the parser expects a colon, don't unconditionally
consume the next token; consume the token only if it is actually a colon.


Swift SVN r8010
2013-09-06 22:33:36 +00:00
Dmitri Hrybenko
fbe081b06b Mark diagnostics from c-style-for parsing as PointsToFirstBadToken
Swift SVN r8008
2013-09-06 22:15:54 +00:00
Dmitri Hrybenko
d44177165e Improve QoI for "expected expression in 'return' statement" diagnostic
- suppress error from type checker (missing return value in a non-void
  function) if the source had an expression, but had a parse error;

- mark the diagnostic as PointsToFirstBadToken.


Swift SVN r8004
2013-09-06 21:34:28 +00:00
Dmitri Hrybenko
f24063da4e Parser: don't try to parse the expression after 'return' if we see the
beginning of decl (we used to only check for the beginning of statement).
This is going to be a parse error anyway.


Swift SVN r8003
2013-09-06 21:24:28 +00:00
Dmitri Hrybenko
b38d8e38b8 Code completion: basic completion inside closures
This does not mean that it works well, we just don't crash like we used to.


Swift SVN r7889
2013-09-04 01:31:20 +00:00
Dmitri Hrybenko
dfec888b1c Parser: build AST for 'for <expr>; {}' and improve partial type checking of
function bodies

Allows us to fix a few FIXMEs in code completion.


Swift SVN r7883
2013-09-04 00:23:20 +00:00
Dmitri Hrybenko
d24a5d7aa4 Improve recovery in parsing the c-style for statement
Allows code completion to see declarations in the init part of the for
statement.


Swift SVN r7878
2013-09-03 23:10:13 +00:00
Dmitri Hrybenko
47629bf856 Revert unintended change
Swift SVN r7825
2013-08-31 01:58:05 +00:00
Dmitri Hrybenko
23ced2fba3 Move the parseIdentifierDeclName() helper above parseDeclExtension()
(so that extension parsing can use these helpers)


Swift SVN r7824
2013-08-31 01:54:50 +00:00
Dmitri Hrybenko
47f529d8a4 Fix variable name case. The rest of the file seems consistent.
Swift SVN r7755
2013-08-29 22:22:34 +00:00
Dmitri Hrybenko
ddfa9bc8d8 Parser::skip*() routines: don't stop on code completion token anymore
Our recovery is better now, and we don't skip that much.  Actually, even if we
would stop at code completion token during recovery, completion results would
be something very generic anyway (because there is no interesting parser state
to observe), and these results can be produced as a fallback separately (not
implemented).


Swift SVN r7754
2013-08-29 22:15:12 +00:00
Dmitri Hrybenko
d98408425e Remove unused OwningPtr.h includes
Swift is C++11 and uses std::unique_ptr.


Swift SVN r7731
2013-08-29 20:09:49 +00:00
Dmitri Hrybenko
cfe695166a Parser: if we parsed a bare closure as an expression, it will be a discarded
value expression and the type checker will complain anyway.

Instead, recover by unwrapping the BraceStmt that is contained inside, and
produce a specialized diagnostic.


Swift SVN r7680
2013-08-28 19:37:51 +00:00
Dmitri Hrybenko
9447f6c73f parseBraceItems(): don't skip over braced lists of statements during recovery
This increases the amount of noise in diagnostics.  But we did not get these
diagnostics before because we were just skipping these brace statements.  We
shoud improve recovery in parsing of whatever declaration that precedes the
brace statement so that it is picked up as a body of that declaration.


Swift SVN r7679
2013-08-28 19:33:43 +00:00
Dmitri Hrybenko
dd1c2f7477 Parser: consume tok::code_complete where it is handled
We did not consume it before because parseBraceItems() relied on seeing it to
do delayed parsing.


Swift SVN r7648
2013-08-27 23:48:54 +00:00
Dmitri Hrybenko
567d120803 parseStmtIf(): Actually propagate error bits from condition.
Swift SVN r7645
2013-08-27 23:04:25 +00:00
Dmitri Hrybenko
15a4a10cfe parseStmtIf(): propagate error bits correctly
This decreases noise in diagnostics.


Swift SVN r7644
2013-08-27 22:59:52 +00:00
Dmitri Hrybenko
db44574605 parseBraceItemList(): use ParserResult
Now we propagate error bits better, which decreases noise in diagnostics in one
case.


Swift SVN r7628
2013-08-27 19:01:15 +00:00
Dmitri Hrybenko
d07a5e82cc parseStmtCase(): use ParserResult
Swift SVN r7620
2013-08-27 02:09:08 +00:00
Dmitri Hrybenko
c3c5d7d5f3 parseStmt(): use ParserResult
Swift SVN r7617
2013-08-27 01:08:02 +00:00
Dmitri Hrybenko
14f6b67797 Correctly propagate code completion bits from parseExprPostfix() during the
first parsing pass.  This allows us to remove a workaround in parseBraceItems()
that directly looks at the current token.


Swift SVN r7616
2013-08-27 01:06:48 +00:00
Dmitri Hrybenko
78d2f03a8d parseStmtSwitch(): use ParserResult
Swift SVN r7614
2013-08-27 00:48:24 +00:00
Dmitri Hrybenko
cadc9016c5 parseExprOrStmt(): use ParserStatus
Swift SVN r7613
2013-08-27 00:41:37 +00:00
Dmitri Hrybenko
e1d39e5052 parseStmtFor(): use ParserResult
Swift SVN r7612
2013-08-27 00:20:29 +00:00
Dmitri Hrybenko
09ad614035 parseStmtDoWhile(): use ParserResult
Swift SVN r7608
2013-08-26 23:43:09 +00:00
Dmitri Hrybenko
a9f56c4839 parseStmtWhile(): use ParserResult
Swift SVN r7606
2013-08-26 23:38:52 +00:00
Dmitri Hrybenko
45c46314ab parseStmtIf(): use ParserResult
Swift SVN r7605
2013-08-26 23:33:32 +00:00
Dmitri Hrybenko
c6f0dd106d parseStmtReturn(): use ParserResult
This caught a bug in parseExprPostfix(): it did not return a code completion
status.


Swift SVN r7603
2013-08-26 23:18:51 +00:00
Dmitri Hrybenko
a677146247 switch 'case' parsing: don't stop on the first error, leaving the rest of the
switch body not consumed and confusing the rest of the parser

Allows us to complete expressions and types inside 'case'.


Swift SVN r7599
2013-08-26 22:47:43 +00:00