org.jetbrains.kotlin.codegen.context
Class CodegenContext<T extends DeclarationDescriptor>

java.lang.Object
  extended by org.jetbrains.kotlin.codegen.context.CodegenContext<T>
Direct Known Subclasses:
FieldOwnerContext, MethodContext, RootContext

public abstract class CodegenContext<T extends DeclarationDescriptor>
extends java.lang.Object


Field Summary
 MutableClosure closure
           
 
Constructor Summary
CodegenContext(T contextDescriptor, OwnerKind contextKind, CodegenContext parentContext, MutableClosure closure, ClassDescriptor thisDescriptor, LocalLookup localLookup)
           
 
Method Summary
<D extends CallableMemberDescriptor>
D
accessibleDescriptor(D descriptor, ClassDescriptor superCallTarget)
           
protected  StackValue.Field computeOuterExpression()
           
protected  CodegenContext findChildContext(DeclarationDescriptor child)
           
 CodegenContext findParentContextWithDescriptor(DeclarationDescriptor descriptor)
           
<D extends CallableMemberDescriptor>
D
getAccessor(D possiblySubstitutedDescriptor, FieldAccessorKind accessorKind, KotlinType delegateType, ClassDescriptor superCallTarget)
           
<D extends CallableMemberDescriptor>
D
getAccessorForSuperCallIfNeeded(D descriptor, ClassDescriptor superCallTarget)
           
 java.util.Collection<? extends AccessorForCallableDescriptor<?>> getAccessors()
           
 CallableDescriptor getCallableDescriptorWithReceiver()
          This method returns not null only if context descriptor corresponds to method or function which has receiver
 CodegenContext<? extends ClassOrPackageFragmentDescriptor> getClassOrPackageParentContext()
           
 T getContextDescriptor()
           
 OwnerKind getContextKind()
           
 ClassDescriptor getEnclosingClass()
           
 CodegenContext getFirstCrossInlineOrNonInlineContext()
           
 StackValue getOuterExpression(StackValue prefix, boolean ignoreNoOuter)
           
 CodegenContext getParentContext()
           
 GenerationState getState()
           
 ClassDescriptor getThisDescriptor()
           
 boolean hasThisDescriptor()
           
 ClassContext intoAnonymousClass(ClassDescriptor descriptor, ExpressionCodegen codegen, OwnerKind ownerKind)
           
 ClassContext intoClass(ClassDescriptor descriptor, OwnerKind kind, GenerationState state)
           
 ClosureContext intoClosure(FunctionDescriptor funDescriptor, LocalLookup localLookup, JetTypeMapper typeMapper)
           
 ConstructorContext intoConstructor(ConstructorDescriptor descriptor)
           
 ClassContext intoDefaultImplsClass(ClassDescriptor descriptor, ClassContext interfaceContext, GenerationState state)
           
 MethodContext intoFunction(FunctionDescriptor descriptor)
           
 MethodContext intoInlinedLambda(FunctionDescriptor descriptor, boolean isCrossInline)
           
 FieldOwnerContext<PackageFragmentDescriptor> intoMultifileClass(PackageFragmentDescriptor descriptor, org.jetbrains.org.objectweb.asm.Type multifileClassType, org.jetbrains.org.objectweb.asm.Type filePartType)
           
 FieldOwnerContext<PackageFragmentDescriptor> intoMultifileClassPart(PackageFragmentDescriptor descriptor, org.jetbrains.org.objectweb.asm.Type multifileClassType, org.jetbrains.org.objectweb.asm.Type filePartType, KtFile sourceFile)
           
 PackageContext intoPackagePart(PackageFragmentDescriptor descriptor, org.jetbrains.org.objectweb.asm.Type packagePartType, KtFile sourceFile)
           
 ScriptContext intoScript(ScriptDescriptor script, java.util.List<ScriptDescriptor> earlierScripts, ClassDescriptor classDescriptor, JetTypeMapper typeMapper)
           
 boolean isInlineMethodContext()
           
 StackValue lookupInContext(DeclarationDescriptor d, StackValue result, GenerationState state, boolean ignoreNoOuter)
           
protected  boolean shouldAddChild(CodegenContext child)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

closure

public final MutableClosure closure
Constructor Detail

CodegenContext

public CodegenContext(@NotNull
                      T contextDescriptor,
                      @NotNull
                      OwnerKind contextKind,
                      @Nullable
                      CodegenContext parentContext,
                      @Nullable
                      MutableClosure closure,
                      @Nullable
                      ClassDescriptor thisDescriptor,
                      @Nullable
                      LocalLookup localLookup)
Method Detail

getState

@NotNull
public GenerationState getState()

getThisDescriptor

@NotNull
public final ClassDescriptor getThisDescriptor()

hasThisDescriptor

public final boolean hasThisDescriptor()

getClassOrPackageParentContext

@NotNull
public CodegenContext<? extends ClassOrPackageFragmentDescriptor> getClassOrPackageParentContext()

getCallableDescriptorWithReceiver

@Nullable
public final CallableDescriptor getCallableDescriptorWithReceiver()
This method returns not null only if context descriptor corresponds to method or function which has receiver


getOuterExpression

public StackValue getOuterExpression(@Nullable
                                     StackValue prefix,
                                     boolean ignoreNoOuter)

getContextDescriptor

@NotNull
public T getContextDescriptor()

getContextKind

@NotNull
public OwnerKind getContextKind()

intoPackagePart

@NotNull
public PackageContext intoPackagePart(@NotNull
                                              PackageFragmentDescriptor descriptor,
                                              org.jetbrains.org.objectweb.asm.Type packagePartType,
                                              @Nullable
                                              KtFile sourceFile)

intoMultifileClassPart

@NotNull
public FieldOwnerContext<PackageFragmentDescriptor> intoMultifileClassPart(@NotNull
                                                                                   PackageFragmentDescriptor descriptor,
                                                                                   @NotNull
                                                                                   org.jetbrains.org.objectweb.asm.Type multifileClassType,
                                                                                   @NotNull
                                                                                   org.jetbrains.org.objectweb.asm.Type filePartType,
                                                                                   @NotNull
                                                                                   KtFile sourceFile)

intoMultifileClass

@NotNull
public FieldOwnerContext<PackageFragmentDescriptor> intoMultifileClass(@NotNull
                                                                               PackageFragmentDescriptor descriptor,
                                                                               @NotNull
                                                                               org.jetbrains.org.objectweb.asm.Type multifileClassType,
                                                                               @NotNull
                                                                               org.jetbrains.org.objectweb.asm.Type filePartType)

intoDefaultImplsClass

public ClassContext intoDefaultImplsClass(ClassDescriptor descriptor,
                                          ClassContext interfaceContext,
                                          GenerationState state)

intoClass

@NotNull
public ClassContext intoClass(ClassDescriptor descriptor,
                                      OwnerKind kind,
                                      GenerationState state)

intoAnonymousClass

@NotNull
public ClassContext intoAnonymousClass(@NotNull
                                               ClassDescriptor descriptor,
                                               @NotNull
                                               ExpressionCodegen codegen,
                                               @NotNull
                                               OwnerKind ownerKind)

intoFunction

@NotNull
public MethodContext intoFunction(FunctionDescriptor descriptor)

intoInlinedLambda

@NotNull
public MethodContext intoInlinedLambda(FunctionDescriptor descriptor,
                                               boolean isCrossInline)

intoConstructor

@NotNull
public ConstructorContext intoConstructor(@NotNull
                                                  ConstructorDescriptor descriptor)

intoScript

@NotNull
public ScriptContext intoScript(@NotNull
                                        ScriptDescriptor script,
                                        @NotNull
                                        java.util.List<ScriptDescriptor> earlierScripts,
                                        @NotNull
                                        ClassDescriptor classDescriptor,
                                        @NotNull
                                        JetTypeMapper typeMapper)

intoClosure

@NotNull
public ClosureContext intoClosure(@NotNull
                                          FunctionDescriptor funDescriptor,
                                          @NotNull
                                          LocalLookup localLookup,
                                          @NotNull
                                          JetTypeMapper typeMapper)

getParentContext

@Nullable
public CodegenContext getParentContext()

getEnclosingClass

public ClassDescriptor getEnclosingClass()

findParentContextWithDescriptor

@Nullable
public CodegenContext findParentContextWithDescriptor(DeclarationDescriptor descriptor)

getAccessorForSuperCallIfNeeded

@NotNull
public <D extends CallableMemberDescriptor> D getAccessorForSuperCallIfNeeded(@NotNull
                                                                                      D descriptor,
                                                                                      @Nullable
                                                                                      ClassDescriptor superCallTarget)

getAccessor

@NotNull
public <D extends CallableMemberDescriptor> D getAccessor(@NotNull
                                                                  D possiblySubstitutedDescriptor,
                                                                  @NotNull
                                                                  FieldAccessorKind accessorKind,
                                                                  @Nullable
                                                                  KotlinType delegateType,
                                                                  @Nullable
                                                                  ClassDescriptor superCallTarget)

computeOuterExpression

@Nullable
protected StackValue.Field computeOuterExpression()

lookupInContext

public StackValue lookupInContext(DeclarationDescriptor d,
                                  @Nullable
                                  StackValue result,
                                  GenerationState state,
                                  boolean ignoreNoOuter)

getAccessors

@NotNull
@ReadOnly
public java.util.Collection<? extends AccessorForCallableDescriptor<?>> getAccessors()

accessibleDescriptor

@NotNull
public <D extends CallableMemberDescriptor> D accessibleDescriptor(@NotNull
                                                                           D descriptor,
                                                                           @Nullable
                                                                           ClassDescriptor superCallTarget)

shouldAddChild

protected boolean shouldAddChild(@NotNull
                                 CodegenContext child)

findChildContext

@Nullable
protected CodegenContext findChildContext(@NotNull
                                                   DeclarationDescriptor child)

isInlineMethodContext

public boolean isInlineMethodContext()

getFirstCrossInlineOrNonInlineContext

@NotNull
public CodegenContext getFirstCrossInlineOrNonInlineContext()