Eli Friedman
fd62cbac65
Refactor extension parsing so it's centralized, and so we parse the body of the extension in the correct DeclContext.
...
Swift SVN r1745
2012-05-04 20:59:50 +00:00
Chris Lattner
2f44c0038c
Initial stab at implementing string literal interpolation for simple expressions,
...
e.g. "foo is \(i+j)". This implements rdar://11223686
Doug implemented all the hard parts of this. I ripped out support for nested string
literals (i.e. string literals within an interpolated string), which simplified the
approach and defined away some problems with his patch in progress. I plan a few refinements
on top of this basic patch.
Swift SVN r1738
2012-05-04 05:53:50 +00:00
Chris Lattner
774a557e5c
Merge NamedDecl into ValueDecl, rdar://11379147.
...
Swift SVN r1737
2012-05-04 04:50:53 +00:00
Eli Friedman
255c5c0b14
Fix some obvious issues in DeclNodes.def found by inspection.
...
Swift SVN r1735
2012-05-04 00:51:03 +00:00
Eli Friedman
e6177f35a9
Get rid of the outdated notion of type lookup in Module. <rdar://problem/11026489>.
...
Swift SVN r1734
2012-05-04 00:41:54 +00:00
Eli Friedman
3dbb44e8e8
'\0' is not an operator character. Make sure Identifier::isOperatorChar knows that.
...
Swift SVN r1723
2012-05-03 20:33:17 +00:00
Chris Lattner
1ab9a54775
fix a comment typo
...
Swift SVN r1722
2012-05-03 05:37:42 +00:00
Eli Friedman
ff2bef9d62
Extend variable declaration grammar to allow "var a, b : Int, c, d : Double". <rdar://problem/11349535>.
...
I've tried to be pretty strict about exactly which cases we accept here, to avoid any confusing cases.
Swift SVN r1721
2012-05-03 00:49:16 +00:00
Chris Lattner
46c94377f1
Add support for var decls in the initializer of a c-style for loop,
...
implementing rdar://11360347 / 11349750. C-style for loops could be
further enhanced by allowing a comma-separated list of statements in
the increment, but this isn't something I plan to do in the short term.
Swift SVN r1713
2012-05-02 05:44:58 +00:00
Chris Lattner
8c478d1cb7
remove the foreach keyword, switching foreach loops to use 'for' instead.
...
This uses one-token lookahead to distinguish between the two forms.
Swift SVN r1710
2012-05-02 01:06:06 +00:00
Chris Lattner
e205e1d2da
change the subset of for statements we support: instead of *requiring* parens,
...
now we *do not allow* them. This is progress towards unifying for and foreach.
Swift SVN r1709
2012-05-02 00:43:24 +00:00
Eli Friedman
a684be9af7
Per John's comments on r1696, use IGM.getPointerSize(), and add a bit to CapturingExpr for whether the function is captured.
...
Swift SVN r1700
2012-05-01 02:43:12 +00:00
Eli Friedman
48c1cbbe6b
Make the type of VarDecls match the declared type of the variable/parameter/etc. <rdar://problem/11125010>.
...
Swift SVN r1680
2012-04-28 01:26:19 +00:00
Eli Friedman
1bfefd363a
A couple trivial fixes: fix wording in a diagnostic, add a missing newline.
...
Swift SVN r1679
2012-04-27 23:43:59 +00:00
Eli Friedman
f41253e299
Add a couple of missing semantic checks for default values in tuples. Add a bit more clarifying wording to LangRef.
...
Swift SVN r1678
2012-04-27 23:40:43 +00:00
Chris Lattner
615ca4a360
implement the rest of character literal support, and enhance Char to be character literal
...
compatible. This wraps up rdar://11305635, though some cleanup of the testsuite can now be done.
Swift SVN r1672
2012-04-27 06:18:30 +00:00
Chris Lattner
c7e68a4a8b
langref and lexer support for character literals.
...
Swift SVN r1671
2012-04-27 05:51:30 +00:00
Doug Gregor
86cf79a746
Add a range subscript operation for SliceInt64 that produces a slice, e.g.,
...
a[5..9]
will return a 4-element slice of the array a. Addresses
<rdar://problem/11329415>.
Swift SVN r1665
2012-04-27 00:07:52 +00:00
Chris Lattner
20663a8aff
introduce a new abstract LiteralExpr base class shared among the literals,
...
simplifying some code that previously enumerated all of them.
Swift SVN r1664
2012-04-26 23:04:24 +00:00
John McCall
5e31e0df7f
When parsing a multi-dimensional array declarator in an expr-new,
...
update the element type with the computed type.
Swift SVN r1652
2012-04-26 08:07:31 +00:00
Eli Friedman
e33b1aac24
Don't try to synthesize an expression for a return statement which doesn't have one. <rdar://problem/11315114>.
...
Swift SVN r1639
2012-04-25 22:58:06 +00:00
Eli Friedman
81776635c5
Add an asmname attribute which overrides the default mangling for a swift function. This is a complete hack, and we intend to remove it (along with function declarations which don't include a definition) once we can properly import C modules. <rdar://problem/11306201>.
...
Swift SVN r1617
2012-04-25 01:53:38 +00:00
Eli Friedman
c055f6293f
Initial implementation of global redeclaration checking. <rdar://problem/11294839>.
...
Swift SVN r1613
2012-04-24 23:10:03 +00:00
Doug Gregor
a04776044e
Teach the import mechanism that it's rude to parse the same library
...
multiple times, as well as teaching the name lookup mechanism that
it's similarly rude to report ambiguous results because it searched
the same import twice. Fixes <rdar://problem/11287213>.
Yes, this is a bit of an ugly hack.
Swift SVN r1610
2012-04-24 22:36:17 +00:00
Doug Gregor
27483ce4e1
s/empty/isEmpty/g for the foreach loop informal protocol, because
...
function names should start with verbs.
Swift SVN r1607
2012-04-24 21:50:12 +00:00
Doug Gregor
e1b8daa717
Rework 'foreach' AST to reflect how IRgen actually wants it to look,
...
rather than how I felt like generating it.
Swift SVN r1599
2012-04-24 20:42:17 +00:00
Doug Gregor
ac188c7d59
Implement type checking for the foreach loop and extend the AST to
...
hold all of the various expressions and declarations we'll need to
understand its semantics.
Swift SVN r1596
2012-04-24 20:22:36 +00:00
Doug Gregor
f997a781bf
Parsing and basic AST representation for 'foreach' statement.
...
Swift SVN r1594
2012-04-24 18:12:44 +00:00
John McCall
c7b7c085bd
Following IR gen's motivated lead, split Builtin.store
...
into Builtin.assign and Builtin.init operations.
Swift SVN r1593
2012-04-24 09:51:05 +00:00
John McCall
becacee265
MemberRefExpr can only refer to a VarDecl for now.
...
Swift SVN r1588
2012-04-24 08:16:46 +00:00
Chris Lattner
ed4bf70eb7
Fix the source range for DotSyntaxCallExpr when it is modeling an implicit this, repairing an ASTVerifier abort
...
Swift SVN r1550
2012-04-21 22:24:14 +00:00
Chris Lattner
6e7d1071d6
lshr is a useful builtin to have, just not useful for signed shift right :)
...
Swift SVN r1540
2012-04-21 05:28:04 +00:00
Doug Gregor
0bdca7425f
s/lshr/ashr/g in builtins.
...
Swift SVN r1537
2012-04-20 19:46:29 +00:00
Doug Gregor
b237823246
Implement load and store builtins, which we use to provide get() and
...
set() functions for UnsafePointerInt.
Swift SVN r1533
2012-04-20 17:58:23 +00:00
Doug Gregor
e26d552a36
Implement integer shift-left/shift-right in the Swift standard library.
...
Swift SVN r1531
2012-04-20 16:33:38 +00:00
Doug Gregor
b0616a72bb
Clean up the AST for subscript expressions in a few ways:
...
- Ensure that the base is always an lvalue, materializing it if necessary
- Give appropriate lvalue qualifiers to the subscript expression
- Make sure to write the converted indices back into the AST
Finally, introduce a verifier for subscript expressions.
Swift SVN r1528
2012-04-20 15:33:46 +00:00
Eli Friedman
a2c6150c13
Error recovery for the REPL. Seems to be working reasonably well. <rdar://problem/11269380>.
...
Swift SVN r1523
2012-04-20 01:14:39 +00:00
Eli Friedman
be602fcd05
Get rid of the implicit BraceStmt for the TranslationUnit; instead, have the TranslationUnit directly store a list of decls.
...
Swift SVN r1521
2012-04-20 00:17:13 +00:00
Eli Friedman
596f494f51
Add missing getLocStart() implementation for TopLevelCodeDecl.
...
Swift SVN r1520
2012-04-20 00:13:11 +00:00
Doug Gregor
6122a9f5e3
Introduce an overloaded subscript expression type, to cope with cases
...
where overloading based on the indices is insufficient to select an
overload candidate. Implement type coercion for overloaded subscript
expressions, so that the context can help push overload resolution
along.
Swift SVN r1516
2012-04-19 23:43:44 +00:00
Doug Gregor
cd43490fb3
Implement semantic analysis for subscript expressions, using overload
...
resolution to pick the best subscript getter/setter pair. Does not yet
allow type coercion to influence overload resolution.
Swift SVN r1515
2012-04-19 23:01:04 +00:00
Doug Gregor
cd7be4edf1
Add an AST for subscript expressions; no real type checking yet.
...
Swift SVN r1512
2012-04-19 22:07:42 +00:00
Eli Friedman
6a088458e8
Add a big doxygen comment for TopLevelCodeDecl.
...
Swift SVN r1511
2012-04-19 22:07:34 +00:00
Chris Lattner
cbc1eac438
irgen parser and sema support for for statements.
...
Swift SVN r1505
2012-04-19 21:43:46 +00:00
Eli Friedman
d5e7784010
Get rid of isModuleScope bit, since we don't like scattering bits across the AST; as a replacement, introduce TopLevelCodeDecl, which provides a DeclContext for all expressions and statements at the top level. <rdar://problem/11259941>.
...
Swift SVN r1503
2012-04-19 21:22:12 +00:00
John McCall
4c15635046
Finish type-checking for new[] expressions.
...
Swift SVN r1502
2012-04-19 21:05:43 +00:00
John McCall
66318f5e12
First round of type-checking for new-expressions: form
...
the appropriate slice type and check the bounds. The
first bound must be a literal or a type with a
getArrayBoundValue method, which has the same recursive
nature as getLogicValue (i.e. it can return a type that
has a getArrayBoundValue that returns an integral type,
but that's it; it's capped at one hop). The rest
of the bounds must be empty (meaning a slice) or
constant under the same conditions as fixed-size
array types.
Swift SVN r1501
2012-04-19 21:05:37 +00:00
Doug Gregor
8ff3075ce4
Teach getter/setter functions about their corresponding subscript
...
declaration, so they can mangle themselves appropriately.
Swift SVN r1499
2012-04-19 20:56:22 +00:00
Doug Gregor
846aa7e162
Diagnose attempts to declare subscript operations outside of a type context.
...
Swift SVN r1497
2012-04-19 20:41:42 +00:00
Doug Gregor
06881faea2
Introduce an AST node for subscript declarations, and verify that the bodies of the getter and setter are being type-checked.
...
Swift SVN r1496
2012-04-19 20:29:48 +00:00