Commit Graph

16 Commits

Author SHA1 Message Date
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Joe Groff
2cf81672c1 AST: Correct scoping of 'while' condition bindings.
Fixes rdar://problem/22210545.

Swift SVN r31945
2015-09-14 22:52:22 +00:00
Chris Lattner
652aace9a6 Reapply: Fix vardecl parsing so that variables bound in a refutable pattern are not in scope when parsing the else clause. Make an effort to diagnose attempts to use them with a custom error message for good QoI.
... with a fix for the nested case that broke expr/closure/closures.swift.



Swift SVN r27109
2015-04-08 00:13:53 +00:00
Ted Kremenek
e5cbb67d7d Revert "Fix vardecl parsing so that variables bound in a refutable pattern are not in"
This is an attempt to unbreak the build.

Swift SVN r27094
2015-04-07 21:40:22 +00:00
Chris Lattner
2ed83b32ff Fix vardecl parsing so that variables bound in a refutable pattern are not in
scope when parsing the else clause.  Make an effort to diagnose attempts to 
use them with a custom error message for good QoI.



Swift SVN r27089
2015-04-07 20:29:42 +00:00
John McCall
a0a16d78d2 Implement the do/catch statement. Tests to follow.
This patch also introduces some SILGen infrastructure for
dividing the function into "ordinary" and "postmatter"
sections, with error-handling-like stuff going into the
final section.  Currently, this is largely undermined by
SILBuilder, but I'm going to fix that in a follow-up.

Swift SVN r26422
2015-03-23 02:08:26 +00:00
Jordan Rose
9b5134d10a [Parse] Don't add local types from inactive #if blocks to the master list.
Otherwise we'll get all the way to IRGen and then try to emit them. And try
to reference them in serialization.

rdar://problem/19935034

Swift SVN r25567
2015-02-26 23:37:20 +00:00
Joe Pamer
988a5877f2 Some updates:
- Respond to Doug's code review feedback
   - Stop hacking around with scopes and use "emplace" to work around RAII in the inactive config case
   - Limit use of StringRef on the front-end, in favor of std::string
   - Use ArrayRef rather than SmallVector within IfConfigDecl
   - Reorder new property declarations on BraceStmt to prevent unnecessary alignment issues
- Update ParseBraceItems to better capture top-level declarations, rather than using token lookahead

Swift SVN r14306
2014-02-24 18:16:49 +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
Joe Groff
9fe1ab427a Implement 'if let' and 'while let' statements.
Allow IfStmts and WhileStmts to have as their condition either an expression, as usual, or a pattern binding introduced by 'var' or 'let', which will conditionally bind to the value inside an optional. Unlike normal pattern bindings, these bindings require an in-line initializer, which will be required to be Optional type. Parse variable bindings in this position, and type-check them by requiring an Optional on the right-hand side and unwrapping it to form the pattern type. Extend SILGen's lowering of if and while statements to handle conditionally binding variables.

Swift SVN r13146
2014-01-30 10:37:39 +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
Jordan Rose
674a03b085 Replace "oneof" with "union"...everywhere.
We haven't fully updated references to union cases, and enums still are not
their own thing yet, but "oneof" is gone. Long live "union"!

Swift SVN r6783
2013-07-31 21:33:33 +00:00
Argyrios Kyrtzidis
66d1e516c8 Refactor how multiple parsing passes and delayed parsing works.
-Introduce PersistentParserState to represent state persistent among multiple parsing passes.
  The advantage is that PersistentParserState is independent of a particular Parser or Lexer object.
-Use PersistentParserState to keep information about delayed function body parsing and eliminate parser-specific
  state from the AST (ParserTokenRange).
-Introduce DelayedParsingCallbacks to abstract out of the parser the logic about which functions should be delayed
  or skipped.

Many thanks to Dmitri for his valuable feedback!

Swift SVN r6580
2013-07-25 01:40:16 +00:00
Dmitri Hrybenko
1c0233efb1 Move lib/Parse/{Parser.h, Scope.h} -> include/swift/Parse/
Swift SVN r6062
2013-07-08 20:36:40 +00:00
Chris Lattner
5d9e2e4a8d now that the Sema code is in the parse library, the Sema headers are all private, make it so.
Swift SVN r544
2011-08-13 21:15:17 +00:00
Chris Lattner
33f774f9b7 Rearrange a bunch of code for better layering: instead of Parser depending on Sema,
just move the Sema code into the Parser library.  There is no way to use one without
the other.  The library formerly known as Sema will get renamed.


Swift SVN r542
2011-08-13 21:06:10 +00:00