Commit Graph

20863 Commits

Author SHA1 Message Date
Denis Zharkov 9d2d3c0c7b Take data flow info from delegation call 2015-03-11 17:45:28 +03:00
Denis Zharkov aa5599f6ca Improve positioning strategy for delegation calls 2015-03-11 17:45:28 +03:00
Denis Zharkov 4022982760 Add synthetic argument to default constructors
It's need to add synthetic argument (of type that user can't use)
to constructors with default arguments to avoid clashing with
real user's constructor having the same set of parameters
and additional int's arguments.
2015-03-11 17:45:28 +03:00
Denis Zharkov 67f97fea42 Prohibit data classes with no primary constructor 2015-03-11 17:45:28 +03:00
Denis Zharkov 40d7816575 Regenerate protobuf classes
After secondary constructors serialization
2015-03-11 17:45:27 +03:00
Denis Zharkov 111a138a2a Serialize secondary constructors 2015-03-11 17:45:27 +03:00
Denis Zharkov e65382e6ec Support secondary constructors in JVM backend
There is a lot of changes about closures calculating and generating.

1. As classes can have more than one constructor each of them should
have closure arguments.

2. Captured variables set is the same for all of them.

3. Within constructors bodies/delegating calls closure parameters
should be accessed through method arguments because fields may be
not initialized yet.
2015-03-11 17:45:27 +03:00
Denis Zharkov 6779e95767 Simplify closure analysis within constructors
Using of ConstructorContext instance almost has no sense,
but it complicates logic when there are several constructors.
2015-03-11 17:45:27 +03:00
Denis Zharkov 31be68de0a Get rid of superCall fields in class/closure codegen
Because their semantics looks wrong in case of secondary constructors.
Use resolved delegation call instead.
2015-03-11 17:45:27 +03:00
Denis Zharkov 4c26d037d9 Resolve property initializer if there is no primary constructor 2015-03-11 17:45:27 +03:00
Denis Zharkov a872a51a19 Prohibit explicit super call for enum ctrs 2015-03-11 17:45:26 +03:00
Denis Zharkov 1703e16913 Add quickfix: remove 'init' modifier 2015-03-11 17:45:26 +03:00
Denis Zharkov f07566d30d Add warning for initializers with obsolete syntax
Expected 'init' keyword before class initializer
2015-03-11 17:45:26 +03:00
Denis Zharkov 0dc155d8c9 Resolve annotations on secondary constructors 2015-03-11 17:45:26 +03:00
Denis Zharkov 9be45af267 Complete this/super before delegation call 2015-03-11 17:45:26 +03:00
Denis Zharkov 50c8c6f68b Basic completion within secondary constructors
body and delegation call
2015-03-11 17:45:26 +03:00
Denis Zharkov 7d963e8e07 Differ this/non-this instances for vars initialization in class
When deal with constructed object (not this) treat it like it's fully initialized.

Otherwise (this or access with no receiver) access instruction
should be handled as it was before.

 #KT-6788 Fixed
 #KT-4126 Fixed
2015-03-11 17:45:25 +03:00
Denis Zharkov 1004e016fd Minor, drop unused method 2015-03-11 17:45:25 +03:00
Denis Zharkov f673f4ff47 Prohibit super delegation call if there is primary constructor 2015-03-11 17:45:25 +03:00
Denis Zharkov 835a0df13a Prohibit secondary constructors in traits 2015-03-11 17:45:25 +03:00
Denis Zharkov 978279bff3 Minor, drop unused method 2015-03-11 17:45:25 +03:00
Denis Zharkov 4a628a3d8f Prohibit supertype initialization without primary constructor 2015-03-11 17:45:25 +03:00
Denis Zharkov 28fbdb7c53 Prohibit constructors declarations for object 2015-03-11 17:45:24 +03:00
Denis Zharkov 3fef4ad742 Minor, drop unneeded accept 2015-03-11 17:45:24 +03:00
Denis Zharkov 525ddf9eb0 Prevent circular secondary constructors delegation 2015-03-11 17:45:24 +03:00
Denis Zharkov 5388bd7cdc Record resolved delegated constructor in trace 2015-03-11 17:45:24 +03:00
Denis Zharkov 7f20c4a237 Control flow changes for secondary constructors 2015-03-11 17:45:24 +03:00
Denis Zharkov 61ae694be4 Allow return statements in secondary constructors 2015-03-11 17:45:24 +03:00
Denis Zharkov 80e13d3f70 Allow class initializer without primary constructor 2015-03-11 17:45:23 +03:00
Denis Zharkov 87193aec2f Minor, drop unused variable 2015-03-11 17:45:23 +03:00
Denis Zharkov 3509cafcea Allow no super class initialization within header
if there is no primary constructor
2015-03-11 17:45:23 +03:00
Denis Zharkov 1555eec954 Secondary constructors delegation calls and body resolve 2015-03-11 17:45:23 +03:00
Denis Zharkov b2cecf1dd0 Secondary constructors resolve 2015-03-11 17:45:23 +03:00
Denis Zharkov 8305d73682 Drop unused interface method
There was the only usage and it's redundant.
JetClass' implementation name is refined.
2015-03-11 17:45:22 +03:00
Denis Zharkov 3ba94d7352 Parsing: secondary constructors 2015-03-11 17:45:22 +03:00
Denis Zharkov cb881d2628 Drop some ClassDescriptor.getConstructors() usages
supposing that there is only primary constructor
2015-03-11 17:45:22 +03:00
Denis Zharkov bdd2756bd1 Rename ThisReference -> ConstructorDelegationReference 2015-03-11 17:45:22 +03:00
Denis Zharkov a55e8911ea Drop parsing of enum initializers using `this'
#KT-6626 Fixed
2015-03-11 17:45:22 +03:00
Andrey Breslav 0dc1448d69 Secondary constructors specs 2015-03-11 17:45:21 +03:00
Dmitry Jemerov d3b8464722 fix test: regenerate Primitives.kt 2015-03-11 15:18:38 +01:00
Alexander Udalov dc4dfbeec1 Fix generic class literals, substitute type parameters with stars 2015-03-11 16:42:47 +03:00
Alexander Udalov 6468515d99 Report error when LHS of class literal is not a class 2015-03-11 16:42:45 +03:00
Alexander Udalov b93b9bd565 Support KClass.simpleName and built-in class literals 2015-03-11 16:42:43 +03:00
Alexander Udalov 6e45c6f17c Support class literals (A::class) 2015-03-11 16:42:41 +03:00
Alexander Udalov 2b089e0f39 Configure kotlin-reflect.jar in IDE as part of KotlinJavaRuntime library 2015-03-11 16:42:39 +03:00
Alexander Udalov b3cdd818f0 Support member extension properties, implement KClass.getExtensionProperties()
#KT-6570 Fixed
2015-03-11 16:42:38 +03:00
Alexander Udalov da209e673c Implement KClass.getProperties()
#KT-6570 In Progress
2015-03-11 16:42:37 +03:00
Alexander Udalov fdfd808d80 Remove KForeignMemberProperty and KClassOrigin, use KMemberPropertyImpl instead 2015-03-11 16:42:36 +03:00
Alexander Udalov ff0044f66a Use descriptors for reflection on extension properties 2015-03-11 16:42:34 +03:00
Alexander Udalov 1a618deeab Use descriptors for reflection on top level properties
This also allows to obtain a Field object from the package part (see
mapping.kt)
2015-03-11 16:42:33 +03:00