Commit Graph

30 Commits

Author SHA1 Message Date
Michael Gottesman
7b0d8455ca [ast][silgen] Wire up the case body var decls and use them in SILGenPattern emission to fix the evil fallthrough bug.
rdar://47467128
2019-04-03 23:51:06 -07:00
Michael Gottesman
6af14bdb4b [parse] Implement a dump method on Scope using a new debugVisit method on TreeScopedHashTable.
This is just for use in the debugger when one may want to know what is in the
current scope. The order is not guaranteed but at least it can provide /some/
info ignoring that property. These are no-ops when not in asserts and I put in a
compile time warnign to make sure it is not used in the actual code base.
2019-03-10 15:37:19 -07:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Rintaro Ishizaki
3794aabffc [Parse] Remove unused ScopeKind 2018-08-29 01:00:02 +09:00
Sho Ikeda
46aae67a1e [gardening][Parse] Replace typedef with using 2018-03-30 12:59:41 +09:00
Robert Widmann
d2570cb964 Restore local type declarations list 2017-01-06 16:16:39 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Robert Widmann
72beb9d80d Extract common code into StmtTransformer 2016-12-14 14:59:47 -05:00
Robert Widmann
a060eb5aca [SE-0075] Transfer the power of config resolution to Namebinding
This completely removes Parse’s ability to make any judgement calls
about compilation conditions, instead the parser-relevant parts of
‘evaluateConditionalCompilationExpr’ have been moved into
‘classifyConditionalCompilationExpr’ where they exist to make sure only
decls that we want to parse actually parse later.

The condition-evaluation parts have been moved into NameBinding in the
form of a Walker that evaluates and collapses IfConfigs.  This walker
is meant as an homage to PlaygroundLogger.  It should probably be
factored out into a common walker at some point in the future.
2016-12-14 14:59:47 -05:00
Doug Gregor
f2423b9bbd [Parser] Treat inheritance clauses as a separate scope.
This prevents us from looking in the enclosing scope to resolve names.
2016-12-07 08:10:11 -08: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
Doug Gregor
d251c7a731 Merge pull request #1522 from kballard/conditional-compilation-overloads
[Parse] Don't error on overloads in a conditional compilation block
2016-03-14 11:40:04 -07:00
Kevin Ballard
502b159400 [Parse] Store DeclNames in Scope instead of Identifiers
This fixes a problem where compound names like `foo(_:bar:)` were being
resolved to variables declared with the same base name.

Fixes most of SR-880.
2016-03-04 23:42:17 -08:00
Kevin Ballard
a734063bb4 [Parse] Don't error on overloads in a conditional compilation block
Fixes SR-826.
2016-03-03 19:45:00 -08:00
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