Ian Lynagh
8b56302644
Kotlin: Add a concept of 'verbosity'
2022-05-10 19:51:21 +01:00
Ian Lynagh
cffcff93a8
Kotlin: Add a log message
2022-05-10 19:51:21 +01:00
Tamas Vajk
57d4d8e2a8
Code quality improvements
2022-05-10 19:51:21 +01:00
Tamas Vajk
7b2b40cc86
Fix type access extraction of nested generic constructor references
2022-05-10 19:51:21 +01:00
Tamas Vajk
5e1ebb2545
Fix generic constructor reference extraction
2022-05-10 19:51:21 +01:00
Tamas Vajk
b228ac4814
Code quality improvements
2022-05-10 19:51:21 +01:00
Tamas Vajk
91409534e2
Unify parameter order in type access extraction functions
2022-05-10 19:51:21 +01:00
Tamas Vajk
a8f595c50a
Refactor type access extraction
2022-05-10 19:51:21 +01:00
Tamas Vajk
eebfe56c95
Extract more type access expressions
2022-05-10 19:51:21 +01:00
Tamas Vajk
f730aa12b6
Refactor type access extraction for function references and lambdas
2022-05-10 19:51:21 +01:00
Tamas Vajk
a70ade224f
Fix (generic) type access extraction for lambdas
2022-05-10 19:51:21 +01:00
Ian Lynagh
a8c94c500e
Kotlin: Simplify PrimitiveTypeInfo
...
Removes a load of argument-passing
2022-05-10 19:51:20 +01:00
Ian Lynagh
0bf1ff9f2f
Kotlin: Comments and tweaks in Label
2022-05-10 19:51:20 +01:00
Ian Lynagh
2c5dc42db4
Kotlin: Comments and tweaks to TrapWriter.
2022-05-10 19:51:20 +01:00
Ian Lynagh
b1ebcdd524
Kotlin: Add some warnings
2022-05-10 19:51:20 +01:00
Tamas Vajk
4af12e7c9d
Change array.get calls to array indexing in FunctionN.invoke body
2022-05-10 19:51:20 +01:00
Tamas Vajk
4e18974889
Fix type access expression extraction for function/property references
2022-05-10 19:51:20 +01:00
Chris Smowton
13cd145a76
Retain Member.getInitializer for Kotlin programs
...
I opt to identify any syntactic initializer. These are broader in scope than Java's member initializers, which are necessarily context-free, whereas in Kotlin the primary constructor's parameters can be referred to.
2022-05-10 19:51:20 +01:00
Chris Smowton
37543e7a86
Switch to expanding property initializers and init blocks in-place
...
Pros:
* <obinit> no longer emitted: one less function per class
* Parameters to the primary constructor, if any, are no longer referred to out of scope
* Simple primary constructor `val` and `var` declarations work as expected
Cons:
* If there are multiple secondary constructors, no primary constructor and long init blocks, there could be considerable duplicate extraction of those init blocks. Hopefully this case is very rare.
2022-05-10 19:51:20 +01:00
Ian Lynagh
af7d809b8a
Kotlin: Log to a file, not stdout
...
We shouldn't interfere with a build's stdout
2022-05-10 19:51:20 +01:00
Ian Lynagh
a112e9ab5c
Kotlin: Add conditional dumping
2022-05-10 19:51:20 +01:00
Chris Smowton
789fe971e4
Fix locations and enclosing statement/callable for assignments
2022-05-10 19:51:20 +01:00
Ian Lynagh
cc0f5d8700
Kotlin: KotlinExtractorExtension tweaks
...
Added/fixed a load of comments.
Adjusted some function visibilities.
2022-05-10 19:51:20 +01:00
Tamas Vajk
67be6a18de
Fix generic callable bindings inside invoke methods
2022-05-10 19:51:20 +01:00
Tamas Vajk
6742496fe3
Get type arguments for property/function references
2022-05-10 19:51:20 +01:00
Tamas Vajk
18812c810c
Add PropertyRefExpr QL class, change extraction to use it, and add tests
2022-05-10 19:51:19 +01:00
Tamas Vajk
5fea49a3c9
Merge function and property reference extraction logic in helper class
2022-05-10 19:51:19 +01:00
Tamas Vajk
b4b1976bc4
Add get/set method extraction for property references
2022-05-10 19:51:19 +01:00
Tamas Vajk
4ce813a720
Extract anonymous class for property references (class, constructor, call to constructor, optional parameters)
2022-05-10 19:51:19 +01:00
Chris Smowton
f3b92e7549
Explain why there is no syntheticToRealPropertyMap
2022-05-10 19:51:19 +01:00
Chris Smowton
110a2c7b87
Try our best to fix up the truncated class graph exposed by the Kotlin Android extensions plugin
2022-05-10 19:51:19 +01:00
Chris Smowton
5fe65ed983
Extract no-when-branch-found calls
...
These are extracted as "throw new kotlin.NoWhenBranchFoundException();", which is the Java lowering of the intrinsic.
In the process, amend the control-flow graph to let when branches propagate `throw`s outwards, and similarly statement expressions.
2022-05-10 19:51:19 +01:00
Ian Lynagh
f8673d86b5
Kotlin: Don't double-escape TRAP strings
...
The TrapWriter.write* functions are going to escape them for us.
2022-05-10 19:51:19 +01:00
Ian Lynagh
dc7f8a6a5a
Kotlin: Refactor TrapWriter/Logger
...
It's now Tpossible for TrapWriter to log warnings. This required a
little juggling to break the dependency loop between the two classes.
2022-05-10 19:51:18 +01:00
Chris Smowton
7cb6e19e44
Extract array update operations
...
These are of the form arrExpr[indexExpr] op= rhs
2022-05-10 19:51:18 +01:00
Tamas Vajk
ff5bbee75a
Change extracted base type of function references
2022-05-10 19:51:18 +01:00
Tamas Vajk
42803a161c
WIP: add test for reflective calls
2022-05-10 19:51:18 +01:00
Chris Smowton
8af0f26411
Extract simple in-place operators
...
Complex in-place operators (someFieldOrArrayCell += e) get a harder-to-parse lowering which needs to be intercepted at the IrBlock level
2022-05-10 19:51:18 +01:00
Chris Smowton
2fb54de269
Extract ordinary array get and set operations as ArrayAccesses, not calls
2022-05-10 19:51:18 +01:00
Tamas Vajk
387e8db161
Minor code quality improvements
2022-05-10 19:51:18 +01:00
Tamas Vajk
6154c2be18
Change arguments of big arity invoke call
2022-05-10 19:51:18 +01:00
Tamas Vajk
3f2c275e5f
Fix functional interface selection
2022-05-10 19:51:18 +01:00
Tamas Vajk
8ab4335562
Add some error handling
2022-05-10 19:51:17 +01:00
Tamas Vajk
a598c7fc0c
Rework SAM conversion extraction (handle arbitrary expression that's being converted)
2022-05-10 19:51:17 +01:00
Tamas Vajk
34ae00fa62
Extract SAM lambda conversion
2022-05-10 19:51:17 +01:00
Chris Smowton
377a0f91f0
Add missing times operator
2022-05-10 19:51:17 +01:00
Chris Smowton
96f3ea460f
Make varargs extraction more Java-like:
...
* Extract varargs as if they are ordinary positional arguments
* Adapt the QL that distinguishes varargs from ordinary arguments to account for Kotlin's varargs which can occur in the middle of the arg list
* Add a test checking dataflow through varargs which doesn't work yet due to array-get and array-set not being extracted as IndexExprs
* Extract the special case arrayOf(*x) as a clone call, which is (equivalent to) the Java lowering of that operation
2022-05-10 19:51:17 +01:00
Chris Smowton
7368b49b16
Implement Any?.String using java.lang.String.valueOf
...
This is how kotlinc does it, and doesn't involve an unchecked null deref like the existing use of Object.toString.
2022-05-10 19:51:17 +01:00
Tamas Vajk
616f20fa52
Handle more cases of qualified this references
2022-05-10 19:51:17 +01:00
Chris Smowton
7fe260c1a2
Convert type-parameter-out-of-scope warning into consistency query
...
The warning in the extractor is inaccurate due to references to enclosing types' type parameters. A consistency query can check that the type parameter is indeed in scope exploiting broader knowledge of the enclosing types.
2022-05-10 19:51:17 +01:00