@NotNull CodegenContext.ownerKind
This commit is contained in:
@@ -47,7 +47,9 @@ public abstract class CodegenContext {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private final DeclarationDescriptor contextDescriptor;
|
private final DeclarationDescriptor contextDescriptor;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
private final OwnerKind contextKind;
|
private final OwnerKind contextKind;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private final CodegenContext parentContext;
|
private final CodegenContext parentContext;
|
||||||
private final ClassDescriptor thisDescriptor;
|
private final ClassDescriptor thisDescriptor;
|
||||||
@@ -61,7 +63,7 @@ public abstract class CodegenContext {
|
|||||||
|
|
||||||
public CodegenContext(
|
public CodegenContext(
|
||||||
@NotNull DeclarationDescriptor contextDescriptor,
|
@NotNull DeclarationDescriptor contextDescriptor,
|
||||||
OwnerKind contextKind,
|
@NotNull OwnerKind contextKind,
|
||||||
@Nullable CodegenContext parentContext,
|
@Nullable CodegenContext parentContext,
|
||||||
@Nullable MutableClosure closure,
|
@Nullable MutableClosure closure,
|
||||||
@Nullable ClassDescriptor thisDescriptor,
|
@Nullable ClassDescriptor thisDescriptor,
|
||||||
@@ -131,12 +133,13 @@ public abstract class CodegenContext {
|
|||||||
return contextDescriptor;
|
return contextDescriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
public OwnerKind getContextKind() {
|
public OwnerKind getContextKind() {
|
||||||
return contextKind;
|
return contextKind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CodegenContext intoNamespace(NamespaceDescriptor descriptor) {
|
public CodegenContext intoNamespace(NamespaceDescriptor descriptor) {
|
||||||
return new NamespaceContext(descriptor, this, null);
|
return new NamespaceContext(descriptor, this, OwnerKind.NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CodegenContext intoNamespacePart(String delegateTo, NamespaceDescriptor descriptor) {
|
public CodegenContext intoNamespacePart(String delegateTo, NamespaceDescriptor descriptor) {
|
||||||
@@ -238,6 +241,7 @@ public abstract class CodegenContext {
|
|||||||
|
|
||||||
public StackValue getReceiverExpression(JetTypeMapper typeMapper) {
|
public StackValue getReceiverExpression(JetTypeMapper typeMapper) {
|
||||||
assert getCallableDescriptorWithReceiver() != null;
|
assert getCallableDescriptorWithReceiver() != null;
|
||||||
|
@SuppressWarnings("ConstantConditions")
|
||||||
Type asmType = typeMapper.mapType(getCallableDescriptorWithReceiver().getReceiverParameter().getType(), JetTypeMapperMode.VALUE);
|
Type asmType = typeMapper.mapType(getCallableDescriptorWithReceiver().getReceiverParameter().getType(), JetTypeMapperMode.VALUE);
|
||||||
return hasThisDescriptor() ? StackValue.local(1, asmType) : StackValue.local(0, asmType);
|
return hasThisDescriptor() ? StackValue.local(1, asmType) : StackValue.local(0, asmType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.codegen.context;
|
package org.jetbrains.jet.codegen.context;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.jet.codegen.OwnerKind;
|
import org.jetbrains.jet.codegen.OwnerKind;
|
||||||
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
||||||
|
|
||||||
@@ -23,8 +24,8 @@ import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
|||||||
* @author alex.tkachman
|
* @author alex.tkachman
|
||||||
*/
|
*/
|
||||||
public class NamespaceContext extends CodegenContext {
|
public class NamespaceContext extends CodegenContext {
|
||||||
public NamespaceContext(NamespaceDescriptor contextDescriptor, CodegenContext parent, OwnerKind kind) {
|
public NamespaceContext(NamespaceDescriptor contextDescriptor, CodegenContext parent, @NotNull OwnerKind kind) {
|
||||||
super(contextDescriptor, kind != null ? kind : OwnerKind.NAMESPACE, parent, null, null, null);
|
super(contextDescriptor, kind, parent, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user