Commit Graph

444 Commits

Author SHA1 Message Date
John McCall
d699e00390 Teach IR-gen how to efficiently emit a broad range of
expressions when no value is required.  Teach IR-gen
to emit DotSyntaxBaseIgnoredExprs as known function
references with possibly non-trivial semantics.
Undo the change to getSemanticsProvidingExpr().

Swift SVN r1238
2012-03-19 08:59:35 +00:00
John McCall
2fd608ae4d Add basic parsing and type-system support for the byref(heap)
qualifier, making sure that variables end up so-qualified by
default.  Add a RequalifyExpr to capture the act of adding
qualifiers (to form a supertype) to an l-value.

Swift SVN r1236
2012-03-19 06:55:23 +00:00
Chris Lattner
6185ab6d50 move getImplicitThisDecl to FuncDecl where the other 'this' handling stuff goes.
Swift SVN r1233
2012-03-19 05:43:20 +00:00
Chris Lattner
ce717d2c7c teach IRGenFunction::emitIgnored to handle expressions of module and metattype type.
Teach Expr::getSemanticsProvidingExpr to look through DotSyntaxBaseIgnoredExpr.
Start generating DotSyntaxBaseIgnoredExpr for all dot syntax exprs where the base is
ignored (e.g. "Builtin.mul_i32"), which preserves a lot more source location information
and is general goodness for the AST.


Swift SVN r1232
2012-03-19 05:33:29 +00:00
Chris Lattner
0ab662f99b fix -ast-dump of moduleexpr.
Swift SVN r1231
2012-03-19 05:29:59 +00:00
Chris Lattner
4e4c1bf417 rename DotSyntaxPlusFuncUseExpr -> DotSyntaxBaseIgnoredExpr
to properly represent its newly generalized role.  It is formed
for things like "swift.print" where swift is a module type and is
evaluated and ignored.


Swift SVN r1230
2012-03-19 05:23:39 +00:00
Chris Lattner
c32bf343a0 fix inverted logic.
Swift SVN r1205
2012-03-11 23:48:00 +00:00
Chris Lattner
11f3d2bcae implement a method to get the 'this' argument for a FuncExpr if there is one.
Swift SVN r1204
2012-03-11 23:35:48 +00:00
Chris Lattner
3b0db63f85 introduce ImplicitThisTupleElementExpr, progress towards 10682135.
IRGen should really use visitors for expr emission...


Swift SVN r1199
2012-03-11 15:02:16 +00:00
Chris Lattner
fc0c1a74d4 make the printer be precise.
Swift SVN r1196
2012-03-11 14:50:52 +00:00
Chris Lattner
e3f6f4b87a Convert test cases to use the new auto_closure attribute,
inform conversion ranking about auto_closure, and rip out the
CR_AutoClosure implicit conversion.  Our conversion ranking is
now completely trivial: we either have an identity conversion
or an invalid one - no crazy implicit conversions (still have
tuple shuffles etc though).


Swift SVN r1192
2012-03-11 14:08:40 +00:00
Chris Lattner
5f7679ef4d restrict autoclosure to only happening when the destination function type has an
empty tuple as an argument.  This should be restricted even more (rdar://10983400)
but this eliminates the most surprising cases at least.


Swift SVN r1165
2012-03-05 12:06:55 +00:00
Chris Lattner
6aac93155d add an AST node to represent explicit closures. Not yet created.
Swift SVN r1154
2012-03-03 12:12:57 +00:00
Chris Lattner
a4beb5f68b factor some expr printing logic.
Swift SVN r1153
2012-03-03 12:05:23 +00:00
Chris Lattner
3a6e84f82e Add a new "ImplicitClosureExpr" subclass of ClosureExpr to represent the autoclosure case.
Swift SVN r1152
2012-03-03 11:54:43 +00:00
John McCall
00b97b38af Grab-bag of materialization-related changes:
- introduce the concept of qualifiers on l-value types
  - teach overload resolution and coercion how to drop explicitness
  - require explicitness on normal [byref] arguments
  - make 'this' [byref(implicit)]
  - special-case '&' as a unary operator in the parser to make it
    produce an expression which type-checks as turning implicit l-values
    into explicit ones.

Obvious missing pieces:
  - updating LangRef
  - we should really complain about ever trying to rvalue-convert an
    explicit l-value
  - maybe qualification should play a part in overload resolution
  - we should diagnose attempts to declare unary '&' operators
  - there's a test case in expressions.swift which suggests my logic is
    slightly off

But I am out of time, and these will have to wait.

Swift SVN r1119
2012-02-22 06:43:33 +00:00
John McCall
d0f4d86f3e Use LValueType everywhere instead of the l-value value kind.
Kill off TypeJudgement.  Various fixes and improvements.



Swift SVN r1107
2012-02-06 22:47:08 +00:00
John McCall
76ad8fff02 Add more parentheses to Types.h.
Swift SVN r1103
2012-01-31 04:32:37 +00:00
John McCall
e66c13cfe7 Change the 'walk' APIs to use virtual function dispatch
instead .
1,2d
1i
Change the 'walk' APIs to use virtual dispatch instead of
blocks.  This makes it much easier to thread information
through the API, as well to extend the API to handle
recursive visiting of other structures (e.g., Decls
and Patterns).



Swift SVN r1101
2012-01-26 04:31:38 +00:00
John McCall
16f8b2e656 Revise the language design for function argument clause syntax.
A function argument clause is now one or more patterns (which
must be parenthesized and explicitly type all positions) not
separated by arrows;  the first arrow then separates off the
return type.

Revisions to language reference forthcoming.



Swift SVN r1099
2012-01-26 01:25:26 +00:00
Chris Lattner
584ed537fc introduce a new ErrorExpr to represent a subexpression that is semantically
inconsistent (so it needs to be killed) but that we want to retain source
range information and not kill the entire subtree that contains it.


Swift SVN r1073
2012-01-18 07:18:57 +00:00
Chris Lattner
167129d0b0 stop using ValueDecl::getInit
Swift SVN r1070
2012-01-18 07:01:05 +00:00
John McCall
ea5e37e276 Getterize uses of TupleTypeElt. I'm trying to figure out how
parameter attributes should work here.



Swift SVN r1066
2012-01-18 04:05:25 +00:00
Chris Lattner
fab4ef8820 introduce a new OverloadSetRefExpr::createWithCopy method to eliminate
some redundancy in the code that always has to create an overload set
or a single declrefexpr depending on what various lookups produce.


Swift SVN r1044
2012-01-14 07:22:25 +00:00
Chris Lattner
f1db6de509 remove the :: token and DCE UnresolvedScopedIdentifierExpr.
Swift SVN r1043
2012-01-14 07:00:45 +00:00
John McCall
1ec9db43c8 Provide helper methods to look through parentheses. Learning
from Clang, actually give these explicit high-level behavior
rules so that it's clear what should be added to them in the
future.



Swift SVN r1037
2012-01-13 10:07:17 +00:00
Chris Lattner
be666df09e introduce a ModuleExpr node.
Swift SVN r1035
2012-01-13 05:07:21 +00:00
Chris Lattner
be7d7ffe2c print the members of an overloadsetref_expr. We can handle the truth.
Swift SVN r1026
2012-01-12 21:34:58 +00:00
John McCall
59bed696a5 Introduce a ParenExpr to represent the special case of
a tuple with one element and no labels.  This form is
treated specially in essentially every case, so it might
as well be its own expression kind.



Swift SVN r1021
2012-01-12 19:55:06 +00:00
Chris Lattner
4c050c0e52 Fix a nasty type checking bug (exposed by my next patch), where we would lose a
required type conversion in the presence of integer literals and dependent types.


Swift SVN r1016
2012-01-12 07:16:42 +00:00
Chris Lattner
0ed1f417fd also don't crash on an integer literal type if the type is null,
which happens before type checking.


Swift SVN r1013
2012-01-12 06:56:12 +00:00
Chris Lattner
b693da6851 fix -ast-dump to not crash on integer literals with dependent type.
Swift SVN r1012
2012-01-12 06:54:31 +00:00
Chris Lattner
1d38f0d0f4 don't abbreviate the AST in -ast-dump, it is more confusing than useful.
Swift SVN r1011
2012-01-12 06:30:04 +00:00
Chris Lattner
9f5d37dd2f introduce a new ConstructorCallExpr node, which is sugar node used to represent
the syntactic form of an argument list applied to a metatype.  Semantically,
this is yet-another ApplyExpr.


Swift SVN r1008
2012-01-12 05:43:07 +00:00
John McCall
d559794e73 Introduce a new kind of sugar, ParenType. A tuple with one
anonymous member is actually one of these.

A func decl is curried over all of its parameter clauses,
as long as they're written without parentheses.  So the body
of a func is the body of the "most curried" function:
  func foo(x:int) -> (y:int) -> int {
    // This is the body of the function that takes 'y'.
    // It returns an int.
  }
  func bar(x:int) -> ((y:int) -> int) {
    // This is the body of the function that takes 'x'.
    // It returns a functon of type (y:int) -> int.
  }



Swift SVN r993
2012-01-06 04:10:32 +00:00
John McCall
b2569c7786 Provide PrettyStackTraceEntries for Expr* and Stmt* as well,
and type-check functions within the former.



Swift SVN r989
2011-12-23 03:53:23 +00:00
John McCall
5bdea18fc4 Introduce a PrettyStackTraceEntry implementation for
processing declarations and use it in debug builds whenever
the tree walker walks into a Decl.



Swift SVN r984
2011-12-23 01:58:26 +00:00
John McCall
ce9259d2e5 Teach the walker to walk inside ExtensionDecls correctly.
Causes massive crashes because something else apparently
isn't doing this.  Investigating.



Swift SVN r982
2011-12-23 01:19:27 +00:00
Chris Lattner
19b7a934a1 rename BuiltinFloatingPointType to BuiltinFloatType.
Swift SVN r980
2011-12-23 00:07:58 +00:00
Chris Lattner
320e4747cc Codegen was silently truncating IntegerLiteralExpr's to 64 bits, bad codegen!
Swift SVN r979
2011-12-23 00:04:06 +00:00
Chris Lattner
926a3fe671 completely reimplement floating point literals to follow the model of integer literals.
Among other things, this gives us the amazing power to accept "var x : float = 0.0"



Swift SVN r978
2011-12-22 23:50:03 +00:00
Chris Lattner
8ce4737534 implement "a.b" AST and type checker support. Semantics are that 'a' is evaluated and discard. 'b' is evaluated and returned.
Swift SVN r950
2011-12-21 23:49:30 +00:00
Chris Lattner
eef2f69637 improve AST modeling of dot syntax calls to follow the syntactic structure instead of being weird and broken and losing source loc info.
Swift SVN r938
2011-12-15 00:52:58 +00:00
Chris Lattner
2bb9e992e4 fix typo
Swift SVN r926
2011-12-14 20:30:21 +00:00
Chris Lattner
a1b7419a36 remove support for looking up global names with dot syntax. "x.y" != "y(x)" now.
Swift SVN r917
2011-12-07 00:59:09 +00:00
John McCall
d716f82984 Getterize ValueDecl.
Swift SVN r885
2011-11-18 01:04:12 +00:00
John McCall
50fb0d63f6 More incremental getterization.
.w



Swift SVN r883
2011-11-18 00:29:15 +00:00
John McCall
de3c3ff04d Build an implicit expression to record the conversion
of a oneof to its underlying type.  Much better.



Swift SVN r881
2011-11-17 11:38:05 +00:00
Doug Gregor
55f635a0c0 Introduce an additional "context" parameter to the expression and
statement walk callback functions, where we can stash additional
information without breaking all of the callers. 

At present, the only information in the context is the parent
statement or expression.


Swift SVN r860
2011-11-10 17:02:43 +00:00
Doug Gregor
2e49b79617 Rename WalkOrder.h to Walk.h, and introduce typedefs for the function
types of the expression and statement walker into it, so we don't end
up typing the same darned things over and over again.


Swift SVN r859
2011-11-10 16:36:56 +00:00