Commit Graph

276 Commits

Author SHA1 Message Date
Alexander Udalov c0b5fd193a Refactor DeserializedPackageFragment and subclasses
Push loadResource and loadResourceSure down to KotlinJavascriptPackageFragment,
as it's no longer needed in BuiltInsPackageFragment
2016-11-22 18:19:02 +03:00
Alexander Udalov 19520bf29c Extract KotlinMetadataFinder interface out of KotlinClassFinder 2016-11-22 18:19:02 +03:00
Dmitry Petrov 0205a122f4 Treat nested mock type aliases as inner (same as for mock classes). 2016-11-17 14:42:32 +03:00
Dmitry Petrov 718e8ebf9e Inner type aliases.
Type alias is considered "inner" if it captures outer class type parameters (implicitly or explicitly).
2016-11-16 14:11:14 +03:00
Alexander Udalov 0e9f29fdba Make ClassDescriptor#classId nullable
Local classes or anonymous objects do not have a class id. Use "!!" almost
everywhere to make assertion explicit
2016-10-25 15:42:32 +03:00
Alexander Udalov 17e54b6d2d Add ClassDescriptorFactory#getAllContributedClassesIfPossible
Currently a no-op, will be used soon to make Cloneable a synthesized class,
visible in scope's getContributedDescriptors()
2016-10-25 15:42:32 +03:00
Alexander Udalov c0147860bd Allow multiple ClassDescriptorFactory instances in deserialization 2016-10-25 15:42:32 +03:00
Alexander Udalov cdf6567375 Drop TypeConstructor.getAnnotations(), uninherit TypeConstructor from Annotated
The method was unused on TypeConstructor instances, and almost all
implementations returned EMPTY anyway
2016-10-24 15:30:38 +03:00
Dmitry Petrov c41ec1ddfb KT-14400: Properly handle TypeAliasConstructorDescriptor in KotlinTypeMapper.mapToCallableMethod(...)
Implement getDefaultType() in TypeAliasDescriptor subclasses.
2016-10-20 09:56:03 +03:00
Alexander Udalov 8828e671f5 Refactor class lookup in deserialized scopes
Move the logic to DeserializedMemberScope; drop NestedClassDescriptors
2016-10-12 17:07:10 +03:00
Alexander Udalov e1ce6f88d5 Remove extra cache of nested classes from DeserializedClassDescriptor
ClassDescriptor instances are already cached in ClassDeserializer
2016-10-12 17:07:09 +03:00
Alexander Udalov e37a20d6b3 Do not deserialize type aliases in compatibility mode
When "-language-version 1.0" is specified in command line arguments, the
compiler should not be able to see the declarations of type aliases in
libraries, because that corresponds to the behavior of the compiler of version
1.0. Note that type aliases are _completely invisible_ in this mode (i.e.
"unresolved reference" is reported) because they must not interfere with the
classifier resolution
2016-10-12 12:19:19 +03:00
Alexander Udalov d96f10c7bd Refactor deserialization of nested type aliases
Do it exactly in the same way as with properties/functions, in
DeserializedMemberScope and nowhere else
2016-10-12 12:19:18 +03:00
Alexander Udalov 88af36001c Introduce DeserializationConfiguration
Will be used soon to deliver the language/API-version-related behavior to the
deserialization
2016-10-12 12:19:17 +03:00
Dmitry Petrov 796d11c860 ClassDescriptor is now a super-interface for ClassConstructorDescriptor and TypeAliasConstructorDescriptor. 2016-09-20 10:55:36 +03:00
Denis Zharkov a30cb4ead6 Minor. Drop unused getNonDeclaredTypeAliasNames
Also cleanup type aliases related code in DeserializedMemberScope
2016-09-09 10:27:35 +03:00
Denis Zharkov 2fb5b0e248 Simplify allDesciptors computation
Do not split descriptors into declared/non-declared groups

It should not be important as order of non-declared members' appearance
does not affect stub building, deserialization and other order-sensitive
stuff
2016-09-09 10:27:35 +03:00
Denis Zharkov f0ba09ae40 Optimize deserialized scope members computation for non-existing names
Do not use memoized function if member with given name is not contained in the scope

There are a lot of queries with names of non-existent functions, that
leads to many effectively redundant Map nodes in MemoizedFunction and also cause
additional computation that is worth to compute at once

Also drop unused 'location' parameter
2016-09-09 10:27:35 +03:00
Denis Zharkov 8ee5f3de8f Minor. Use ArrayList instead of LinkedHashSet
Looks like there's no duplicates anyway
2016-09-09 10:27:35 +03:00
Denis Zharkov e89c53d49f Minor. Extract common pattern in DeserializedMemberScope 2016-09-09 10:27:35 +03:00
Denis Zharkov f50d0b63f0 Minor. Simplify type aliases computation
computeNonDeclaredTypeAliases is always empty
2016-09-09 10:27:35 +03:00
Denis Zharkov 2251e3b1e9 Minor. Replace explicit lazy calculation call with delegation convention 2016-09-09 10:27:35 +03:00
Denis Zharkov a0a0d9b554 Get rid of DeserializedMemberScope.ProtoKey class
Only 'name' property matters, 'isExtension' is only needed for sorting
when computing all descriptors (can be replaced with additional sort)
2016-09-09 10:27:35 +03:00
Denis Zharkov 6a22d75dd7 Drop TypeAliasDeserializer
Currently it's only used for local type aliases, while code in
'deserializeTypeAlias' works properly only for nested or top-level type
aliases.

Also it seems that serialization of types based on local type aliases
doesn't work now anyway (see KT-13692)
2016-09-05 17:54:36 +03:00
Denis Zharkov 86c1dbe7b5 Fix decompilation of types based on local classifiers
If deserializing a type with arguments based on a local class for
decompiler, then just return Any type (without arguments).

Previously Any constructor was used with serialized arguments, that lead
to exception

Note that in case of deserialization for compiler nothing changes about
local-classes-based types (LocalClassifierResolverImpl is just inlined)

 #KT-13408 Fixed
2016-09-05 17:54:36 +03:00
Dmitry Petrov e0cdad30e4 KT-13181 Unresolved reference when referencing a type alias from a different module
Add corresponding resolution code.
2016-09-02 10:18:23 +03:00
Alexander Udalov 9bf91e95d0 Change default visibility for TypeAlias from 'internal' to 'public'
Since public type aliases will supposedly be more common than internal ones, it
makes sense to save on writing flags for the former rather than the latter
2016-07-05 18:18:45 +03:00
Denis Zharkov d53c53a900 Support annotations on type aliases declarations 2016-06-28 10:33:29 +03:00
Denis Zharkov 067fe35b72 Fix type deserialization failure when type alias was not found
It's crucial for decompilation as declarations are always being deserialized
with no dependencies

 #KT-12832 Fixed
2016-06-28 10:33:29 +03:00
Denis Zharkov 15ce4f8856 Minor. Add comment about type aliases based types metadata format 2016-06-28 10:33:29 +03:00
Denis Zharkov d78177dc23 Refine metadata format for typealias based type 2016-06-28 10:33:29 +03:00
Alexander Udalov 4c8e8b099a Update protobuf from 2.5.0 to 2.6.1 2016-06-27 20:14:00 +03:00
Mikhael Bogdanov db5d9940df Added 'isInline' implementation to property accessor descriptors 2016-06-24 17:05:48 +03:00
Alexander Udalov 7e38b93d80 Use protobuf with renamed packages, pack to IDEA plugin
Update GenerateProtoBuf.kt to also regexp-replace com.google.protobuf with
org.jetbrains.kotlin.protobuf in generated Java sources

 #KT-12581 Fixed
2016-06-14 14:17:22 +03:00
Alexander Udalov 3477f6ee85 Minor, drop java_generic_services option from .proto files
There are no service definitions in our .proto files, so this option had no
effect
2016-06-09 15:54:49 +03:00
Stanislav Erokhin 63b2f89356 Removed laziness from TypeDeserializer, because DeserializedMemberScope has cache for callable descriptors. 2016-06-09 12:58:18 +03:00
Stanislav Erokhin 8c2ad82de7 Minor. fixes after review 2016-06-09 12:58:07 +03:00
Stanislav Erokhin 797ef8d143 Refactoring. Removed all usages of asSimpleType except related to TypeSubstitution. 2016-06-09 12:58:05 +03:00
Stanislav Erokhin f41c8dc045 Refactoring. Removed several usages of asSimpleType 2016-06-09 12:58:00 +03:00
Stanislav Erokhin 1d9ca06b96 Remake KotlinTypes. 2016-06-09 12:57:59 +03:00
Stanislav Erokhin a5c1e009c3 Remove type capability AbbreviatedType. 2016-06-09 12:57:55 +03:00
Stanislav Erokhin 203c4cd94d Remake Raw type representation.
(cherry picked from commit b21cede)
2016-06-09 12:57:53 +03:00
Stanislav Erokhin 669558c4ba Refactoring. Move flexible type factory to deserialization module. 2016-06-09 12:57:48 +03:00
Stanislav Erokhin 957bae18be Refactoring. Move flexible type creation to KotlinTypeFactory. 2016-06-09 12:57:44 +03:00
Denis Zharkov 07592398c1 Preserve sources properly for coroutine parts
Otherwise incremental reporting leads to exception when inlining into coroutine body happens
2016-06-08 18:53:16 +03:00
Denis Zharkov 7dda2d9f62 Add ability to set up source element when copying descriptor 2016-06-08 18:53:16 +03:00
Denis Zharkov 329fb9d619 Introduce 'coroutine'/'suspend' modifiers 2016-06-08 18:53:16 +03:00
Dmitry Petrov 0319d5a5aa KT-11588 Type aliases
- Nested type aliases
- UNSUPPORTED_TYPEALIAS error (language level < 1.1)
- tests for is/as/as? with type alias
2016-06-01 14:32:46 +03:00
Dmitry Petrov 32f61c3918 KT-11588 Type aliases
Deserialization
2016-05-20 14:17:25 +03:00
Dmitry Petrov 65293008fd KT-11588 Type aliases
Type alias descriptor serialization
Types with type aliases serialization
2016-05-20 14:17:24 +03:00