@NotNull CodegenContext.ownerKind

This commit is contained in:
Alex Tkachman
2012-08-30 14:18:54 +03:00
parent 6a6f214b82
commit a45bae63ab
2 changed files with 9 additions and 4 deletions
@@ -47,7 +47,9 @@ public abstract class CodegenContext {
@NotNull
private final DeclarationDescriptor contextDescriptor;
@NotNull
private final OwnerKind contextKind;
@Nullable
private final CodegenContext parentContext;
private final ClassDescriptor thisDescriptor;
@@ -61,7 +63,7 @@ public abstract class CodegenContext {
public CodegenContext(
@NotNull DeclarationDescriptor contextDescriptor,
OwnerKind contextKind,
@NotNull OwnerKind contextKind,
@Nullable CodegenContext parentContext,
@Nullable MutableClosure closure,
@Nullable ClassDescriptor thisDescriptor,
@@ -131,12 +133,13 @@ public abstract class CodegenContext {
return contextDescriptor;
}
@NotNull
public OwnerKind getContextKind() {
return contextKind;
}
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) {
@@ -238,6 +241,7 @@ public abstract class CodegenContext {
public StackValue getReceiverExpression(JetTypeMapper typeMapper) {
assert getCallableDescriptorWithReceiver() != null;
@SuppressWarnings("ConstantConditions")
Type asmType = typeMapper.mapType(getCallableDescriptorWithReceiver().getReceiverParameter().getType(), JetTypeMapperMode.VALUE);
return hasThisDescriptor() ? StackValue.local(1, asmType) : StackValue.local(0, asmType);
}
@@ -16,6 +16,7 @@
package org.jetbrains.jet.codegen.context;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.codegen.OwnerKind;
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
@@ -23,8 +24,8 @@ import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
* @author alex.tkachman
*/
public class NamespaceContext extends CodegenContext {
public NamespaceContext(NamespaceDescriptor contextDescriptor, CodegenContext parent, OwnerKind kind) {
super(contextDescriptor, kind != null ? kind : OwnerKind.NAMESPACE, parent, null, null, null);
public NamespaceContext(NamespaceDescriptor contextDescriptor, CodegenContext parent, @NotNull OwnerKind kind) {
super(contextDescriptor, kind, parent, null, null, null);
}
@Override