Denis Zharkov
d760a2ec3b
Add CallChecker prohibiting non-local suspension calls
...
Effectively suspension point is local <=> return to relevant lambda is allowed in place
2016-06-08 18:53:16 +03:00
Denis Zharkov
b1189eff23
Make suspension calls generation more stable
...
Instead of performing signature change during transformation
it's convinient to make just when generating corresponding call,
for example there is no need to think about default parameters as they just work as is
See comment above replaceSuspensionFunctionViewWithRealDescriptor for clarification
2016-06-08 18:53:16 +03:00
Denis Zharkov
84ae28992e
Minor. Drop unused class
2016-06-08 18:53:16 +03:00
Denis Zharkov
611490e080
Support non-local returns to coroutine label from inline lambda
...
- Use proper class descriptor when retreiving continuation object (see previous commit)
- Use return type as VOID for such cases
- Load correct labels related to coroutine lambda from outer context
2016-06-08 18:53:16 +03:00
Denis Zharkov
94bd6dcc82
Use proper coroutine class descriptor for extension receiver generation
...
Before this commit context.getThisDescriptor() has been used, that was quite correct
until suspension happens inside inlined lambda (it has different this-descriptor)
2016-06-08 18:53:16 +03:00
Denis Zharkov
75e112e752
Implement basic support for coroutines in JVM backend
2016-06-08 18:53:16 +03:00
Denis Zharkov
077fc528d1
Minor. Change CompilationException parameter to @Nullable
...
A lot of call sites actally pass null as an element,
so it's better to fail with original stack-trace instead of NPE
caused by nullability check
2016-06-08 18:53:16 +03:00
Denis Zharkov
20d1d12f3b
Revert "'yield' reserved as a keyword"
...
This reverts commit 434082cadb .
2016-06-08 18:53:16 +03:00
Denis Zharkov
5c1e17c8e7
Revert "Completion fix for reserved 'async' syntax"
...
This reverts commit 318f0c89b2 .
2016-06-08 18:53:16 +03:00
Denis Zharkov
3ede8f97e6
Revert "Quick fix for deprecated async syntax"
...
This reverts commit afc1e24571 .
2016-06-08 18:53:16 +03:00
Denis Zharkov
1af9321c20
Revert "'async' reserved in front of function literals"
...
This reverts commit 6155d836a5 .
2016-06-08 18:53:16 +03:00
Denis Zharkov
7d3333e86e
Revert "Reserve "async* {}", extend the quick-fix"
...
This reverts commit a7e7d53e2b .
2016-06-08 18:53:16 +03:00
Denis Zharkov
bf3e6247aa
Minor. Extract TransformationMethodVisitor with abstract performTransformations(@NotNull MethodNode methodNode)
2016-06-08 18:53:16 +03:00
Denis Zharkov
b1ec0dda45
Resolve all return expressions in coroutine as fake calls to 'handleResult'
2016-06-08 18:53:16 +03:00
Denis Zharkov
372791eb15
Replace common extension receiver of coroutine-lambda with magic one
...
Currently it only contains additional synthetic declarations for suspend-functions
E.g. `fun <V> await(f: CompletableFuture<V>): V` for `fun <V> await(f: CompletableFuture<V>, machine: Continuation<V>): Unit`
2016-06-08 18:53:16 +03:00
Denis Zharkov
8f4ee0528e
Implement operator checks for controller's handleResult
2016-06-08 18:53:16 +03:00
Denis Zharkov
fcbff72f6f
Replace expected type for coroutine-lambda
...
Use 'handleResult' method of controller to determine what lambda should return
If original declaration was
fun builder(coroutine c: Controller.() -> Continuation<Unit>) = 1
and there is 'fun handleResult(x: X, c: Continuation<Nothing>)',
then expected type for lambda is 'Controller.() -> X'
2016-06-08 18:53:16 +03:00
Denis Zharkov
e97376bb2c
Introduce coroutine-related API into built-ins
2016-06-08 18:53:16 +03:00
Denis Zharkov
1a93c276f6
Minor. Apply 'Simplify if'
2016-06-08 18:53:16 +03:00
Denis Zharkov
88637ba336
Minor. Cleanup codegen.optimization package
2016-06-08 18:53:16 +03:00
Denis Zharkov
329fb9d619
Introduce 'coroutine'/'suspend' modifiers
2016-06-08 18:53:16 +03:00
Denis Zharkov
38d74a16fe
Change FlagsToModifiers from enum to abstract
...
Add 2 non-trivial implementations and one for boolean flags
2016-06-08 18:53:16 +03:00
Denis Zharkov
f434801bf6
Minor. Drop 'CodegenBased.callableDescriptor' field and relevant generic parameter
...
It was redundant for most of subclasses
2016-06-08 18:53:16 +03:00
Alexey Sedunov
158037dd68
Create Test Intention: Fix RuntimeException on attempt to convert generated test class to Kotlin
...
#KT-12285 Fixed
#EA-82281 Fixed
2016-06-08 17:50:21 +03:00
Pavel V. Talanov
32c5ccdaad
plugin.xml: Add dependency on java module
...
This restricts usage of plugin to IDEA and Android Studio
2016-06-08 17:45:32 +03:00
Dmitry Petrov
9c74f27967
Type alias can't expand to 'dynamic'
2016-06-08 15:55:52 +03:00
Dmitry Petrov
ef4c3bdae8
Don't expand types that don't contain type aliases or type parameters.
2016-06-08 15:55:52 +03:00
Dmitry Petrov
cf8cbad11c
Refactor: extract TypeAliasExpander as a separate class.
2016-06-08 15:55:52 +03:00
Dmitry Petrov
cb08d976d3
Tests for importing type aliases
2016-06-08 15:55:52 +03:00
Mikhail Glukhikh
4b6b35dadf
Type parameter is considered capable of taking any value for the purpose of cast possibility check #KT-6611 Fixed
2016-06-08 15:25:34 +03:00
Mikhail Glukhikh
99acbf16b2
CastDiagnosticsUtil.kt: converted to Kotlin
2016-06-08 15:25:29 +03:00
Mikhail Glukhikh
f3f7bff376
CastDiagnosticsUtil.java --> CastDiagnosticsUtil.kt
2016-06-08 15:25:25 +03:00
Ilya Chernikov
7153ea61d8
Restore logic of StandardScriptDefinition handling, fixes codegen tests
2016-06-07 21:13:06 +02:00
Ilya Chernikov
e8c13882b4
Make script detection API generic, fix tests
2016-06-07 21:13:05 +02:00
Ilya Chernikov
3393d7b7d2
Optimize script definitions handling
...
Loading script configs only from project root dir
Optimize script definition retrieval in the KtScript
2016-06-07 21:13:04 +02:00
Ilya Chernikov
656fcc9775
Refactor and fixes after review
...
improving script constructor search algorithm - now default params should be supported
remove prefix Customized- from scripts ModuleInfo-related classes
refactoring ideaModuleInfos after review
refactoring ResolveSessionProvider construction for readability
refactoring KotlinScriptConfigurationManager after review
fixing KotlinScriptDefinitionProvider after review
2016-06-07 21:13:04 +02:00
Pavel V. Talanov
d5b486eb80
Refactor LazyClassDescriptor and minor changes
...
Minor: get script definition once
Refactor: get rid of 'LazyClassDescriptor#getInjectedSupertypes'
Minor: rename scope
2016-06-07 21:13:03 +02:00
Ilya Chernikov
4d95e873a9
Add a guard for empty dependencies list, fixes EA-82348
2016-06-07 21:13:02 +02:00
Pavel V. Talanov
8e700cdb10
Do not limit scope when searching in index by default
2016-06-07 21:13:01 +02:00
Ilya Chernikov
478ae96e50
Implement a compiler config key to add preconfigured extra imports for scripts
2016-06-07 21:13:01 +02:00
Ilya Chernikov
956bcf6d7a
Fix permgen problems with script launching by avoiding reflection as much as possible
2016-06-07 21:13:00 +02:00
Ilya Chernikov
b9ea9513b1
Rewrite handing and caching of script configurations
...
The refactoring could enable lazy update of the index on script loading, but seems that makeRootsChange
call doesn't work as expected, therefore initial project scan is performed in the KotlinScriptConfigurationManager
anyway
2016-06-07 21:12:59 +02:00
Ilya Chernikov
3e6616de42
Read script config if appropriate flag is specified, fix classpath handling
2016-06-07 21:12:58 +02:00
Ilya Chernikov
abfda50077
Workaround URISyntaxException in tests on windows + JDK 6
2016-06-07 21:12:58 +02:00
Ilya Chernikov
0d7ecee6ee
Update index on definition/import files changes
2016-06-07 21:12:57 +02:00
Ilya Chernikov
1a98c5eb0e
Allow script dependnencies to be found as a candidates for decompilation
2016-06-07 21:12:56 +02:00
Ilya Chernikov
9ed8dec9fb
Make a marker interface to allow ScriptDependenciesClassFilter to be used in the resolving
2016-06-07 21:12:55 +02:00
Ilya Chernikov
5c37017484
Prepare infrastruct for fixing customized script resolving
...
Move ConfigManager and ClassFinder to the idea-analysis
Add (back) IndexableSetContributor
Add a method in ConfigManager to generate all dependencies scope
Add and use delegating scope with possibility to get base scope from it (used in the class finder)
2016-06-07 21:12:54 +02:00
Ilya Chernikov
3e17724e58
Implement class finder for customized scripts resolving - not yet completely functional
2016-06-07 21:12:54 +02:00
Ilya Chernikov
b63ed0f4aa
Make script launcher aware of custom scripts, minor correction is core env
2016-06-07 21:12:53 +02:00