Decompile builtins (kotlin_class and kotlin_package files)

The main purpose of this is to be able to index builtin declarations and enable go to symbol/class functionality in ide
Also it makes sense to show builtin classes (Any, Int ...) as classes when browsing kotlin-runtime.jar

Refactor decompiler code to eliminate existing and potential duplication
Share the code between js (kjsm) decompilation and builtin decompilation heavily
This commit is contained in:
Pavel V. Talanov
2015-12-03 18:10:45 +03:00
parent 6164566cad
commit c40d6af1e5
21 changed files with 533 additions and 137 deletions
@@ -1,31 +0,0 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.serialization.js
import org.jetbrains.kotlin.serialization.ProtoBuf
import java.io.ByteArrayInputStream
public fun ByteArray.toPackageProto(): ProtoBuf.Package {
val registry = KotlinJavascriptSerializedResourcePaths.extensionRegistry
return ProtoBuf.Package.parseFrom(ByteArrayInputStream(this), registry)!!
}
public fun ByteArray.toClassProto(): ProtoBuf.Class {
val registry = KotlinJavascriptSerializedResourcePaths.extensionRegistry
return ProtoBuf.Class.parseFrom(ByteArrayInputStream(this), registry)
}