(@alexey.andreev) JS BE should handle TypeAliasConstructorDescriptor accordingly.
This commit is contained in:
committed by
Dmitry Petrov
parent
b31ab729de
commit
9d373fba67
+5
-1
@@ -24,6 +24,7 @@ import com.google.dart.compiler.backend.js.ast.metadata.sideEffects
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.impl.TypeAliasConstructorDescriptor
|
||||
import org.jetbrains.kotlin.js.translate.context.Namer
|
||||
import org.jetbrains.kotlin.js.translate.context.TranslationContext
|
||||
import org.jetbrains.kotlin.js.translate.reference.ReferenceTranslator
|
||||
@@ -35,7 +36,10 @@ import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
||||
|
||||
|
||||
val CallInfo.callableDescriptor: CallableDescriptor
|
||||
get() = resolvedCall.resultingDescriptor.original
|
||||
get() {
|
||||
val result = resolvedCall.resultingDescriptor.original
|
||||
return if (result is TypeAliasConstructorDescriptor) result.underlyingConstructorDescriptor else result
|
||||
}
|
||||
|
||||
fun CallInfo.isExtension(): Boolean = extensionReceiver != null
|
||||
|
||||
|
||||
@@ -267,20 +267,6 @@ public final class StaticContext {
|
||||
private final class NameGenerator extends Generator<JsName> {
|
||||
|
||||
public NameGenerator() {
|
||||
Rule<JsName> typeAliasConstructor = new Rule<JsName>() {
|
||||
@Nullable
|
||||
@Override
|
||||
public JsName apply(@NotNull DeclarationDescriptor descriptor) {
|
||||
if (descriptor instanceof TypeAliasConstructorDescriptor) {
|
||||
TypeAliasConstructorDescriptor constructorDescriptor = (TypeAliasConstructorDescriptor) descriptor;
|
||||
return getNameForDescriptor(constructorDescriptor.getUnderlyingConstructorDescriptor());
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Rule<JsName> namesForDynamic = new Rule<JsName>() {
|
||||
@Override
|
||||
@Nullable
|
||||
@@ -437,7 +423,6 @@ public final class StaticContext {
|
||||
}
|
||||
};
|
||||
|
||||
addRule(typeAliasConstructor);
|
||||
addRule(namesForDynamic);
|
||||
addRule(localClasses);
|
||||
addRule(namesForStandardClasses);
|
||||
|
||||
Reference in New Issue
Block a user