JS: fix translation of references to external nested classes in files marked with @JsModule. See KT-15797

This commit is contained in:
Alexey Andreev
2017-01-19 15:53:25 +03:00
parent 5fc8208504
commit 245f23e7c2
12 changed files with 64 additions and 7 deletions
@@ -279,7 +279,7 @@ public final class StaticContext {
expression = getQualifiedExpression(suggested.getScope());
}
if (isNativeObject(suggested.getDescriptor())) {
if (isNativeObject(suggested.getDescriptor()) && DescriptorUtils.isTopLevelDeclaration(suggested.getDescriptor())) {
String fileModuleName = AnnotationsUtils.getFileModuleName(getBindingContext(), suggested.getDescriptor());
if (fileModuleName != null) {
JsName moduleJsName = getImportedModule(fileModuleName, null).internalName;
@@ -6,6 +6,11 @@ define("lib", [], function() {
return this.x + y;
};
function Nested() {
this.y = 55;
}
A.Nested = Nested;
B = {
x: 123,
foo: function(y) {
+8 -1
View File
@@ -2,10 +2,14 @@
@file:JsModule("lib")
package foo
external class A(@native x: Int = noImpl) {
external class A(x: Int) {
val x: Int
fun foo(y: Int): Int = noImpl
class Nested {
val y: Int
}
}
external object B {
@@ -25,6 +29,9 @@ fun box(): String {
assertEquals(23, a.x)
assertEquals(65, a.foo(42))
val nested = A.Nested()
assertEquals(55, nested.y)
assertEquals(123, B.x)
assertEquals(265, B.foo(142))
@@ -6,6 +6,11 @@ var lib = function() {
return this.x + y;
};
function Nested() {
this.y = 55;
}
A.Nested = Nested;
B = {
x: 123,
foo: function(y) {
@@ -6,6 +6,10 @@ external class A(x: Int = noImpl) {
val x: Int
fun foo(y: Int): Int = noImpl
class Nested {
val y: Int
}
}
external object B {
@@ -25,6 +29,9 @@ fun box(): String {
assertEquals(23, a.x)
assertEquals(65, a.foo(42))
val nested = A.Nested()
assertEquals(55, nested.y)
assertEquals(123, B.x)
assertEquals(265, B.foo(142))