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

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

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


Field Summary
 MutableClosure closure
           
static CodegenContext STATIC
           
 
Constructor Summary
CodegenContext(T contextDescriptor, OwnerKind contextKind, CodegenContext parentContext, MutableClosure closure, ClassDescriptor thisDescriptor, LocalLookup expressionCodegen)
           
 
Method Summary
 FunctionDescriptor accessibleFunctionDescriptor(FunctionDescriptor fd)
           
 PropertyDescriptor accessiblePropertyDescriptor(PropertyDescriptor propertyDescriptor)
           
 CodegenContext findChildContext(DeclarationDescriptor child)
           
 CodegenContext findParentContextWithDescriptor(DeclarationDescriptor descriptor)
           
 DeclarationDescriptor getAccessor(DeclarationDescriptor descriptor)
           
 DeclarationDescriptor getAccessor(DeclarationDescriptor descriptor, boolean isForBackingFieldInOuterClass, JetType delegateType)
           
 java.util.Map<DeclarationDescriptor,DeclarationDescriptor> getAccessors()
           
 CallableDescriptor getCallableDescriptorWithReceiver()
          This method returns not null only if context descriptor corresponds to method or function which has receiver
 DeclarationDescriptor getClassOrNamespaceDescriptor()
           
 T getContextDescriptor()
           
 OwnerKind getContextKind()
           
 ClassDescriptor getEnclosingClass()
           
 StackValue getOuterExpression(StackValue prefix, boolean ignoreNoOuter)
           
 CodegenContext getParentContext()
           
 StackValue getReceiverExpression(JetTypeMapper typeMapper)
           
 ClassDescriptor getThisDescriptor()
           
 boolean hasThisDescriptor()
           
protected  void initOuterExpression(JetTypeMapper typeMapper, ClassDescriptor classDescriptor)
           
 ClassContext intoAnonymousClass(ClassDescriptor descriptor, ExpressionCodegen expressionCodegen)
           
 ClassContext intoClass(ClassDescriptor descriptor, OwnerKind kind, GenerationState state)
           
 CodegenContext intoClosure(FunctionDescriptor funDescriptor, LocalLookup localLookup, JetTypeMapper typeMapper)
           
 ConstructorContext intoConstructor(ConstructorDescriptor descriptor, MutableClosure closure)
           
 MethodContext intoFunction(FunctionDescriptor descriptor)
           
 FieldOwnerContext intoNamespace(NamespaceDescriptor descriptor)
           
 FieldOwnerContext intoNamespaceFacade(org.jetbrains.asm4.Type delegateTo, NamespaceDescriptor descriptor)
           
 ScriptContext intoScript(ScriptDescriptor script, ClassDescriptor classDescriptor)
           
abstract  boolean isStatic()
           
 StackValue lookupInContext(DeclarationDescriptor d, StackValue result, GenerationState state, boolean ignoreNoOuter)
           
 FrameMap prepareFrame(JetTypeMapper mapper)
           
 void recordSyntheticAccessorIfNeeded(FunctionDescriptor fd, JetTypeMapper typeMapper)
           
 void recordSyntheticAccessorIfNeeded(PropertyDescriptor propertyDescriptor, JetTypeMapper typeMapper)
           
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

STATIC

public static final CodegenContext STATIC

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 expressionCodegen)
Method Detail

getThisDescriptor

@NotNull
public final ClassDescriptor getThisDescriptor()

hasThisDescriptor

public final boolean hasThisDescriptor()

getClassOrNamespaceDescriptor

public DeclarationDescriptor getClassOrNamespaceDescriptor()

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()

intoNamespace

@NotNull
public FieldOwnerContext intoNamespace(@NotNull
                                               NamespaceDescriptor descriptor)

intoNamespaceFacade

@NotNull
public FieldOwnerContext intoNamespaceFacade(@NotNull
                                                     org.jetbrains.asm4.Type delegateTo,
                                                     @NotNull
                                                     NamespaceDescriptor descriptor)

intoClass

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

intoAnonymousClass

@NotNull
public ClassContext intoAnonymousClass(@NotNull
                                               ClassDescriptor descriptor,
                                               @NotNull
                                               ExpressionCodegen expressionCodegen)

intoFunction

@NotNull
public MethodContext intoFunction(FunctionDescriptor descriptor)

intoConstructor

@NotNull
public ConstructorContext intoConstructor(@Nullable
                                                  ConstructorDescriptor descriptor,
                                                  @Nullable
                                                  MutableClosure closure)

intoScript

@NotNull
public ScriptContext intoScript(@NotNull
                                        ScriptDescriptor script,
                                        @NotNull
                                        ClassDescriptor classDescriptor)

intoClosure

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

prepareFrame

public FrameMap prepareFrame(JetTypeMapper mapper)

getParentContext

@Nullable
public CodegenContext getParentContext()

getEnclosingClass

public ClassDescriptor getEnclosingClass()

findParentContextWithDescriptor

@Nullable
public CodegenContext findParentContextWithDescriptor(DeclarationDescriptor descriptor)

getAccessor

@NotNull
public DeclarationDescriptor getAccessor(@NotNull
                                                 DeclarationDescriptor descriptor)

getAccessor

@NotNull
public DeclarationDescriptor getAccessor(@NotNull
                                                 DeclarationDescriptor descriptor,
                                                 boolean isForBackingFieldInOuterClass,
                                                 @Nullable
                                                 JetType delegateType)

getReceiverExpression

public StackValue getReceiverExpression(JetTypeMapper typeMapper)

isStatic

public abstract boolean isStatic()

initOuterExpression

protected void initOuterExpression(@NotNull
                                   JetTypeMapper typeMapper,
                                   @NotNull
                                   ClassDescriptor classDescriptor)

lookupInContext

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

getAccessors

@NotNull
public java.util.Map<DeclarationDescriptor,DeclarationDescriptor> getAccessors()

accessiblePropertyDescriptor

@NotNull
public PropertyDescriptor accessiblePropertyDescriptor(PropertyDescriptor propertyDescriptor)

accessibleFunctionDescriptor

@NotNull
public FunctionDescriptor accessibleFunctionDescriptor(FunctionDescriptor fd)

recordSyntheticAccessorIfNeeded

@NotNull
public void recordSyntheticAccessorIfNeeded(@NotNull
                                                    FunctionDescriptor fd,
                                                    @NotNull
                                                    JetTypeMapper typeMapper)

recordSyntheticAccessorIfNeeded

@NotNull
public void recordSyntheticAccessorIfNeeded(PropertyDescriptor propertyDescriptor,
                                                    JetTypeMapper typeMapper)

shouldAddChild

protected boolean shouldAddChild(@NotNull
                                 CodegenContext child)

findChildContext

@Nullable
public CodegenContext findChildContext(@NotNull
                                                DeclarationDescriptor child)