Commit Graph

557 Commits

Author SHA1 Message Date
Dmitri Hrybenko
f198c28d75 Serialize @required as a DeclAttribute
Also introduce an invalid bit on a DeclAttribute for use by semantic analysis.

This fixes AST printing for @required.


Swift SVN r15938
2014-04-04 15:24:47 +00:00
Doug Gregor
5fd25eb4ef Revert "AST printing for functions where the first parameter has a separate name."
This reverts r15141.

Conflicts:
	lib/AST/ASTPrinter.cpp

Swift SVN r15845
2014-04-02 23:27:50 +00:00
Doug Gregor
6496d69cb8 Simplify down to a single command-line option for preposition splitting.
Swift SVN r15835
2014-04-02 21:44:19 +00:00
Dmitri Hrybenko
78e354b2b9 AST printing: make PrintDefaultParameterPlaceholder the default (since we are
not going to implement expression printing any time soon), and fix a bug in its
implementation: when used with deserialized modules, "= default" was not
printed.


Swift SVN r15798
2014-04-02 13:56:54 +00:00
Dmitri Hrybenko
e42a3e5762 AST printer: undo the damage of r15737, while retaining the whitespace handling
refactoring, allowing ASTPrinter callbacks to be called exactly when a first
non-whitespace character of the declaration is printed, ignoring the
indentation and leading blank lines.


Swift SVN r15743
2014-04-01 20:07:41 +00:00
Dmitri Hrybenko
95cc4ef483 AST printer: print a blank line before a declaration with a documentation
comment

rdar://16432279


Swift SVN r15741
2014-04-01 17:53:19 +00:00
Dmitri Hrybenko
e531e4dd0f AST printer: improve handling of newlines and indentation to more precisely
capture source ranges of declarations


Swift SVN r15737
2014-04-01 17:10:41 +00:00
John McCall
f1180f5e6d in order to work correctly for non-@objc protocols.
Language features like erasing concrete metatype
values are also left for the future.  Still, baby steps.

The singleton ordinary metatype for existential types
is still potentially useful; we allow it to be written
as P.Protocol.

I've been somewhat cavalier in making code accept
AnyMetatypeType instead of a more specific type, and
it's likely that a number of these places can and
should be more restrictive.
When T is an existential type, parse T.Type as an
ExistentialMetatypeType instead of a MetatypeType.

An existential metatype is the formal type
 \exists t:P . (t.Type)
whereas the ordinary metatype is the formal type
 (\exists t:P . t).Type
which is singleton.  Our inability to express that
difference was leading to an ever-increasing cascade
of hacks where information is shadily passed behind
the scenes in order to make various operations with
static members of protocols work correctly.

This patch takes the first step towards fixing that
by splitting out existential metatypes and giving
them a pointer representation.  Eventually, we will
need them to be able to carry protocol witness tables

Swift SVN r15716
2014-04-01 00:38:28 +00:00
Doug Gregor
d51744e396 Clang importer: add @objc(name) attributes to imported classes and protocols.
Now that we represent the Objective-C runtime names of classes and
protocols in a uniform way, stop peeking into the Clang AST nodes to
get this information for imported classes and protocols. This is
better layering and helps test that new code path.


Swift SVN r15632
2014-03-29 21:15:29 +00:00
Doug Gregor
055e0ef136 Add an "implicit" bit to DeclAttribute.
Swift SVN r15623
2014-03-29 17:24:15 +00:00
Dmitri Hrybenko
1d6c76c352 Module interface printing: pass through documentation comments for imported
declarations

rdar://16408910


Swift SVN r15576
2014-03-28 10:54:06 +00:00
Sonny Falk
275eb64dd6 Rename the option for default parameter placeholder to better reflect
the meaning, PrintDefaultParameterPlaceholder.

Swift SVN r15566
2014-03-27 21:26:42 +00:00
Sonny Falk
7f83777900 Add an option to print a placeholder for variable initializers.
This allows us to pretty print default function parameters as:
func foo(arg1: Int = default)

Swift SVN r15564
2014-03-27 20:53:58 +00:00
Sonny Falk
4867e37b01 Restore r15378: fix the AST printer to print "let" for let variables.
Update the associated tests.

Swift SVN r15536
2014-03-26 23:44:52 +00:00
Dmitri Hrybenko
92b29ef045 Revert "Module interface printing: pass through documentation comments for
imported declarations"

rdar://16408910


Swift SVN r15527
2014-03-26 21:28:42 +00:00
Doug Gregor
1cdd295182 Move the @objc attribute over to a DeclAttribute.
Swift SVN r15517
2014-03-26 19:33:07 +00:00
Dmitri Hrybenko
30c6eeff16 Module interface printing: pass through documentation comments for imported
declarations

rdar://16408910


Swift SVN r15511
2014-03-26 16:16:02 +00:00
Dmitri Hrybenko
7e294eea4d Module interface printing: print imported Clang declarations in header source
order

rdar://problem/16408837


Swift SVN r15505
2014-03-26 11:36:25 +00:00
Doug Gregor
38c6b197b8 AST printing using the proposed unified function syntax, when splitting selectors.
No tests and no parsing support; this is for experimentation only.


Swift SVN r15456
2014-03-25 16:13:02 +00:00
Dmitri Hrybenko
46fbf21e59 Remove trailing whitespace
Swift SVN r15454
2014-03-25 14:48:12 +00:00
Chris Lattner
0bec9700e8 Add a hack to the ASTPrinter, when printing PatternBindingDecls to print
immutable variables with a let prefix instead of a 'var' prefix.  This allows
us to AST print this as 'let' instead of 'var', which isn't totally awesome,
but is better than misleading people with var.

func f() {
  let x : Int  = 42
}

Also, fix the SILPrinter to explode pattern binding decls, so that it doesn't
fall into the booby traps inherent in PatternBindingDecl printing.


Swift SVN r15393
2014-03-23 16:37:51 +00:00
Chris Lattner
4b0808f47e revert r15378. It turns out that PatternBindingDecls are the ones that are botching
the immutability issue.


Swift SVN r15392
2014-03-23 16:17:55 +00:00
Chris Lattner
00e546adda fix the AST printer to print "let" for let variables.
Swift SVN r15378
2014-03-23 05:24:53 +00:00
Dmitri Hrybenko
11fea869c1 Change 'switch' not to fall through between empty cases and always require at
least one statement per case

rdar://16301313


Swift SVN r15266
2014-03-20 11:44:59 +00:00
John McCall
c40a2e54b2 Extract a method to print a CheckedCastKind and dump
it on CheckedCastExprs.

Swift SVN r15245
2014-03-19 20:25:09 +00:00
Doug Gregor
39da9742b1 AST printing for functions where the first parameter has a separate name.
Swift SVN r15141
2014-03-17 16:36:06 +00:00
Joe Groff
34400bd64b Add 'print' and 'dump' methods to GenericSignature.
Swift SVN r14944
2014-03-12 00:50:41 +00:00
Joe Groff
b08f06f191 Revert "Accept (and prefer) "import type" as a scoped import for any non-protocol type."
This reverts commit r14488, since we're demoting 'type' back to a plain old identifier.

We could consider reallowing 'type' as a contextual keyword here, but from talking to Jordan he was OK with just reverting this functionality.

Swift SVN r14931
2014-03-11 23:18:30 +00:00
Chris Lattner
d758e0dfe3 Eliminate more "DynamicLookup" in favor of "AnyObject", this is the
bulk of finishing rdar://13327098.


Swift SVN r14653
2014-03-04 22:15:46 +00:00
Doug Gregor
15be2159a2 Rename "abstract initializers" to "required initializers".
It's better than what we have.

Swift SVN r14620
2014-03-03 23:12:40 +00:00
Chris Lattner
11bedff2f3 the swift.Slice type got removed a long time ago, being replaced with
what is now Swift.Array.  Update various internal stuff to refer to
Array instead of Slice.  NFC.


Swift SVN r14567
2014-03-02 06:21:37 +00:00
Doug Gregor
571ae697d5 Parsing and AST support for complete object initializers.
Enforce that complete object initializers always be delegating.

Swift SVN r14549
2014-03-01 00:51:18 +00:00
Jordan Rose
1fe8630bcd Accept (and prefer) "import type" as a scoped import for any non-protocol type.
Previously this was spelled "import typealias", and that spelling will
continue to be allowed (since someone may specifically be importing a
typealias and want that to match), but now that 'type' is a keyword,
"import type" is the right way to spell the generic "import any type"
scoped import.

Swift SVN r14488
2014-02-27 23:46:06 +00:00
Joe Groff
8e6b353542 Derive conformances of Equatable and Hashable for simple enums.
If an enum has no cases with payloads, make it implicitly Equatable and Hashable, and derive default implementations of '==' and 'hashValue'. Insert the derived '==' into module context wrapped in a new DerivedFileUnit kind, and arrange for it to be codegenned with the deriving EnumDecl by adding a 'DerivedOperatorDecls' array to NominalTypeDecls that gets visited at SILGen time.

Swift SVN r14471
2014-02-27 20:28:38 +00:00
Doug Gregor
1e8f02a45d Start diagnosing "deinit () { }".
Now that we do this, update the standard library, tests, other documents, etc.

Swift SVN r14423
2014-02-26 23:01:25 +00:00
Dmitri Hrybenko
ae535f34f0 AST Printer: fix printing of willSet/didSet
Swift SVN r14391
2014-02-26 12:15:54 +00:00
Doug Gregor
981f8f6509 Rename "destructor" -> "deinit" (as a keyword) and -> "deinitializer" (in diagnostics).
Swift SVN r14380
2014-02-26 05:51:45 +00:00
Doug Gregor
0bde325327 Collapse 'DynamicSelf' into 'Self'.
Swift SVN r14377
2014-02-26 05:04:05 +00:00
Joe Groff
98d6fecc99 '.metatype' -> '.Type'
Also, reserve 'type' as a keyword for ensuing syntax changes.

Swift SVN r14375
2014-02-26 04:23:21 +00:00
Joe Pamer
f83f94d9d8 Support build and target configurations
These changes add support for build and target configurations in the compiler.
Build and target configurations, combined with the use of #if/#else/#endif allow
for conditional compilation within declaration and statement contexts.

Build configurations can be passed into the compiler via the new '-D' flag, or
set within the LangOptions class. Target configurations are implicit, and
currently only "os" and "arch" are supported.

Swift SVN r14305
2014-02-24 18:16:48 +00:00
Dmitri Hrybenko
38ca644b77 Fix prining of 'inout' in types
This completes the fix for rdar://15999689


Swift SVN r14303
2014-02-24 15:48:43 +00:00
Dmitri Hrybenko
71f818b77f Fix prining of 'inout' in declarations
Partially addresses rdar://15999689


Swift SVN r14302
2014-02-24 15:25:00 +00:00
Dmitri Hrybenko
94eb4f986a Module interface printing: don't print { get set } when it is the default
rdar://16070050


Swift SVN r14286
2014-02-23 15:14:28 +00:00
Dmitri Hrybenko
3da05e347d Change property accessor syntax to include braces
See release notes update for details.

rdar://15966905


Swift SVN r14271
2014-02-22 21:00:56 +00:00
Doug Gregor
0da11a8b0b Implement semantic analysis for abstract initializers.
Swift SVN r14221
2014-02-21 19:41:14 +00:00
Argyrios Kyrtzidis
eeb9589d2c [AST] Introduce "hasName()" convenience methods and replace "getName().empty()" callers.
Swift SVN r14206
2014-02-21 15:00:38 +00:00
Dmitri Hrybenko
0fe2b682bd Fix spaces in AST printer results for { get set }
Swift SVN r14143
2014-02-20 11:50:32 +00:00
Doug Gregor
a1673d7c8f Add an Objective-C metatype representation spelled with @objc_metatype.
This representation is just a placeholder at the moment.


Swift SVN r14076
2014-02-19 07:21:38 +00:00
Doug Gregor
c54f98fbc9 Convert thick/thin metatype bool to an enumeration. NFC
Swift SVN r14075
2014-02-19 06:05:48 +00:00
Chris Lattner
ecbbb4a42c rework our representations of subscripts to not curry the indexes
separately from the get/set value.  There is no exposed way in the
source language to use this, and this causes shorter term annoyance.

I chose to flatten the value and indices so the value comes first.
In principle, this allows us to completely eliminate our ObjC importer
thunks.  I haven't removed them though, because they might be useful
for something else.


Swift SVN r14049
2014-02-18 21:34:33 +00:00