Commit Graph

21 Commits

Author SHA1 Message Date
Rintaro Ishizaki
d6556434cd [AST] Make 'StmtConditionElement' a single 'PointerUnion'
Previously, 'IntroducerLoc' and 'ThePattern' were only used for pattern
binidng cases. Create a new 'ConditionalPatternBindingInfo' type to
cover such cases, and make 'StmtConditionElement' a pure 'PointerUnion'
type.

This makes it clear which fields are used in which condition kind. Also,
we can expect overall size reduction of StmtCondition when the
majority of the conditions are simple boolean expressions.
2023-12-13 12:52:53 -08:00
Slava Pestov
d7f4b1a1bd AST: Capture list bindings now point back to their parent CaptureListExpr
We'll need this to get the right 'selfDC' when name lookup
finds a 'self' declaration in a capture list, eg

class C {
  func bar() {}
  func foo() {
    _ = { [self] in bar() }
  }
}
2020-09-18 02:59:15 -04:00
Brent Royal-Gordon
6a8598a99c [NFC] Remove DeclNameRef staging calls 2019-12-11 00:55:18 -08:00
Brent Royal-Gordon
addbe3e5ed [NFC] Thread DeclNameRef through most of the compiler
This huge commit contains as many of the mechanical changes as possible.
2019-12-11 00:55:18 -08:00
Slava Pestov
a532a325e1 AST: Move a few methods from VarDecl down to ParamDecl 2019-07-22 20:19:09 -04:00
Harlan
dc1bc823e6 [InterfaceGen] Remove #ifs from default arguments (#19075)
* [InterfaceGen] Remove #ifs from default args

This patch removes all #if configs form the bodies of default arguments,
which can contain multiline closures, while preserving the bodies of the
clauses that are active.

This code is generalized and should "just work" for inlinable function
bodies, which will come in a later patch.

* Address review comments

* Fix and test CharSourceRange.overlaps

* Fix CharSourceRange::print to respect half-open ranges
2018-08-31 20:18:48 -07:00
Slava Pestov
4b258e86e6 AST: Stop setting contextual types on ParamDecls
VarDecl::getType() lazily maps the interface type into context if needed.
2018-08-10 13:33:12 -07:00
Davide Italiano
e30b1f5101 [AST/Unittest] Don't swallow a const qualifier.
I found this by inspection (also, I found that newer
clang versions also warns for this under -Wall). While here,
convert to static_cast<> for a more idiomatic C++.
2017-09-11 18:04:43 -07:00
Robert Widmann
ac5594dabe Use a meaningful representation of parameter specifiers
In anticipation of future attributes, and perhaps the ability to
declare lvalues with specifiers other than 'let' and 'var', expand
the "isLet" bit into a more general "specifier" field.
2017-06-29 16:03:49 -07:00
Maxwell Swadling
9edb93693b Updated the tests for when the AssignExpr's EqualLoc is invalid 2017-01-26 12:31:37 +11:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Brian Gesiak
4108e1d9af [Sema] Mark VarDecl in capture lists
Fixes SR-2757.

Variables in capture lists are treated as 'let' constants, which can
result in misleading, incorrect diagnostics. Mark them as such in order
to produce better diagnostics, by adding an extra parameter to the
VarDecl initializer.

Alternatively, these variables could be marked as implicit, but that
results in other diagnostic problems: capture list variables that are
never used produce warnings, but these warnings aren't normally emitted for
implicit variables. Other assertions in the compiler also misfire when
these variables are treated as implicit.

Another alternative would be to walk up the AST and determine whether
the `VarDecl`, but there doesn't appear to be a way to do so.
2017-01-01 12:41:06 -05: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
Mishal Shah
f08601f550 Merge pull request #5321 from mxswd/tuple-expr-sourcerange
Updated TupleExpr's getSourceRange to inspect child elements source ranges
2016-10-18 16:16:58 -07:00
Maxwell Swadling
7f1f3b5aa2 fixed typo 2016-10-17 20:36:45 -07:00
Maxwell Swadling
3c7a17e261 Fixed a bug in AssignExpr that caused it to create invalid source ranges 2016-10-16 17:41:28 -07:00
Maxwell Swadling
5999021878 Fixed a bug in StmtConditionElement::getSourceRange where it would create invalid source ranges
This bug was causing an assert.
2016-10-16 16:34:59 -07:00
Maxwell Swadling
91e3c67493 Updated TupleExpr's getSourceRange to inspect child elements source ranges 2016-10-16 13:30:43 -07:00
Maxwell Swadling
dbeec26ac6 Added test for when the 2nd element of a tuple expr has an invalid source range
Also cleaned up the variable names
2016-10-12 09:55:20 -07:00
Maxwell Swadling
339e40fb02 Fixed an assert caused when a TupleExpr that didn't have a valid SourceRange had a valid SourceLoc for the first element but not for the last 2016-10-08 23:31:01 -07:00
Jordan Rose
4ec661d9b7 Fix the SourceRange of an AssignExpr with an implicit source.
Fixed by Maxwell Swadling, unit test by me.
2016-09-14 19:55:08 -07:00