Commit Graph

28404 Commits

Author SHA1 Message Date
John McCall
d3f1048644 When type-checking blah.$2, be sure to set 2 as the field index
on the expression.



Swift SVN r873
2011-11-17 09:28:47 +00:00
John McCall
8022ee67cc Fix a bug with folding sequences of left-associative
operators that was caught by Doug's source-range
verifier.  Thanks, Doug!



Swift SVN r870
2011-11-17 05:01:31 +00:00
Doug Gregor
1ed6cdbb09 Fix broken source-range information for expressions of the form "x.y".
Swift SVN r861
2011-11-10 17:25:08 +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
0223f3edf1 Implement Expr::getSourceRange() and introduce proper support for this
function into all of the expression nodes. Re-implement
Expr::getStartLoc() in terms of this function, and add it's brother
Expr::getEndLoc(), removing the specialized implementations.

Clean up the source ranges of implicitly-created tuple expressions in
the process.


Swift SVN r855
2011-11-10 00:25:48 +00:00
Doug Gregor
b1c98e1731 Introduce Lexer::getLocForEndOfToken() to adjust source locations to
the end of the current token, and use it for proper translation from
SourceRange to SMRange when printing diagnostics.



Swift SVN r853
2011-11-09 22:03:30 +00:00
Doug Gregor
dc8d4d7df9 Teach CMake about the various header files in the lib subdirectories, so they show up in the project.
Swift SVN r849
2011-11-09 18:02:12 +00:00
Doug Gregor
7f1ad8111e Make a few more diagnose() methods return InFlightDiagnostic.
Swift SVN r848
2011-11-09 18:01:37 +00:00
Doug Gregor
cd7a21de83 Introduce support for adding source ranges to diagnostics.
We don't yet properly perform the SourceRange -> llvm::SMRange mapping. 

Swift SVN r847
2011-11-09 17:53:30 +00:00
Chris Lattner
9e9f421f1a getAliasType() doesn't need an ASTContext argument anymore.
Swift SVN r816
2011-11-01 18:37:05 +00:00
Chris Lattner
d2ed4c2f3f remove some unneeded ASTContext arguments from subsystem entrypoints
now that it is reachable from TU


Swift SVN r815
2011-11-01 18:33:48 +00:00
Chris Lattner
da564d50d3 A long journey later, implement support for type inference of integer literals instead of
forcing them to int64 all the time.  Now the integer_literal_type in the standard library
is only used to resolve ambiguity in expressions.  Among other amazing things, we now
correctly accept:

  var x8 : int8 = 4

without a cast.

This still isn't doing any bounds checking and isn't checking the inferred type to tell if
it is compatible with integer literals (i.e. has a primitive conversion function from the
LLVM IR type).  Enough for now though.

This is progress towards rdar://10357238.



Swift SVN r814
2011-11-01 06:51:50 +00:00
Chris Lattner
5daed86322 give TypeChecker the current translation unit being scanned, instead of just the ASTContext.
Swift SVN r813
2011-11-01 06:48:35 +00:00
Chris Lattner
2dcaed352b tidy up
Swift SVN r812
2011-11-01 06:47:50 +00:00
Chris Lattner
164ab0ffee move lookupTypeName out to Module::lookupGlobalType and have it look in the current
module as well for consistency.


Swift SVN r811
2011-11-01 06:27:24 +00:00
Chris Lattner
e0a18996cd move lookupGlobalValue into Module, making it accessable to all of sema.
Swift SVN r810
2011-11-01 06:22:44 +00:00
Chris Lattner
5d8d0fd2f6 Have the name binder publish the list of imported modules into the TranslationUnit,
making it a real part of the AST.  Also, rework TUModuleCache to do its computation
when it is constructed, instead of trying in each query.


Swift SVN r809
2011-11-01 06:19:36 +00:00
Chris Lattner
1f42ec4679 rename method for consistency.
Swift SVN r808
2011-11-01 06:01:45 +00:00
Chris Lattner
623de6cefc now that ModuleProvider is gone, we can match against the module name
instead of the access path.  Tracking just the access path in the
imports list greatly simplifies all of the client and means that we
don't have to create a bogus ImportDecl for the builtin module just
to make name lookup work.


Swift SVN r807
2011-11-01 05:40:55 +00:00
Chris Lattner
17fd6242fc now that Module's have their own cache of name lookup info... including the current
module we're working on, eliminate the cloned version of the value lookup code
from NameBinder.


Swift SVN r806
2011-11-01 05:36:57 +00:00
Chris Lattner
69fb3842fc give name binder the translation unit it is binding.
Swift SVN r805
2011-11-01 05:34:18 +00:00
Chris Lattner
dd63b23985 strength reduce.
Swift SVN r804
2011-11-01 05:25:54 +00:00
Chris Lattner
e3b53c3b15 move the module-level name lookup stuff out of NameBinding.cpp into the
Module class.  Add a new Module.cpp file to implement this (along with
the existing caching strategy, if you're curious).  This eliminates the
parallel 'ModuleProvider' heirarchy.


Swift SVN r802
2011-11-01 05:19:35 +00:00
Chris Lattner
4933a27098 clean up lookupType/lookupValue to only take an AccessPath instead of an import decl.
Strip of the module name implicit in the access path.


Swift SVN r801
2011-11-01 04:43:51 +00:00
Chris Lattner
2ea1e72890 merge two copies of the same predicate into a helper method.
Swift SVN r800
2011-11-01 04:30:25 +00:00
Chris Lattner
0ca79b1075 rename ASTContext::BuiltinModule -> TheBuiltinModule for consistency with
the other ASTContext members.


Swift SVN r799
2011-11-01 04:18:23 +00:00
Chris Lattner
8e1c6c8ac6 flatten ModuleKind discriminator into DeclContext's one. Now Module is an
abstract class and we have an actual AST-level concept of the builtin module.


Swift SVN r798
2011-11-01 04:07:57 +00:00
Chris Lattner
db0fd341de inline addBuiltinImport.
Swift SVN r796
2011-11-01 03:47:06 +00:00
Chris Lattner
e6e58d1390 Have NameBinder ctor set up the implicit import for the builtin
module.  Heap allocate it for consistency.


Swift SVN r795
2011-11-01 03:46:01 +00:00
Chris Lattner
75e558af9d rearrange code to group class declaration and implementation together.
Swift SVN r794
2011-11-01 03:32:01 +00:00
Chris Lattner
bf91e00f4c rearrange code, upshot being that "a.b" will resolve if there is only one candidate
for b even if a is dependent.


Swift SVN r793
2011-10-28 00:40:34 +00:00
Chris Lattner
d4b9889b68 remove dead code, unresolved dot expressions always have a base now.
Swift SVN r792
2011-10-28 00:35:45 +00:00
Chris Lattner
cc7ac96baa fix some bugs handling dependent typed values, prepare for integers becoming dependent typed.
Swift SVN r791
2011-10-28 00:33:39 +00:00
Chris Lattner
e78809874f update comments
Swift SVN r787
2011-10-26 23:42:48 +00:00
Chris Lattner
55fa35662c rename TypeChecking -> TypeChecker to match the name of the class.
Swift SVN r786
2011-10-26 23:42:08 +00:00
Chris Lattner
9298082ebb move Diagnostics header to include/swift/AST to match .cpp files.
Swift SVN r782
2011-10-22 00:47:35 +00:00
Chris Lattner
dfd529ce3a rename diags::foo to diag::foo
Swift SVN r779
2011-10-22 00:36:19 +00:00
Chris Lattner
2ac742d7c6 convert the rest of sema to the new diagnostics stuff.
Swift SVN r775
2011-10-22 00:25:35 +00:00
Chris Lattner
0c3b3fe76b use Type and Identifier arguments to diagnostics more uniformly.
Swift SVN r774
2011-10-21 23:32:14 +00:00
Chris Lattner
0c0e65e553 violate diagnostic layering harder, making it fine to cram types into diagnostics.
Lets here it for non-pod's in unions.


Swift SVN r773
2011-10-21 23:25:29 +00:00
Chris Lattner
2f5964abd8 switch TC Coercion over.
Swift SVN r772
2011-10-21 23:19:39 +00:00
Chris Lattner
d36e080d5f switch name binding to the new diagnostics stuffola
Swift SVN r771
2011-10-21 23:00:34 +00:00
Chris Lattner
3c43cae8b4 now that types can get their astcontext, remove some pointless argument passing.
Swift SVN r757
2011-10-18 23:25:42 +00:00
Chris Lattner
3d168c4cdc make sure Type aliases in the builtin module get a declcontext.
Swift SVN r754
2011-10-18 22:01:53 +00:00
Chris Lattner
a7c7d64fa0 Switch swift to use SourceLoc instead of SMLoc.
Also use the new getAdvancedLoc() method instead of hacking
on SMLoc directly.

Also fix the warning/note/error methods to forward through ASTContext
instead of being replicated everywhere.



Swift SVN r750
2011-10-18 01:22:29 +00:00
Chris Lattner
2d43b8812f update for mainline API changes.
Swift SVN r745
2011-10-16 06:17:27 +00:00
John McCall
f121bd5e2d Arbitrary-associativity operator precedence parsing.
Swift SVN r743
2011-09-29 01:31:16 +00:00
John McCall
25ee366396 Add an lvalue-to-rvalue conversion AST node.
Swift SVN r742
2011-09-28 01:12:34 +00:00
John McCall
6b27921ce3 Propagate around l-value-ness. There aren't any interesting invariants
here yet.



Swift SVN r740
2011-09-27 23:46:08 +00:00
John McCall
b6f312aea0 Verification should clearly follow each phase rather than coming
at the start of the next phase.



Swift SVN r731
2011-09-24 09:32:18 +00:00