Commit Graph

1547 Commits

Author SHA1 Message Date
Pavel V. Talanov 73dd8a051a Remove useless InjectorForJvmCodegen 2014-02-14 16:47:18 +04:00
Alexander Udalov 0b08d03bd6 Minor refactorings in codegen contexts
Add assertions, nullability annotations, fix formatting, etc.
2014-02-12 19:32:59 +04:00
Alexander Udalov 35c7c4afd8 Fix capturing outer this in some cases in JVM codegen
When property initializer of some inner entity (e.g. anonymous object) contains
a reference to some outer entity (say, a property of the outer class), we need
to make sure we called "lookupInContext" on this entity's owner class, so that
"setCaptureThis" was called on the appropriate closure

 #KT-4176 Fixed
2014-02-12 19:17:55 +04:00
Svetlana Isakova 9d493b6f7b generate CHECK_CAST for smartcasted 'this' 2014-02-12 12:48:11 +04:00
Svetlana Isakova 9ed57a5767 removed AutoCastReceiver
check subtype for receiver by AutoCastUtils.isSubTypeByAutoCast directly
 #KT-4403 Fixed
 #KT-4415 Fixed
2014-02-12 12:48:10 +04:00
Pavel V. Talanov cd6a71ef81 Refactor JDR: add explicit binding between java classes and packages for their statics
Get rid of Kind in JavaPackageFragmentDescriptor and create subclass which exposes additional function
Add method in JavaClassDescriptor to get correponding package fragment
Remove JavaDescriptorResolver from context
2014-02-11 17:17:04 +04:00
Andrey Breslav 9229062926 Do not annotate bare type parameters as @Nullable
This is to account for the case of, say

     class Function<R> { fun invoke(): R }

it would be a shame to put @Nullable on the return type of the function, and force all callers to check for null,
so we put no annotations
2014-02-07 16:41:12 -08:00
Mikhael Bogdanov e0ca1abe4b KT-3706 Inconsistent stack height in try catch finally in function
KT-4134 Incorrect bytecode is generated for

 #KT-3706 Fixed
 #KT-4134 Fixed
2014-02-07 13:45:22 +04:00
Andrey Breslav e60bd514fa StorageManager&ExceptionTracker delivered where needed
- GlobalContext introduced to group the two
- Caches track exceptions
2014-02-04 15:24:27 +04:00
Evgeny Gerashchenko 284124569d Fixed super signature generation when JetObject is explicit.
#KT-4485 fixed
2014-02-03 17:53:07 +04:00
Alexander Udalov 75ab8ac5ec Don't try to generate optimized "in" for LongRange
#KT-4097 Fixed
2014-01-31 16:46:14 +04:00
Alexander Udalov 9b01f01e17 Refactor codegen of "in" expression
Use generateIn() twice, for binary expressions and for when clauses
2014-01-31 16:46:14 +04:00
Nikolay Krasko 1832973491 Assertion messages added 2014-01-31 14:52:15 +04:00
Nikolay Krasko 9a6ac60a5f Minor: formatting and warnings 2014-01-31 14:52:14 +04:00
Nikolay Krasko 7546a6dc41 Suppressing warnings + update copyright date 2014-01-31 14:52:13 +04:00
Evgeny Gerashchenko abf352cebd KT-4485 getGenericInterfaces vs getInterfaces for kotlin classes
#KT-4485 fixed
2014-01-29 17:57:50 +04:00
Natalia Ukhorskaya e6e64c0098 Rename class 2014-01-28 18:21:48 +04:00
Natalia Ukhorskaya 694db27da0 Make IntegerValueTypeConstant implements CompileTimeValue<Number>. getValue() method for it is now deprecated - getValue(expectedType) should be used 2014-01-28 18:21:38 +04:00
Alexey Sedunov 5f69317f1e Generate constructor light methods with origin set to Kotlin class/object declaration 2014-01-24 15:24:33 +04:00
Andrey Breslav 4ab0b00bd3 Support [throws] annotation 2014-01-23 17:59:18 +04:00
Andrey Breslav b66a76e7d2 xxx$default() function should be visible from Java 2014-01-23 17:59:17 +04:00
Andrey Breslav 39234b4d3e Delegated members should not be synthetic
Otherwise they are invisible to Java code
2014-01-23 17:59:17 +04:00
Evgeny Gerashchenko d3570153ef Fixed mapping generic type with multiple bounds from Java to Kotlin.
#KT-3480 fixed
2014-01-23 12:33:58 +04:00
Alexander Udalov 09e772ff61 Make comparison with NaN consistent with javac 2014-01-22 21:20:09 +04:00
Andrey Breslav 04b47439bd Use findAnnotation() instead of iterating through all annotations 2014-01-22 19:04:43 +04:00
Andrey Breslav 2ac0853225 Make room for laziness in the Annotations interface 2014-01-22 19:04:42 +04:00
Evgeny Gerashchenko 357fc55358 KT-4456 Generated wrong bytecode when Kotlin class inherited from Java Interface with method which have SAM type argument
#KT-4456 fixed
2014-01-22 16:09:03 +04:00
Andrey Breslav 6ce0b9b919 Annotations used instead of List<AnnotationDescriptor> 2014-01-20 16:17:54 +04:00
Nikolay Krasko db57a7f085 Minor: remove outdated todo comments 2014-01-17 17:28:05 +04:00
Nikolay Krasko 15c5a58b3a Add assert messages 2014-01-17 17:28:03 +04:00
Evgeny Gerashchenko b41a3f8558 Got rid of "namespace" word in compiler code. 2014-01-14 18:06:50 +04:00
Evgeny Gerashchenko 25c65173f2 More exact return type. 2014-01-14 18:06:48 +04:00
Evgeny Gerashchenko 4239f5bb18 Got rid of "namespace" word in backend. 2014-01-14 18:06:47 +04:00
Evgeny Gerashchenko db13cc6ec2 OwnerKind.NAMESPACE → OwnerKind.PACKAGE 2014-01-14 18:06:47 +04:00
Alexander Udalov 7041a10ecf Fix VerifyError on primitive override properties
Don't just blindly map property type in PropertyCodegen when generating getter:
we already have its full signature, so we can just as well take the type from
it. The former also isn't correct for properties which are overrides with a
primitive type. Simple mapType is safe for setter though, because the type of a
method parameter cannot change with override on JVM

The change in StackValue relates to call sites of properties which return Unit:
in that case StackValue's this.type is V, whereas the return type of its getter
is Ljet/Unit; -- so coerceTo was coercing from the wrong type in case of getter
calls

 #KT-4373 Fixed
 #KT-4383 Fixed
2014-01-14 17:52:27 +04:00
Alexander Udalov b92e121458 Minor inlines and renames in PropertyCodegen 2014-01-14 17:43:32 +04:00
Alexander Udalov 0a552dbb04 Delete outdated hack 2013-12-30 06:41:13 +04:00
Alexander Udalov 713c6f13ae Fix primitive override problem in Kotlin-Java inheritance
See the comment in JetTypeMapper
2013-12-30 06:41:09 +04:00
Alexander Udalov 2ea62bde23 Add equals/hashCode/toString for JVM signatures 2013-12-30 04:15:30 +04:00
Alexander Udalov 603c207a9c Minor inline in BothSignatureWriter + toString() 2013-12-30 04:15:29 +04:00
Alexander Udalov 6a6d7bd236 Refactor JvmMethodSignature
Rename kotlinParameterTypes -> valueParameters. Inline some other methods
2013-12-30 04:15:28 +04:00
Alexander Udalov d73b2057e3 Refactor CallableMethod, add convenient methods
It no longer exposes its JvmMethodSignature
2013-12-30 04:15:27 +04:00
Alexander Udalov 28d2306aa1 Add a convenient method JvmMethodSignature.getReturnType() 2013-12-30 04:15:26 +04:00
Alexander Udalov fe96e64bd4 Minor refactoring in JetTypeMapper.mapReturnType 2013-12-30 04:15:25 +04:00
Alexander Udalov d8c5b0236d Fix incorrect usage of mapReturnType in param assertions 2013-12-30 04:15:24 +04:00
Alexander Udalov 2553cd1907 Refactor JetTypeMapper.mapToCallableMethod parameters
Pass CodegenContext instead of two parameters that are always calculated by it
and instead of the other one which is always OwnerKind.IMPLEMENTATION (except a
single case where it was context.kind, but that case doesn't seem to matter)
2013-12-30 04:15:23 +04:00
Alexander Udalov 49a4abbc9e Minor renames and refactorings related to JetTypeMapper 2013-12-30 04:15:22 +04:00
Alexander Udalov ace326f4cf Remove JetTypeMapper.map{G,S}etterSignature
Merge their logic with mapSignature()
2013-12-30 04:15:21 +04:00
Alexander Udalov e531bebe06 Remove JetTypeMapper.mapConstructorSignature()
Move its code to mapSignature with the idea of a future unification of all
signature mapping
2013-12-30 04:15:20 +04:00
Alexander Udalov fec3030142 Delete different mapSignature() overloads
JetTypeMapper now is fully aware of the name it should choose for the mapped
method. The only exception is SAM conversion in ClosureCodegen, where the name
must be replaced
2013-12-30 04:15:19 +04:00