/*package*/ NamespaceTranslator( @NotNull NamespaceDescriptor descriptor, @NotNull ClassDeclarationTranslator classDeclarationTranslator, @NotNull TranslationContext context) { super(context.newDeclaration(descriptor)); this.descriptor = descriptor; this.namespaceName = context.getNameForDescriptor(descriptor); this.classDeclarationTranslator = classDeclarationTranslator; }
@Nullable private JsExpression getThisObject() { if (qualifier != null && !isExtensionCall) { return qualifier; } return context.thisAliasProvider().get(resolvedCall); }
public ClassDeclarationTranslator(@NotNull TranslationContext context) { super(context); dummyFunction = new JsFunction(context.scope()); JsName declarationsObject = context().scope().declareName(Namer.nameForClassesVariable()); classesVar = new JsVars.JsVar(declarationsObject); declarationsObjectRef = declarationsObject.makeRef(); }
@NotNull private JsExpression getExtensionFunctionCallReceiver() { if (qualifier != null) { return qualifier; } DeclarationDescriptor receiverDescriptor = getDeclarationDescriptorForExtensionCallReceiver(resolvedCall); return context.getThisObject(receiverDescriptor); }
/* package */ @NotNull static DefineInvocation create( @NotNull FqName packageFqName, @Nullable JsExpression initializer, @NotNull JsObjectLiteral members, @NotNull TranslationContext context) { return new DefineInvocation( initializer == null ? JsLiteral.NULL : initializer, new JsDocComment(JsAstUtils.LENDS_JS_DOC_TAG, context.getQualifiedReference(packageFqName)), members); }
/*package*/ CachedArrayAccessTranslator( @NotNull JetArrayAccessExpression expression, @NotNull TranslationContext context) { super(expression, context); arrayExpression = context.declareTemporary(translateArrayExpression()); indexExpressions = fromExpressionList(translateIndexExpressions(), context); }
@Nullable public static Name getNameIfStandardType( @NotNull JetExpression expression, @NotNull TranslationContext context) { JetType type = context.bindingContext().get(BindingContext.EXPRESSION_TYPE, expression); return type != null ? getNameIfStandardType(type) : null; }