Commit Graph

2325 Commits

Author SHA1 Message Date
Alexander Udalov 9a041136f2 Make ClassId's relative class name FqName instead of FqNameUnsafe
It was FqNameUnsafe in times when there were classes without identifier names,
specifically class objects with names like '<class-object-for-...>'
2015-03-23 16:30:25 +03:00
Denis Zharkov eefea26d54 Recovery for initializer if no LBRACE
- If no LBRACE after 'init' keyword parse initializer without body
- Made getBody() nullable, appropriate checks added
2015-03-18 19:59:25 +03:00
Michael Bogdanov ed62e4972f Temporary disable smap generation 2015-03-18 19:00:24 +03:00
Michael Bogdanov 6e55ea6480 Skip smap generation if there is no source information
#KT-7022 Fixed
2015-03-18 18:49:18 +03:00
Denis Zharkov c6290efbe2 Fix origin of secondary constructors 2015-03-18 10:56:28 +03:00
Michael Bogdanov d765d899a7 Fix NPE with origin calculation 2015-03-18 09:22:56 +03:00
Pavel V. Talanov 06916d98c6 default -> companion: replace all mentions of default and default object 2015-03-17 15:47:39 +03:00
Pavel V. Talanov 2a6facaef6 default -> companion: default object -> class object in project code, builtins and libs code 2015-03-17 15:46:48 +03:00
Alexander Udalov 094fa2f92b Report error on using reflection without kotlin-reflect.jar in classpath
Should be a warning because strictly speaking, the codegen doesn't need it
during the compilation. It's an error at the moment only to let all clients of
Kotlin reflection know that they must include kotlin-reflect.jar in the
classpath
2015-03-16 20:40:49 +03:00
Michael Bogdanov 7d743f56ce Rollback default object to class one 2015-03-16 18:52:05 +03:00
Michael Bogdanov 90651e4b28 Do nothing if there is no smap data on anonymous object transfromation during fun inline 2015-03-16 18:52:05 +03:00
Michael Bogdanov 596c5b8d41 Remove lineNumber assertion: it performed in getOrCreateSourceMapper 2015-03-16 18:52:04 +03:00
Michael Bogdanov ac8e98572e Clean code 2015-03-16 18:52:04 +03:00
Michael Bogdanov 57cf4ac6c0 New test framework 2015-03-16 18:52:04 +03:00
Michael Bogdanov 50c9c93f37 Generate additional NOP in inline call to keep linenumbers 2015-03-16 18:52:03 +03:00
Michael Bogdanov bc2261ea3b Added message for assertion 2015-03-16 18:52:02 +03:00
Michael Bogdanov d5f19eaee4 Fix InsStream 2015-03-16 18:52:01 +03:00
Michael Bogdanov a4117360a2 Smap refactorings 2015-03-16 18:52:01 +03:00
Michael Bogdanov 52999afc4a FqName to ClassId 2015-03-16 18:52:00 +03:00
Michael Bogdanov a7183f6e53 Source mapping generation on code compilation 2015-03-16 18:52:00 +03:00
Michael Bogdanov 99aa57b432 Visit debug info for compiled inline functions 2015-03-16 18:52:00 +03:00
Pavel V. Talanov 188ada2089 Minor: extract ClassDescriptor.secondaryConstructors extension property 2015-03-13 20:17:01 +03:00
Yan Zhulanow 7b39cf4998 Support cache cleanup in android-compiler-plugin 2015-03-13 15:46:43 +03:00
Yan Zhulanow 93ce3bc2ad Pass GenerationState to generateClassSyntheticParts as it's more useful 2015-03-13 15:46:42 +03:00
Alexander Udalov 8af6ca5279 Delete kotlin.jvm.internal.KObject
It was supposed to be used in reflection but the benefits do not outweigh the
cost of KT-6951

 #KT-3223 Fixed
 #KT-6951 Fixed
2015-03-12 23:15:38 +03:00
Stanislav Erokhin 6fb8af1dda Move util backend function isNamedFun && isNamedFunOrLambda to frontend 2015-03-12 17:11:47 +03:00
Stanislav Erokhin fa9ca54e78 Fixed local return inside function expression. 2015-03-12 17:11:47 +03:00
Stanislav Erokhin a89b48c577 Backend support for function expression 2015-03-12 17:11:46 +03:00
Denis Zharkov 582755e71a Don't generate empty constructor if there is secondary one with empty parameter list 2015-03-11 17:45:29 +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 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 cb881d2628 Drop some ClassDescriptor.getConstructors() usages
supposing that there is only primary constructor
2015-03-11 17:45:22 +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
Pavel V. Talanov 9ecf95532e Replace 'class object' with default object in project code 2015-03-10 18:07:46 +03:00
Alexander Udalov 0bd5264b5e Get rid of module reflection.stub.jvm
Generate K*Function as a supertype for a function reference instead of
K*FunctionImpl; this will allow one binary library to be used with or without
reflection
2015-03-07 02:31:26 +03:00
Evgeny Gerashchenko e267f0d4ef Safer check for optimized for loops. 2015-03-06 15:09:28 +03:00
Evgeny Gerashchenko 14b16ff87c KT-6916 Slow bytecode for downTo iteration like for (i in max downTo min)
#KT-6916 fixed
2015-03-06 13:43:02 +03:00
Pavel V. Talanov b73d7e19b7 Remove various getDefaultObject() methods 2015-03-06 12:41:46 +03:00
Dmitry Jemerov c029fa2ed0 add test for generating annotations on the setter of a delegated property; (KT-4169); properly generate backing field for delegated property with a setter 2015-03-05 19:04:18 +03:00
Evgeny Gerashchenko 8ab94a18ae Inlined trivial method classDescriptorToDeclaration 2015-03-05 15:19:30 +03:00
Evgeny Gerashchenko 7b6f83815c Unified obtaining psi element for descriptor. Now code for finding effective descriptors of fake override and finding source element for original declarations are separated. Old method DescriptorToSourceUtils.descriptorToDeclaration is still there, because it has ~90 usages. 2015-03-05 15:19:29 +03:00
Dmitry Jemerov 48b0afd84d correctly generate safe casts from Unit type
#KT-4494 fixed
2015-03-05 11:59:23 +01:00
Dmitry Jemerov 2835459920 correctly generate 'in' expressions with IntRange on RHS and a type other than Int on LHS 2015-03-05 11:33:24 +01:00
Dmitry Jemerov 1188be9070 generate correct bytecode for constructors using infix call syntax
#KT-4589 Fixed
2015-03-05 11:26:27 +01:00
Pavel V. Talanov 350864b22f Drop some of explicit ClassKind.CLASS_OBJECT and OBJECT usages 2015-03-05 13:05:56 +03:00
Pavel V. Talanov fc6f4208ec Rename: isObject -> isNonDefaultObject 2015-03-05 13:05:45 +03:00
Nikolay Krasko 1f79e0905f Intrinsic default objects implementation 2015-03-05 01:30:37 +03:00